You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.8 KiB
C++
70 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "ZxPolicy.h"
|
|
class IxGridAlign;
|
|
|
|
/// 策略:图件控制点
|
|
/// 通常是在图件激活时, 显示一些控制点和辅助线, 拖动控制点可调节图件形状.
|
|
class I_PLOTBASE_EXPORT ZxHandlePolicy : public ZxPolicy
|
|
{
|
|
public:
|
|
ZxHandlePolicy();
|
|
|
|
/// 获取指定位置的控制点id.
|
|
/// 即鼠标为于pt处, 调用这个函数可判断鼠标下面是哪个控制点.
|
|
/// @param pt 指定位置.
|
|
/// @param fHandleSize 控制点的参考尺寸, 随着视图的缩放变化.
|
|
/// @return 控制点id, 0表示pt不在控制点上
|
|
virtual int getHandleId(const QPointF& pt, double fHandleSize);
|
|
|
|
/// 开始移动控制点
|
|
virtual void onBeginMove(int handle, const QPointF& pt);
|
|
|
|
/// 控制点移动
|
|
virtual void onMove(int handle, const QPointF& pt);
|
|
|
|
/// 停止移动控制点
|
|
virtual void onEndMove(int handle, const QPointF& pt);
|
|
|
|
/// 左键在控制点处按下
|
|
virtual void onLeftDown(int handle, const QPointF& pt);
|
|
|
|
// 左键在控制点处抬起
|
|
virtual void onLeftUp(int handle, const QPointF& pt);
|
|
|
|
/// 左键单击控制点
|
|
virtual void onLeftClick(int handle, const QPointF& pt);
|
|
|
|
/// 左键双击控制点
|
|
virtual void onLeftDoubleClick(int handle, const QPointF& pt);
|
|
|
|
/// 获取控制点的光标形状
|
|
virtual QCursor getCursor(int handle);
|
|
|
|
virtual void onPaint(QPainter* painter, const ZxPaintParam& param);
|
|
|
|
/// 刷新编辑区域, 包括整个图件的区域、控制点和辅助线
|
|
virtual void update();
|
|
|
|
/// 返回Policy的边框
|
|
virtual QRectF getBounds() const;
|
|
|
|
QPointF calcSnapPos(const QPointF& pt) const;
|
|
|
|
protected:
|
|
// virtual void onAddToEdit();
|
|
|
|
// virtual void onRemoveFromEdit();
|
|
|
|
friend class ZxEdit;
|
|
|
|
int m_nActiveHandle;
|
|
|
|
IxGridAlign* getSnapGrid() const;
|
|
};
|
|
|
|
|
|
|
|
|
|
|