/** * @file XTPPropertyGridItemFont.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(__XTPPROPERTYGRIDITEMFONT_H__) # define __XTPPROPERTYGRIDITEMFONT_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * CXTPPropertyGridItemFont is a CXTPPropertyGridItem derived class. * It is used to create a Font value item in a Property Grid control. */ class _XTP_EXT_CLASS CXTPPropertyGridItemFont : public CXTPPropertyGridItem { public: /** * @brief * Constructs a CXTPPropertyGridItemFont object. * @param strCaption Caption of the item. * @param font Reference to the initial LOGFONT value of the item. */ CXTPPropertyGridItemFont(LPCTSTR strCaption, LOGFONT& font); /** * @brief * Constructs a CXTPPropertyGridItemFont object. * @param nID Identifier of the item. * @param font Reference to the initial LOGFONT value of the item. */ CXTPPropertyGridItemFont(UINT nID, LOGFONT& font); /** * @brief * Destroys a CXTPPropertyGridItemFont object. */ virtual ~CXTPPropertyGridItemFont(); public: /** * @brief * Sets the LOGFONT value for the item. * @param font Reference to the LOGFONT value to be set. */ virtual void SetFont(LOGFONT& font); /** * @brief * Gets the LOGFONT value of the item. * @param lf Pointer to the LOGFONT value to * receive the LOGFONT value of the item. */ virtual void GetFont(LOGFONT* lf); /** * @brief * Sets the COLORREF value for the item. * @param clr COLORREF value to be set. */ virtual void SetColor(COLORREF clr); /** * @brief * Gets the COLORREF value of the item. * @return * The COLORREF value of the item. */ virtual COLORREF GetColor(); protected: /** * @brief * This method is called when the user presses the in-place button. * Override this method to show an item-specific dialog. * @param pButton Pointer to the button that was pressed. * @details * The in-place button is the button that the user presses to * display the font picker dialog. */ virtual void OnInplaceButtonDown(CXTPPropertyGridInplaceButton* pButton); /** * @brief * This method is called when an item is drawn. * Override this method if needed. * @param dc Reference to the device context to be used * for rendering an image of the item. * @param rcValue Bounding rectangle of the item. * @return * TRUE if the item is self-drawn. */ virtual BOOL OnDrawItemValue(CDC& dc, CRect rcValue); /** * @brief * Gets the bounding rectangle of the item value's text. * Override this method to change it. * @return * The bounding rectangle of the item value's text. */ virtual CRect GetValueRect(); /** * @brief * Converts a specified LOGFONT to a string that contains * the name and pt of the font. * @param lfValue LOGFONT to be converted. * @return * The converted string that contains the name and pt of the font. */ virtual CString FontToString(const LOGFONT& lfValue); private: static UINT_PTR CALLBACK FontDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); protected: LOGFONT m_lfValue; /**< LOGFONT value of the item. */ COLORREF m_clrValue; /**< Font color. */ protected: DECLARE_DYNAMIC(CXTPPropertyGridItemFont) # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPPropertyGridItemFont) afx_msg void OleSetValue(const VARIANT* varValue); afx_msg const VARIANT OleGetValue(); BSTR OleGetFaceName(); void OleSetFaceName(LPCTSTR lpszFaceName); int OleGetSize(); void OleSetSize(int nHeigth); int OleGetWeight(); void OleSetWeight(int nWeight); BOOL OleGetBold(); void OleSetBold(BOOL bBold); BOOL OleGetItalic(); void OleSetItalic(BOOL bItalic); BOOL OleGetUnderline(); void OleSetUnderline(BOOL bUnderline); BOOL OleGetStrikeOut(); void OleSetStrikeOut(BOOL bStrikeOut); /** @endcond */ # endif }; ////////////////////////////////////////////////////////////////////// /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // #if !defined(__XTPPROPERTYGRIDITEMFONT_H__) /** @endcond */