/** * @file XTPMarkupTreeCtrl.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(__MARKUPTREECTRL_H__) && defined(_XTP_INCLUDE_MARKUP) # define __MARKUPTREECTRL_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * Tree control class that allows for adding markup items. */ class _XTP_EXT_CLASS CXTPMarkupTreeCtrl : public CXTPTreeCtrl , public CXTPMarkupContext { public: /** * @brief * Constructs a markup tree control. */ CXTPMarkupTreeCtrl(); /** * @brief * Handles markup tree control deallocation. */ virtual ~CXTPMarkupTreeCtrl(); public: /** * @brief * Obtains the markup context associated with the markup tree. * * @return A pointer to the markup context associated with the markup tree. */ CXTPMarkupContext* GetMarkupContext(); /** * @brief * Adds a new markup item. * @param lpszItem Pointer to a NULL-terminated string that contains * either plain item text or markup text to display. * @param nImage Zero-based normal image index. * @param nSelectedImage Zero-based selected image index. * @param hParent Parent item handle. * @param hInsertAfter Item handle to insert a new item after. * @return * A newly inserted item handle if successful, otherwise NULL. */ HTREEITEM AddItem(LPCTSTR lpszItem, int nImage, int nSelectedImage, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST); //{{AFX_VIRTUAL(CXTPMarkupTreeCtrl) virtual void PreSubclassWindow(); virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult); using CXTPMarkupContext::OnWndMsg; //}}AFX_VIRTUAL protected: /** * @brief * Draws a markup item. * @param lpLVCD Pointer to a NMTVCUSTOMDRAW structure. */ void DrawMarkupItem(NMTVCUSTOMDRAW* lpLVCD); /** * @brief * Obtains plain markup item text, i.e. text without markup elements. * @param pUIElement Pointer to a markup element for which to obtain plain text. * @return * Plain markup item text. */ CString GetPlainMarkupItemText(CXTPMarkupUIElement* pUIElement) const; /** * @brief * Obtains item text extent. Takes into account control's font. * @param pDC Control's device context pointer. * @param lpszText Pointer to NULL-terminated string for which to compute size * information. * @param nCount Number of characters in the string pointed to by lpszText. * @return * Size of text in device units. */ CSize GetItemTextExtent(CDC* pDC, LPCTSTR lpszText, int nCount) const; /** * @brief * Performs item hit test. * @param point Point in client coordinates where to perform hit test. * @return * Item handle located at the specified point, or NULL if no item is found. */ HTREEITEM HitTestMarkupItem(CPoint point); /** @cond */ //{{AFX_MSG(CXTPMarkupTreeCtrl) afx_msg void OnDeleteItem(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnGetInfoTip(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnGetDispInfo(NMHDR* pNMHDR, LRESULT* pResult); afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult); 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 int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnPaint(); //}}AFX_MSG DECLARE_MESSAGE_MAP() /** @endcond */ protected: CXTPToolTipContext::CMarkupToolTip* m_pToolTip; mutable CXTPFont m_xtpFontDefaultGui; XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fntDefaultGui, m_xtpFontDefaultGui, GetDefaultGuiFontHandle); }; /** @cond */ AFX_INLINE CXTPMarkupContext* CXTPMarkupTreeCtrl::GetMarkupContext() { return this; } /** @endcond */ ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__MARKUPTREECTRL_H__) /** @endcond */