FLImaging 6.5.8.1
GUIPropertyGridCtrl.h
1#pragma once
2
3#include <vector>
4#include <unordered_map>
5#include "GUIDefinitions.h"
6
7#define AFX_STRETCH_DELTA 2
8
9namespace FLImaging
10{
11 namespace GUI
12 {
13 class CGUIMainFrame;
14 class CGUIPaneProperties;
15 class CGUIMenuItemProperty;
16 class CGUIPropertyItemBase;
17 class CGUIPropertyGridPropertyDropdownList;
18 class CGUIPropertyGridPropertyViewGraphList;
19 class CGUIPropertyGridPropertyViewImageList;
20 class CGUIPropertyGridPropertyView3DList;
21 class CGUIPropertyGridPropertyBase;
22 class CGUIPropertyGridToolTipCtrl;
23 class CGUIPropertyGridPropertyCategory;
24 class CGUIPropertyGridPropertyRadioButtonGroup;
25 class CGUIPropertyGridPropertyRadioButton;
26 class CGUIScrollBarOwnerDrawn;
27
28 class FL_EXPORT CGUIPropertyGridCtrl : public CMFCPropertyGridCtrl, public Base::CFLBase
29 {
30 friend class CGUIPropertyGridPropertySliderDualHandle;
31 friend class CGUIDialogPropertyImageFigureDrawingAttribute;
32 public:
33 CGUIPropertyGridCtrl();
34 virtual ~CGUIPropertyGridCtrl();
35
36 void SetFontBold(HFONT hfont);
37 void SetFont(HFONT hfont);
38 virtual void AdjustLayout() override;
39
40 void GetPropertyByVisibleOrder(std::vector<CMFCPropertyGridProperty*>& vctProps, CMFCPropertyGridProperty* pParent = nullptr) const;
41
42 virtual void SetParentPane(CGUIPaneProperties* pParentPane);
43 virtual CGUIPaneProperties* GetParentPane() const;
44
45 virtual void SetParentMainFrame(CGUIMainFrame* pMainFrame);
46 virtual CGUIMainFrame* GetParentMainFrame() const;
47
48 virtual const CGUIScrollBarOwnerDrawn* GetOwnerDrawScrollBar(EOrientation eOrientation = EOrientation_Vertical) const;
49
50 virtual void SetLeftColumnWidth(int32_t i32LeftColumnWidth);
51
52 virtual COLORREF GetCustomColorGroupText() const;
53 virtual void SetCustomColorGroupText(COLORREF color);
54
55 virtual COLORREF GetCustomColorGroupBackground() const;
56 virtual void SetCustomColorGroupBackground(COLORREF color);
57
58 virtual CFont* GetFontBold();
59
60 virtual void AddToUpdateBuffer(CMFCPropertyGridProperty* pPGP, const COleVariant& var);
61
62 virtual CMFCPropertyGridProperty* HitTest(CPoint pt, CMFCPropertyGridProperty::ClickArea* pnArea = NULL, BOOL bPropsOnly = FALSE) const;
63 virtual void SetAlphabeticMode(BOOL bSet = TRUE);
64 virtual BOOL DeleteProperty(CMFCPropertyGridProperty*& pProp, BOOL bRedraw = TRUE, BOOL bAdjustLayout = TRUE);
65
66 void EnsureVisible(CMFCPropertyGridProperty* pProp, BOOL bExpandParents = FALSE);
67
68 virtual void OnClickButton(CPoint point);
69
70 virtual int GetTotalItemsWithExtraRows(BOOL bIncludeHidden = TRUE) const;
71 DeclareGetClassType();
72
73
74 protected:
75 virtual int OnDrawProperty(CDC* pDC, CMFCPropertyGridProperty* pProp) const override;
76 virtual int OnDrawProperty(CDC* pDC, CGUIPropertyGridPropertyCategory* pPropCat) const;
77 virtual int OnDrawProperty(CDC* pDC, CGUIPropertyGridPropertyRadioButtonGroup* pPropRBG) const;
78 virtual int OnDrawProperty(CDC* pDC, CGUIPropertyGridPropertyRadioButton* pPropRB) const;
79 static void OnDrawComboDropButton(CDC* pDC, CRect rect, BOOL bDisabled, BOOL bDropped, BOOL bHighlighted, CMFCToolBarComboBoxButton* pButton);
80 static void OnDrawButtonBorder(CDC* pDC, CMFCToolBarButton* pButton, CRect rect, CMFCVisualManager::AFX_BUTTON_STATE state);
81 virtual void OnReceiveBroadcast(const Base::CBroadcastMessage* pMessage) override;
82 virtual CList<CMFCPropertyGridProperty*, CMFCPropertyGridProperty*>* GetTopLevelProperties();
83
84 virtual void SetScrollSizes();
85 virtual void ReposProperties();
86
87 private:
88 void RecursivelySetPropertySliderWidth(CMFCPropertyGridProperty* pParent = nullptr);
89
90 protected:
91 CMFCPropertyGridProperty* m_pPropLButtonDown;
92 Base::TPoint<int32_t> m_tpPrev;
93 CGUIPaneProperties* m_pParentPane;
94 CGUIMainFrame* m_pParentMainFrame;
95 CGUIPropertyGridPropertyBase* m_pPropertyPrevHit;
96 CGUIPropertyGridToolTipCtrl* m_pIPToolTip;
97 CGUIScrollBarOwnerDrawn* m_pOwnerDrawScrollBarVert;
98 CGUIScrollBarOwnerDrawn* m_pOwnerDrawScrollBarHorz;
99 std::unordered_map<CMFCPropertyGridProperty*, COleVariant>& m_mapUpdateBuffer;
100
101 CBrush m_brBrush;
102
103 friend class CGUIPropertyGridPropertyDropdownList;
104 friend class CGUIPropertyGridPropertyViewListBase;
105 friend class CGUIMenuItemProperty;
106 friend class CGUIPropertyGridPropertyBase;
107 friend class CGUIPropertyGridPropertyColor;
108 public:
109 DECLARE_MESSAGE_MAP()
110 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
111 afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
112 afx_msg void OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt);
113 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
114 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
115 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
116 afx_msg void OnSetFocus(CWnd* pOldWnd);
117 afx_msg void OnKillFocus(CWnd* pNewWnd);
118 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
119 afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
120 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
121 virtual void PreSubclassWindow();
122 virtual BOOL PreTranslateMessage(MSG* pMsg);
123 afx_msg void OnEnable(BOOL bEnable);
124 afx_msg void OnCancelMode();
125 afx_msg void OnDestroy();
126 virtual void Init()override;
127 virtual void OnDraw(CDC* pDC) override;
128 LRESULT OnScrollBarPosChanged(WPARAM wParam, LPARAM lParam);
129 LRESULT OnSliderOwnerDrawnPosChanged(WPARAM wParam, LPARAM lParam);
130 LRESULT OnSliderOwnerDrawnRedraw(WPARAM wParam, LPARAM lParam);
131 void TrackToolTip(CPoint pt);
132 afx_msg BOOL OnNeedTipText(UINT id, NMHDR* pNMH, LRESULT* pResult);
133 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
134 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
135 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
136 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
137 afx_msg void OnHeaderItemChanged(NMHDR* pNMHDR, LRESULT* pResult);
138 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
139};
140 }
141}