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.
80 lines
1.7 KiB
C++
80 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <QPointF>
|
|
#include <QRectF>
|
|
#include "iPlotBase_global.h"
|
|
|
|
class ZxTool;
|
|
class ZxRenderItem;
|
|
|
|
/// @internal
|
|
class ZxToolState
|
|
{
|
|
public:
|
|
|
|
ZxToolState();
|
|
|
|
/// 最后活动工具
|
|
ZxTool* getLastActivateTool();
|
|
void setLastActivateTool(ZxTool* p);
|
|
|
|
/// 键是否按下
|
|
bool isLeftDown() const;
|
|
bool isRightDown() const;
|
|
|
|
/// 鼠标左键或右键按下的位置
|
|
const QPointF& getDownPos() const;
|
|
void setDownPos(const QPointF& pt);
|
|
|
|
/// 鼠标左键或右键按下时的控制键状态
|
|
Qt::KeyboardModifiers getDownModifiers() const;
|
|
void setDownModifiers(const Qt::KeyboardModifiers & flags);
|
|
|
|
/// 鼠标当前控制键状态
|
|
Qt::KeyboardModifiers getCurrentModifiers() const;
|
|
void setCurrentModifiers(const Qt::KeyboardModifiers & flags);
|
|
|
|
/// 鼠标当前位置
|
|
const QPointF& getCurrentPos() const;
|
|
void setCurrentPos(const QPointF& pt);
|
|
|
|
/// 鼠标前一个位置
|
|
const QPointF& getPreviousPos();
|
|
|
|
/// 鼠标左键或右键按下后到最后一次移动之间拖出来的矩形区域
|
|
QRectF getTrackRect() const;
|
|
|
|
/// 是否点击. 即按下后原地抬起.
|
|
bool isClick() const;
|
|
|
|
/// 清除所有信息
|
|
void clear();
|
|
|
|
/// 选中图件
|
|
ZxRenderItem* getActiveItem() const;
|
|
void setActiveItem(ZxRenderItem* p);
|
|
|
|
protected:
|
|
|
|
ZxTool* m_pLastActiveTool;
|
|
ZxRenderItem* m_pActiveItem;
|
|
|
|
QPointF m_ptDown;
|
|
QPointF m_ptCurrent;
|
|
QPointF m_ptPrevious;
|
|
|
|
double m_fMaxOffset;
|
|
|
|
bool m_bLeftDown;
|
|
bool m_bRightDown;
|
|
|
|
Qt::KeyboardModifiers m_nDownModifiers;
|
|
Qt::KeyboardModifiers m_nCurrentModifiers;
|
|
|
|
friend class ZxRenderView;
|
|
};
|
|
|
|
|
|
|
|
|