#pragma once #include "ZxSimpleTool.h" /// 组合图形工具 class I_PLOTBASE_EXPORT ZxCompoundTool : public ZxTool { Q_OBJECT public: ZxCompoundTool(); ~ZxCompoundTool(); public: /// 在前面插入子工具 void prepend(ZxSimpleTool* pTool); /// 在指定位置插入子工具 void insert(int pos, ZxSimpleTool* pTool); /// 在后面追加子工具 void append(ZxSimpleTool* pTool); /// 移除子工具 void remove(ZxSimpleTool* pTool); virtual ZxSimpleTool* getLastActivateTool(); protected: virtual bool onLeftDown(const QPointF& pt); virtual bool onLeftUp(const QPointF& pt); virtual bool onRightDown(const QPointF& pt); virtual bool onRightUp(const QPointF& pt); virtual bool onMouseMove(const QPointF& pt); virtual bool onLeftDoubleClick(const QPointF& pt); virtual bool onMouseWheel(const QPointF& pt, int delta); virtual void onKeyPress(QKeyEvent* event); virtual void onKeyRelease(QKeyEvent* event); virtual void onSelectionChanged(ZxSelection& selection); /// 绘制工具的拖曳线/拖曳框等临时的辅助元素 virtual void onPaint(QPainter* painter, const ZxPaintParam& param); protected: /// 在工具被激活时调用 virtual void onActivated(); /// 在工具被取消激活时调用 virtual void onDeactivated(); protected: void _callOnActivated(); void _callOnDeactivated(); protected: QVector m_vecSubTools; QVector m_vecDownTools; };