#pragma once #include "IView.h" //#include "SigmaView.h" class CSigmaDoc; class CSigmaView; namespace NDrawView { enum class MouseButtons { Left = 0x100000, None = 0, Right = 0x200000, Middle = 0x400000, XButton1 = 0x800000, XButton2 = 0x1000000, }; #define ITEM_VIEW 1001 //图形浏览 #define ITEM_PRINT 1002 //打印设置 class CItemBase : public CObject { public: CItemBase(CSigmaDoc * ppDoc); virtual ~CItemBase(void); void SetType(long type); long GetType(void); COLORREF m_BackColor = RGB(0, 0, 0); void SetDoc(CSigmaDoc * ppDoc); CSigmaDoc * GetDrawDoc(void); CSigmaView * GetDrawView(void); CXyDC * GetDC(void) const; CDC* GetScreenDC(); void SetScreenDC(CDC* pDC); CDC* GetImgDC(); void DrawCrossPoint(CXyDC* pDC, double x, double y); void DrawLineScreen(int x1, int y1, int x2, int y2); void DrawLineReal(double x1, double y1, double x2, double y2); CPoint2D CenterPoint(void); dfPoint GetReal(CPoint point); CRect GetNegativeRect(CRect* pRect); BOOL IsCaptureState(void); BOOL IsPopupRightMenu(void); void EnablePopupRightMenu(BOOL bPopup); void EnableRButtonCancel(BOOL bEnable); void InvalidateRect(CRect8 rect); void SetStatusBarLengthInfo(double x1, double y1, double x2, double y2, BYTE*& destBuffer, int& destLen); virtual void OnLButtonDblClk(UINT nFlags, CPoint point); virtual void OnLButtonDown(CDC *pDC, UINT nFlags, CPoint point, int vk); virtual void OnLButtonUp(CDC *pDC, UINT nFlags, CPoint point, int vk); virtual int OnMouseMove(CDC *pDC, UINT nFlags, CPoint point); virtual void OnMouseMoveStatus(CDC *pDC, UINT nFlags, CPoint point, BYTE*& destBuffer, int& destLen); virtual void OnRButtonDblClk(UINT nFlags, CPoint point); virtual void OnRButtonDown(UINT nFlags, CPoint point); virtual BOOL OnRButtonUp(UINT nFlags, CPoint point); virtual void OnMouseWheel(uint32_t button, int32_t clicks, int32_t x, int32_t y, int32_t delta); virtual BOOL OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); virtual BOOL OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags); virtual BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); virtual void OnDraw(CXyDC* pDC); virtual void OnDraw(CXyDC* pXyDC, CDC* pDC); //函数功能:绘制辅图形 例如绘制直线段时 已绘制出的直线段 就是辅助图形。 //注:因为刷新全图时 会将辅助图形擦掉 所以要重新绘制出来 virtual void DrawAssistant(CDC * pDC, int mouseX, int mouseY); virtual int GetSubMenu(); virtual void OnOK(void); virtual void OnCancel(void); void SetHDC(HDC hdc); ////属性项 //virtual BOOL InitPropertyGrid(CXTPPropertyGrid& grid); //virtual BOOL OnGridItemChangeValue(CXTPPropertyGridItem* pItem); //virtual void OnInplaceButtonDown(CXTPPropertyGridItem* pItem); static CString GetFloatFormatString(BOOL bIsE=FALSE); CString info; protected: //IView * m_pView = nullptr; CSigmaDoc * m_pDoc = nullptr; long m_type = 0; //当为增加状态时,才起作用 BOOL m_bPopupRightMenu = FALSE; //为了禁止一些情况下弹出右键菜单 BOOL m_bEnableRButtonCancel = FALSE; //当鼠标按下时是否取消当前的插入状态 CPoint2D m_point; HDC m_hdc; CDC* m_pScreenDC = nullptr; }; }//namespace using namespace NDrawView;