/** * @file XTPPropertyGridView.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPPROPERTYGRIDVIEW_H__) # define __XTPPROPERTYGRIDVIEW_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPPropertyGridView; class CXTPPropertyGridPaintManager; class CXTPPropertyGrid; class CXTPImageManager; /** @cond */ class CXTPScrollablePropertyGridListBox; /** @endcond */ /** * @brief * CXTPPropertyGridView is a CListBox derived class. * It is an internal class used by the property grid control. */ class _XTP_EXT_CLASS CXTPPropertyGridView : public CListBox , public CXTPAccessible { /** @cond */ struct WNDRECT; DECLARE_DYNAMIC(CXTPPropertyGridView) /** @endcond */ public: /** * @brief * Constructs a CXTPPropertyGridView object. */ CXTPPropertyGridView(); /** * @brief * Destroys a CXTPPropertyGridView object, handles cleanup and * deallocation. */ virtual ~CXTPPropertyGridView(); public: /** * @brief * Gets the position of the divider. * @return * The position of the divider. */ int GetDividerPos() const; /** * @brief * Sets the position for the divider. * @param nDivider Position for the divider. */ void SetDividerPos(int nDivider); /** * @brief * Disables auto-calculation for the position of the divider. */ void LockDivider(); /** * @brief * Determines which item, if any, is located at a specified point. * @param point Point to be tested. * @return * A pointer to the CXTPPropertyGridItem object at * the specified point, if any, otherwise NULL. */ CXTPPropertyGridItem* ItemFromPoint(CPoint point) const; /** * @brief * Refreshes the items in the list. */ void Refresh(); /** * @brief * Removes all items from the list. */ void ResetContent(); /** * @brief * Retrieves the item at a specified index in the list. * @param nIndex Zero-based index of the item to retrieve. * @return * A pointer to the item at the specified index in the list. */ CXTPPropertyGridItem* GetItem(int nIndex) const; /** * @brief * Adds a new category to the property grid control. * @param strCaption Name of the category to be added. * @param pCategory Allows for custom classses to be categories. If it is NULL, then * the property grid creates a default CXTPPropertyGridItem as a * category. If it is not NULL, then the specified item will be used. * @return * A pointer to the CXTPPropertyGridItem object of the newly added category. */ CXTPPropertyGridItem* AddCategory(LPCTSTR strCaption, CXTPPropertyGridItem* pCategory = NULL); /** * @brief * Inserts a new category to the property grid control. * @param strCaption Name of the category to be inserted. * @param nIndex Index of the category to be inserted. * @param pCategory Allows for custom classses to be categories. If it is NULL, then * the property grid creates a default CXTPPropertyGridItem as a * category. If it is not NULL, then the specified item will be used. * @return * A pointer to the CXTPPropertyGridItem object of the newly inserted category. */ CXTPPropertyGridItem* InsertCategory(int nIndex, LPCTSTR strCaption, CXTPPropertyGridItem* pCategory = NULL); /** * @brief * Gets the paint manager associated with the property grid * (i.e. the paint manager used to draw the property grid control window). * @return * A pointer to the paint manager associated with the property grid. */ CXTPPropertyGridPaintManager* GetPaintManager() const; /** * @brief * Gets the image manager associated with the property grid * (i.e. the image manager that stores images in the property grid). * @return * A pointer to the image manager associated with the property grid. */ CXTPImageManager* GetImageManager() const; /** * @brief * Sends a specified message to the owner window. * @param wParam Specifies additional message-dependent information. * @param lParam Specifies additional message-dependent information. * @return * The result of the message processing; this value depends on the message sent. */ LRESULT SendNotifyMessage(WPARAM wParam = 0, LPARAM lParam = 0); /** * @brief * Gets the parent property grid. * @return * A pointer to the parent property grid. */ CXTPPropertyGrid* GetPropertyGrid() const; /** * @brief * Moves focus to a specified in-place button. * @param pButton Pointer to a CXTPPropertyGridInplaceButton object. */ void FocusInplaceButton(CXTPPropertyGridInplaceButton* pButton); protected: /** * @brief * Shows the tooltip of the item located at the mouse position. * @param pt Mouse position. */ virtual void ShowToolTip(CPoint pt); protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPPropertyGridView) virtual void DrawItem(LPDRAWITEMSTRUCT); virtual void MeasureItem(LPMEASUREITEMSTRUCT); virtual int CompareItem(LPCOMPAREITEMSTRUCT) { return 0; } virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult); virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const; //}}AFX_VIRTUAL //{{AFX_MSG(CXTPPropertyGridView) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnPaint(); afx_msg void OnNcPaint(); afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnRButtonUp(UINT nFlags, CPoint point); afx_msg void OnSelectionChanged(); afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnCaptureChanged(CWnd* pWnd); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnChar(UINT nChar, UINT nRepCntr, UINT nFlags); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg UINT OnGetDlgCode(); afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); afx_msg void OnSetFocus(CWnd* pOldWnd); afx_msg void OnKillFocus(CWnd* pNewWnd); afx_msg LRESULT OnGetObject(WPARAM wParam, LPARAM lParam); //}}AFX_MSG /** @endcond */ protected: /** @cond */ // System accessibility support. virtual HRESULT GetAccessibleParent(IDispatch** ppdispParent); virtual HRESULT GetAccessibleChildCount(long* pcountChildren); virtual HRESULT GetAccessibleChild(VARIANT varChild, IDispatch** ppdispChild); virtual HRESULT GetAccessibleName(VARIANT varChild, BSTR* pszName); virtual HRESULT GetAccessibleRole(VARIANT varChild, VARIANT* pvarRole); virtual HRESULT AccessibleLocation(long* pxLeft, long* pyTop, long* pcxWidth, long* pcyHeight, VARIANT varChild); virtual HRESULT AccessibleHitTest(long xLeft, long yTop, VARIANT* pvarChild); virtual HRESULT GetAccessibleState(VARIANT varChild, VARIANT* pvarState); virtual CCmdTarget* GetAccessible(); DECLARE_INTERFACE_MAP() XTP_DECLARE_CMDTARGETPROVIDER_INTERFACE() /** @endcond */ private: CXTPPropertyGridItem* GetSelectedItem(); void SetPropertySort(XTPPropertyGridSortOrder sort, BOOL bRrefresh = FALSE, BOOL bSetRedraw = TRUE); int InsertItem(CXTPPropertyGridItem* pItem, int nIndex); int _DoExpand(CXTPPropertyGridItem* pItem, int nIndex); void _DoCollapse(CXTPPropertyGridItem* pItem); void _RefreshIndexes(); void SwitchExpandState(int nItem); int HitTest(CPoint point) const; void _ShowToolTip(CRect rcBound, CRect rcText, CXTPPropertyGridItem* pItem, BOOL bValuePart); CSize _GetTextExtent(const CString& str, CXTPPropertyGridItem* pItem, BOOL bValuePart); void RelayToolTipEvent(UINT message); LRESULT OnScrollControl(); CPoint ViewToGrid(CPoint point); protected: CXTPPropertyGrid* m_pGrid; /**< Parent CXTPPropertyGrid class. */ BOOL m_bTracking; /**< TRUE if the grid in tracking mode. */ CRect m_rcToolTip; /**< Position of the tooltip. */ double m_dDivider; /**< Divider position. */ BOOL m_bAutoDivider; /**< TRUE to auto-calculate the position of the divider. */ HCURSOR m_hCursor; /**< Handle of the cursor. */ CString m_strTipText; /**< Tooltip text. */ XTPPropertyGridSortOrder m_properetySort; /**< Current sort order. */ CXTPPropertyGridItem* m_pSelected; /**< Current selected item. */ CXTPPropertyGridItems* m_pCategories; /**< Collection of the categories. */ CXTPPropertyGridToolTip m_wndTip; /**< Tooltip control. */ int m_nLockUpdate; /**< TRUE to lock update. */ UINT m_nItemHeight; /**< Default height of the item. */ BOOL m_bVariableSplitterPos; /**< TRUE to allow the user to resize the splitter with the mouse. */ CXTPPropertyGridInplaceButton* m_pFocusedButton; /**< Currently focused button. */ CXTPPropertyGridInplaceButton* m_pHotButton; /**< Currently highlighted button. */ private: friend class CXTPPropertyGridItem; friend class CXTPPropertyGridItems; friend class CXTPPropertyGrid; friend class CXTPPropertyGridInplaceEdit; friend class CPropertyGridCtrl; friend class CXTPPropertyGridToolTip; friend class CXTPPropertyGridInplaceButton; friend class CXTPPropertyGridInplaceButtons; friend class CXTPScrollablePropertyGridListBox; }; AFX_INLINE CXTPPropertyGrid* CXTPPropertyGridView::GetPropertyGrid() const { return m_pGrid; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // #if !defined(__XTPPROPERTYGRIDVIEW_H__) /** @endcond */