FLImaging 7.10.21.1
GUIPropertyGridCtrl.h
1#pragma once
9
10#include <vector>
11#include <unordered_map>
12#include "DefinitionsGUI.h"
13#include "GUIStyledCtrlBase.h"
14
15#define AFX_STRETCH_DELTA 2
16
18namespace FLImaging
19{
21 namespace GUI
22 {
23 class CGUIMainFrame;
24 class CGUIPaneProperties;
27 class CGUIPropertyGridPropertyDropdownList;
28 class CGUIPropertyGridPropertyViewGraphList;
29 class CGUIPropertyGridPropertyViewImageList;
30 class CGUIPropertyGridPropertyView3DList;
31 class CGUIPropertyGridPropertyBase;
32 class CGUIPropertyGridToolTipCtrl;
33 class CGUIPropertyGridPropertyCategory;
34 class CGUIPropertyGridPropertyRadioButtonGroup;
35 class CGUIPropertyGridPropertyRadioButton;
36 class CGUIPropertyGridPropertySliderDualHandle;
37 class CGUIScrollBarOwnerDrawn;
39
52 class FL_EXPORT CGUIPropertyGridCtrl : public CMFCPropertyGridCtrl, public CGUIStyledCtrlBase
53 {
54 friend class CGUIPropertyGridPropertySliderDualHandle;
55 friend class CGUIPropertyGridPropertySlider;
56 friend class CGUIPropertyGridPropertyDraggableSpin;
57 friend class CGUIDialogPropertyImageFigureDrawingAttribute;
58 friend class CGUIPropertyGridPropertyCategory;
59 friend class CGUIPropertyGridPropertyCheckBox;
60 friend class CGUIPropertyGridPropertySheet;
61 public:
74
87
98 virtual void AdjustLayout() override;
99
115
126 virtual void AdjustLayoutAsync();
127
139 void GetPropertyByVisibleOrder(std::vector<CMFCPropertyGridProperty*>& vctProps, CMFCPropertyGridProperty* pParent = nullptr) const;
140
152 virtual void SetParentPane(CGUIPaneProperties* pParentPane);
153
165 virtual CGUIPaneProperties* GetParentPane() const;
166
190 virtual const CResult SetLeftColumnWidth(int32_t i32LeftColumnWidth, ESizeMode eSizeMode = ESizeMode_Fixed);
191
215 virtual const CResult SetLeftColumnWidthRatio(float f32Ratio = 0.5f, ESizeMode eSizeMode = ESizeMode_Ratio);
216
226 virtual float GetLeftColumnWidthRatio() const;
227
248
259
269 virtual COLORREF GetCustomColorBackground() const;
270
280 virtual void SetCustomColorBackground(COLORREF color);
281
291 virtual COLORREF GetCustomColorGridLine() const;
292
302 virtual void SetCustomColorGridLine(COLORREF color);
303
313 virtual COLORREF GetCustomColorGroupText() const;
314
324 virtual void SetCustomColorGroupText(COLORREF color);
325
335 virtual COLORREF GetCustomColorGroupBackground() const;
336
346 virtual void SetCustomColorGroupBackground(COLORREF color);
347
357 virtual COLORREF GetCustomColorGroupSubItemBackground() const;
358
368 virtual void SetCustomColorGroupSubItemBackground(COLORREF color);
369
379 virtual COLORREF GetCustomColorGroupLine() const;
380
390 virtual void SetCustomColorGroupLine(COLORREF color);
391
403 virtual bool IsGridLineVisible() const;
404
414 virtual void ShowGridLine(bool bShow);
426 void SetDescriptionHeight(int32_t i32Height, bool bAdjustLayout = true);
427
443 virtual void HighlightPropertyWithBlink(const CGUIPropertyItemBase* pItem, COLORREF clrHighlight = Foundation::FLLOGOCOLOR, uint32_t u32BlinkCount = 3, uint32_t u32IntervalMs = 200);
444
462 virtual void HighlightPropertyWithBlink(const CGUIPropertyItemBase* pItem1, const CGUIPropertyItemBase* pItem2, COLORREF clrHighlight = Foundation::FLLOGOCOLOR, uint32_t u32BlinkCount = 3, uint32_t u32IntervalMs = 200);
463
479 virtual void HighlightPropertyWithBlink(const std::vector<const CGUIPropertyItemBase*>& vctItems, COLORREF clrHighlight = Foundation::FLLOGOCOLOR, uint32_t u32BlinkCount = 3, uint32_t u32IntervalMs = 200);
480
481 virtual const CResult InsertItem(CGUIPropertyItemBase* pItem, const CGUIPropertyItemBase* pItemNewParent, EAppendPosition eAppendPosition, bool bAdjustLayout, bool bAutoLoad);
482 virtual const CResult InsertItem(CGUIPropertyItemBase* pItem, EInsertPosition eInsertPosition, const CGUIPropertyItemBase* pItemInsertPosition, bool bAdjustLayout, bool bAutoLoad);
483 virtual const CResult RemoveItem(CGUIPropertyItemBase* pItem, bool bDeletePropertyGridProperty, bool bAdjustLayout);
484
485 virtual const CResult PreDeleteProperty(CMFCPropertyGridProperty* pProperty);
486
487 DeclareGetClassType();
488
489 public:
490 virtual CMFCPropertyGridProperty* HitTest(CPoint pt, CMFCPropertyGridProperty::ClickArea* pnArea = NULL, BOOL bPropsOnly = FALSE) const;
491 // bDelete == TRUE일 경우 DeleteProperty() 호출하고 종료
492 virtual BOOL RemoveProperty(CMFCPropertyGridProperty*& pProp, BOOL bDelete, BOOL bRedraw, BOOL bAdjustLayout);
493
494 void EnsureVisible(CMFCPropertyGridProperty* pProp, BOOL bExpandParents = FALSE);
495 virtual void SetAlphabeticMode(BOOL bSet = TRUE);
496
497 virtual void SetParentMainFrame(CGUIMainFrame* pMainFrame);
498 virtual CGUIMainFrame* GetParentMainFrame() const;
499
500 virtual const CGUIScrollBarOwnerDrawn* GetOwnerDrawScrollBar(EOrientation eOrientation = EOrientation_Vertical) const;
501 virtual int GetTotalItemsWithExtraRows(BOOL bIncludeHidden = TRUE) const;
502
503 void SetFontBold(HFONT hfont);
504 void SetFont(HFONT hfont);
505 virtual CFont* GetFontBold();
506
507 virtual void SetManagerPropertyItem(CGUIManagerPropertyItem* pMgr);
508 virtual const CGUIManagerPropertyItem* GetManagerPropertyItem() const;
509
510 protected:
511 virtual void AddPendingUpdateValue(const CMFCPropertyGridProperty* pPGP, const COleVariant& var);
512 virtual void AddPendingUpdateValueMin(const CGUIPropertyGridPropertySliderDualHandle* pPGP, const COleVariant& var);
513 virtual void AddPendingUpdateValueMax(const CGUIPropertyGridPropertySliderDualHandle* pPGP, const COleVariant& var);
514 virtual const CResult GetPendingUpdateValue(const CMFCPropertyGridProperty* pPGP, COleVariant& varRes) const;
515 virtual const CResult GetPendingUpdateValueMin(const CGUIPropertyGridPropertySliderDualHandle* pPGP, COleVariant& varRes) const;
516 virtual const CResult GetPendingUpdateValueMax(const CGUIPropertyGridPropertySliderDualHandle* pPGP, COleVariant& varRes) const;
517 virtual void AddPendingUpdateVisibility(const CMFCPropertyGridProperty* pPGP, bool bVisibility);
518 virtual const CResult GetPendingUpdateVisibility(const CMFCPropertyGridProperty* pPGP, bool& bVisibility) const;
519
520 virtual void OnDrawList(CDC* pDC) override;
521 virtual void DrawPropertyDefault(CDC* pDC, CGUIPropertyGridPropertyBase* pPgp) const;
522 virtual void DrawRadioButtonGroupBox(CDC* pDC, CGUIPropertyGridPropertyRadioButtonGroup* pPropRGB) const;
523 virtual int OnDrawProperty(CDC* pDC, CMFCPropertyGridProperty* pProp) const override;
524 virtual int OnDrawProperty(CDC* pDC, CGUIPropertyGridPropertyCategory* pPropCat) const;
525 static void OnDrawComboDropButton(CDC* pDC, CRect rect, BOOL bDisabled, BOOL bDropped, BOOL bHighlighted, CMFCToolBarComboBoxButton* pButton);
526 static void OnDrawButtonBorder(CDC* pDC, CMFCToolBarButton* pButton, CRect rect, CMFCVisualManager::AFX_BUTTON_STATE state);
527 virtual void OnReceiveBroadcast(const Base::CBroadcastMessage* pMessage) override;
528 virtual CList<CMFCPropertyGridProperty*, CMFCPropertyGridProperty*>* GetTopLevelProperties();
529 virtual BOOL EndEditItem(BOOL bUpdateData = TRUE) override;
530
531 virtual void UpdateColorByState(EGUIControlState eState);
532 virtual void SetScrollSizes();
533 virtual void ReposProperties();
534 virtual Base::TRect<int32_t> GetRowMargin() const;
535 virtual void SetContentPadding(const Base::TRect<int32_t>& trPadding);
536 virtual Base::TRect<int32_t> GetCategoryMargin() const;
537 virtual Base::TRect<int32_t> GetContentPadding() const;
538 virtual Base::TRect<int32_t> GetTextPadding(EControlTextType e) const;
539
540 CGUIPropertyGridPropertyBase* GetSearchHitProperty() const;
541
542 private:
543 void RecursivelySetPropertySliderWidth(CMFCPropertyGridProperty* pParent = nullptr);
544
545 protected:
563 void AddVisibleRows(CGUIPropertyGridPropertyBase* pProp, std::vector<CGUIPropertyGridPropertyBase*>& vctPPgpItems);
564
580 void GetVisibleRows(std::vector<CGUIPropertyGridPropertyBase*>& vctPPgpItems);
581
597 bool IsRowFullyVisible(const CGUIPropertyGridPropertyBase* pProp) const;
598
612 int32_t GetPageRowCount() const;
613
631 void SetTopRow(const std::vector<CGUIPropertyGridPropertyBase*>& vctPPgpItems, int32_t i32Top);
632
652 void InternalEnsureVisible(const std::vector<CGUIPropertyGridPropertyBase*>& vctPPgpItems);
653 bool IsDrodownList(const CMFCPropertyGridProperty* pPgp) const;
654
655 protected:
656 CMFCPropertyGridProperty* m_pPropLButtonDown;
657 Base::TPoint<int32_t> m_tpPrev;
658 CGUIPaneProperties* m_pParentPane;
659 CGUIMainFrame* m_pParentMainFrame;
660 CGUIPropertyGridPropertyBase* m_pPropertyPrevHit;
661 CGUIPropertyGridToolTipCtrl* m_pIPToolTip;
662 CGUIScrollBarOwnerDrawn* m_pOwnerDrawScrollBarVert;
663 CGUIScrollBarOwnerDrawn* m_pOwnerDrawScrollBarHorz;
664 std::unordered_map<CMFCPropertyGridProperty*, COleVariant>& m_mapPendingValue;
665 std::unordered_map<CGUIPropertyGridPropertySliderDualHandle*, COleVariant>& m_mapPendingValueMin;
666 std::unordered_map<CGUIPropertyGridPropertySliderDualHandle*, COleVariant>& m_mapPendingValueMax;
667 std::unordered_map<CMFCPropertyGridProperty*, bool>& m_mapPendingVisibility;
668
669 ESizeMode m_eLeftColWidthSizeMode;
670 float m_f32LeftColWidthRatio;
671 int32_t m_i32LeftColWidth;
672
673 std::vector<CGUIPropertyGridPropertyBase*>& m_vctPPgpBlink;
674 COLORREF m_clrHighlight;
675 uint32_t m_u32NeedToBlinkCnt;
676 uint32_t m_u32CurrBlinkCnt;
677
678 bool m_bPropertySliderDeprecatedExists;
679
680 CGUIStyledCtrlBase m_scbCategory; // default draw options for category item
681 CGUIStyledCtrlBase m_scbRadioBtnGroup; // default draw options for radio button group item
682 CGUIStyledCtrlBase m_scbPropBase; // default draw options for PGPBase
683
684 CGUIManagerPropertyItem* m_pMgrRef;
685
686 CBrush m_brBrush;
687
688 friend class CGUIManagerPane;
689 friend class CGUIPaneProperties;
690 friend class CGUIMenuItemProperty;
691 friend class CGUIPropertyGridPropertyDropdownList;
692 friend class CGUIPropertyGridPropertyViewListBase;
693 friend class CGUIPropertyGridPropertyBase;
694 friend class CGUIPropertyGridPropertyColor;
695 friend class CGUIPropertyItemRadioButton;
696 friend class CGUIPropertyItemSliderDualHandle;
697 friend class CGUIPropertyItemCheckBox;
698 friend class CGUIPropertyItemCategory;
699 friend class CGUIPropertyItemText;
700 friend class CGUIPropertyItemFont;
701 friend class CGUIPropertyItemBase;
702 friend class CGUIPropertyItemRadioButtonGroup;
703 friend class CGUIPropertyGridPropertyRadioButtonGroup;
704 friend class CGUIPropertyItemCheckBox3State;
705 friend class CGUIDialogProperty;
706 friend class CGUIDialogLicenseFeatures;
707 friend class CGUIManagerPropertyItem;
708
709 public:
710 DECLARE_MESSAGE_MAP()
711 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
712 afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
713 afx_msg void OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt);
714 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
715 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
716 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
717 afx_msg void OnSetFocus(CWnd* pOldWnd);
718 afx_msg void OnKillFocus(CWnd* pNewWnd);
719 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
720 afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
721 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
722 virtual void PreSubclassWindow();
723 virtual BOOL PreTranslateMessage(MSG* pMsg);
724 afx_msg void OnEnable(BOOL bEnable);
725 afx_msg void OnCancelMode();
726 afx_msg void OnDestroy();
727 LRESULT OnScrollBarPosChanged(WPARAM wParam, LPARAM lParam);
728 LRESULT OnSliderOwnerDrawnPosChanged(WPARAM wParam, LPARAM lParam);
729 LRESULT OnSliderOwnerDrawnRedraw(WPARAM wParam, LPARAM lParam);
730 afx_msg BOOL OnNeedTipText(UINT id, NMHDR* pNMH, LRESULT* pResult);
731 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
732 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
733 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
734 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
735 afx_msg void OnHeaderItemChanged(NMHDR* pNMHDR, LRESULT* pResult);
736 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
737 afx_msg void OnSize(UINT nType, int cx, int cy);
738 afx_msg void OnTimer(UINT_PTR nIDEvent);
739 afx_msg void OnNMSheetCellChanged(NMHDR* pNMHDR, LRESULT* pResult);
740
741 void TrackToolTip(CPoint pt);
742 virtual void Init() override;
743 virtual void OnDraw(CDC* pDC) override;
744 virtual void OnClickButton(CPoint point) override;
745};
746 }
747}
Broadcast message class.
Definition FLImagingBase/BroadcastMessage.h:27
Simplified class representing a point.
Definition FLImagingBase/TPoint.h:37
Simplified class representing a rectangle.
Definition FLImagingBase/TRect.h:37
FLImaging module execution result object.
Definition FLImagingBase/ResultsDef.h:1712
Manager class responsible for handling CGUIPropertyItemBase objects and synchronizing them with CGUIP...
Definition GUIManagerPropertyItem.h:46
The menu item class associated with the property pane.
Definition GUIMenuItemProperty.h:48
virtual void SetCustomColorGroupBackground(COLORREF color)
Set custom color for group background.
virtual CGUIPaneProperties * GetParentPane() const
Get parent pane.
void AddVisibleRows(CGUIPropertyGridPropertyBase *pProp, std::vector< CGUIPropertyGridPropertyBase * > &vctPPgpItems)
Recursively appends pProp and its currently displayed descendants to vctPPgpItems....
virtual void SetCustomColorGridLine(COLORREF color)
Set custom color for grid lines.
virtual const CResult SetLeftColumnWidthRatio(float f32Ratio=0.5f, ESizeMode eSizeMode=ESizeMode_Ratio)
Sets the width of the left column using a ratio.
virtual COLORREF GetCustomColorGridLine() const
Get custom color for grid lines.
virtual COLORREF GetCustomColorGroupSubItemBackground() const
Get custom color for group sub item background.
virtual void HighlightPropertyWithBlink(const CGUIPropertyItemBase *pItem, COLORREF clrHighlight=Foundation::FLLOGOCOLOR, uint32_t u32BlinkCount=3, uint32_t u32IntervalMs=200)
Highlights a property item with a blinking effect.
virtual bool IsGridLineVisible() const
Check whether the grid lines are visible.
virtual COLORREF GetCustomColorGroupText() const
Get custom color for group text.
virtual COLORREF GetCustomColorGroupLine() const
Get custom color for group line.
virtual void SetCustomColorGroupSubItemBackground(COLORREF color)
Set custom color for group sub item background.
virtual void SetParentPane(CGUIPaneProperties *pParentPane)
Set parent pane.
virtual void OnReceiveBroadcast(const Base::CBroadcastMessage *pMessage) override
Callback function. A function that receives a BroadcastMessage.
virtual void HighlightPropertyWithBlink(const std::vector< const CGUIPropertyItemBase * > &vctItems, COLORREF clrHighlight=Foundation::FLLOGOCOLOR, uint32_t u32BlinkCount=3, uint32_t u32IntervalMs=200)
Highlights multiple property items with a blinking effect.
virtual void AdjustLayoutAsync()
Adjusts the control's layout.(Asynchronous function) This function should be called only when there a...
virtual const CResult SetLeftColumnWidthSizeMode(ESizeMode eSizeMode=ESizeMode_Ratio)
Sets the size mode for the left column width.
virtual float GetLeftColumnWidthRatio() const
Gets the ratio used for the left column width.
virtual bool AdjustLayoutForVisibility()
Used to adjust the control's layout after calling CGUIPropertyItemBase::SetVisible()....
virtual void AdjustLayout() override
Adjusts the control's layout. This function should be called only when there are layout changes,...
virtual void HighlightPropertyWithBlink(const CGUIPropertyItemBase *pItem1, const CGUIPropertyItemBase *pItem2, COLORREF clrHighlight=Foundation::FLLOGOCOLOR, uint32_t u32BlinkCount=3, uint32_t u32IntervalMs=200)
Highlights two property items with a blinking effect.
int32_t GetPageRowCount() const
Returns the number of rows that fit in the visible list area at once.
virtual ESizeMode GetLeftColumnWidthSizeMode() const
Gets the size mode of the left column width.
virtual COLORREF GetCustomColorBackground() const
Get custom color for background.
virtual COLORREF GetCustomColorGroupBackground() const
Get custom color for group background.
virtual ~CGUIPropertyGridCtrl()
Destructor for the property grid control.
void InternalEnsureVisible(const std::vector< CGUIPropertyGridPropertyBase * > &vctPPgpItems)
Expands all ancestors of vctPPgpItems and scrolls the grid to bring them into view....
bool IsRowFullyVisible(const CGUIPropertyGridPropertyBase *pProp) const
Tests whether the row of pProp is entirely inside the visible list area.
virtual void ShowGridLine(bool bShow)
Set whether to display grid lines.
virtual void SetCustomColorGroupLine(COLORREF color)
Set custom color for group line.
virtual void SetCustomColorBackground(COLORREF color)
Set custom color for background.
CGUIPropertyGridCtrl()
Default constructor for the property grid control.
void SetTopRow(const std::vector< CGUIPropertyGridPropertyBase * > &vctPPgpItems, int32_t i32Top)
Scrolls the grid so that the row at index i32Top becomes the topmost visible row.
void GetVisibleRows(std::vector< CGUIPropertyGridPropertyBase * > &vctPPgpItems)
Builds the flattened list of every row currently displayed in the grid, ordered from top to bottom....
void GetPropertyByVisibleOrder(std::vector< CMFCPropertyGridProperty * > &vctProps, CMFCPropertyGridProperty *pParent=nullptr) const
Get properties by their visible order.
virtual const CResult SetLeftColumnWidth(int32_t i32LeftColumnWidth, ESizeMode eSizeMode=ESizeMode_Fixed)
Sets the width of the left column (name area).
virtual void SetCustomColorGroupText(COLORREF color)
Set custom color for group text.
void SetDescriptionHeight(int32_t i32Height, bool bAdjustLayout=true)
Sets the height of the description area.
Property item base class.
Definition GUIPropertyItemBase.h:319
Definition D2DObject.h:12
EInsertPosition
Definition FLImagingGUI/DefinitionsGUI.h:15514
ESizeMode
Specifies how a UI element's size is determined.
Definition FLImagingGUI/DefinitionsGUI.h:16476
@ ESizeMode_Ratio
Ratio-based size.
Definition FLImagingGUI/DefinitionsGUI.h:16508
@ ESizeMode_Fixed
Fixed size (e.g., pixel-based).
Definition FLImagingGUI/DefinitionsGUI.h:16497
EOrientation
Direction.
Definition FLImagingGUI/DefinitionsGUI.h:9905
@ EOrientation_Vertical
a vertical direction
Definition FLImagingGUI/DefinitionsGUI.h:9912
EAppendPosition
Definition FLImagingGUI/DefinitionsGUI.h:15534
EGUIControlState
Enumeration for GUI control states.
Definition FLImagingGUI/DefinitionsGUI.h:16318