FLImaging 7.8.25.3
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 private:
541 void RecursivelySetPropertySliderWidth(CMFCPropertyGridProperty* pParent = nullptr);
542
543 protected:
561 void AddVisibleRows(CGUIPropertyGridPropertyBase* pProp, std::vector<CGUIPropertyGridPropertyBase*>& vctPPgpItems);
562
578 void GetVisibleRows(std::vector<CGUIPropertyGridPropertyBase*>& vctPPgpItems);
579
595 bool IsRowFullyVisible(const CGUIPropertyGridPropertyBase* pProp) const;
596
610 int32_t GetPageRowCount() const;
611
629 void SetTopRow(const std::vector<CGUIPropertyGridPropertyBase*>& vctPPgpItems, int32_t i32Top);
630
650 void InternalEnsureVisible(const std::vector<CGUIPropertyGridPropertyBase*>& vctPPgpItems);
651
652 protected:
653 CMFCPropertyGridProperty* m_pPropLButtonDown;
654 Base::TPoint<int32_t> m_tpPrev;
655 CGUIPaneProperties* m_pParentPane;
656 CGUIMainFrame* m_pParentMainFrame;
657 CGUIPropertyGridPropertyBase* m_pPropertyPrevHit;
658 CGUIPropertyGridToolTipCtrl* m_pIPToolTip;
659 CGUIScrollBarOwnerDrawn* m_pOwnerDrawScrollBarVert;
660 CGUIScrollBarOwnerDrawn* m_pOwnerDrawScrollBarHorz;
661 std::unordered_map<CMFCPropertyGridProperty*, COleVariant>& m_mapPendingValue;
662 std::unordered_map<CGUIPropertyGridPropertySliderDualHandle*, COleVariant>& m_mapPendingValueMin;
663 std::unordered_map<CGUIPropertyGridPropertySliderDualHandle*, COleVariant>& m_mapPendingValueMax;
664 std::unordered_map<CMFCPropertyGridProperty*, bool>& m_mapPendingVisibility;
665
666 ESizeMode m_eLeftColWidthSizeMode;
667 float m_f32LeftColWidthRatio;
668 int32_t m_i32LeftColWidth;
669
670 std::vector<CGUIPropertyGridPropertyBase*>& m_vctPPgpBlink;
671 COLORREF m_clrHighlight;
672 uint32_t m_u32NeedToBlinkCnt;
673 uint32_t m_u32CurrBlinkCnt;
674
675 bool m_bPropertySliderDeprecatedExists;
676
677 CGUIStyledCtrlBase m_scbCategory; // default draw options for category item
678 CGUIStyledCtrlBase m_scbRadioBtnGroup; // default draw options for radio button group item
679 CGUIStyledCtrlBase m_scbPropBase; // default draw options for PGPBase
680
681 CGUIManagerPropertyItem* m_pMgrRef;
682
683 CBrush m_brBrush;
684
685 friend class CGUIManagerPane;
686 friend class CGUIPaneProperties;
687 friend class CGUIMenuItemProperty;
688 friend class CGUIPropertyGridPropertyDropdownList;
689 friend class CGUIPropertyGridPropertyViewListBase;
690 friend class CGUIPropertyGridPropertyBase;
691 friend class CGUIPropertyGridPropertyColor;
692 friend class CGUIPropertyItemRadioButton;
693 friend class CGUIPropertyItemSliderDualHandle;
694 friend class CGUIPropertyItemCheckBox;
695 friend class CGUIPropertyItemCategory;
696 friend class CGUIPropertyItemText;
697 friend class CGUIPropertyItemFont;
698 friend class CGUIPropertyItemBase;
699 friend class CGUIPropertyItemRadioButtonGroup;
700 friend class CGUIPropertyGridPropertyRadioButtonGroup;
701 friend class CGUIPropertyItemCheckBox3State;
702 friend class CGUIDialogProperty;
703 friend class CGUIDialogLicenseFeatures;
704 friend class CGUIManagerPropertyItem;
705
706 public:
707 DECLARE_MESSAGE_MAP()
708 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
709 afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
710 afx_msg void OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt);
711 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
712 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
713 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
714 afx_msg void OnSetFocus(CWnd* pOldWnd);
715 afx_msg void OnKillFocus(CWnd* pNewWnd);
716 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
717 afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
718 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
719 virtual void PreSubclassWindow();
720 virtual BOOL PreTranslateMessage(MSG* pMsg);
721 afx_msg void OnEnable(BOOL bEnable);
722 afx_msg void OnCancelMode();
723 afx_msg void OnDestroy();
724 LRESULT OnScrollBarPosChanged(WPARAM wParam, LPARAM lParam);
725 LRESULT OnSliderOwnerDrawnPosChanged(WPARAM wParam, LPARAM lParam);
726 LRESULT OnSliderOwnerDrawnRedraw(WPARAM wParam, LPARAM lParam);
727 afx_msg BOOL OnNeedTipText(UINT id, NMHDR* pNMH, LRESULT* pResult);
728 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
729 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
730 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
731 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
732 afx_msg void OnHeaderItemChanged(NMHDR* pNMHDR, LRESULT* pResult);
733 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
734 afx_msg void OnSize(UINT nType, int cx, int cy);
735 afx_msg void OnTimer(UINT_PTR nIDEvent);
736 afx_msg void OnNMSheetCellChanged(NMHDR* pNMHDR, LRESULT* pResult);
737
738 void TrackToolTip(CPoint pt);
739 virtual void Init() override;
740 virtual void OnDraw(CDC* pDC) override;
741 virtual void OnClickButton(CPoint point) override;
742};
743 }
744}
Broadcast message class.
Definition BroadcastMessage.h:27
Simplified class representing a point.
Definition TPoint.h:37
Simplified class representing a rectangle.
Definition TRect.h:37
FLImaging module execution result object.
Definition ResultsDef.h:1704
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 DefinitionsGUI.h:15460
ESizeMode
Specifies how a UI element's size is determined.
Definition DefinitionsGUI.h:16422
@ ESizeMode_Ratio
Ratio-based size.
Definition DefinitionsGUI.h:16454
@ ESizeMode_Fixed
Fixed size (e.g., pixel-based).
Definition DefinitionsGUI.h:16443
EOrientation
Direction.
Definition DefinitionsGUI.h:9901
@ EOrientation_Vertical
a vertical direction
Definition DefinitionsGUI.h:9908
EAppendPosition
Definition DefinitionsGUI.h:15480
EGUIControlState
Enumeration for GUI control states.
Definition DefinitionsGUI.h:16264