/** * @file XTPComboBoxTheme.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(__XTPCOMBOBOXTHEME_H__) # define __XTPCOMBOBOXTHEME_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPWinThemeWrapper; class CXTPComboBox; /** * @brief * CXTPComboBoxTheme is a class used to perform ComboBox Theme * drawing tasks. This is the base class for all combobox themes. */ class _XTP_EXT_CLASS CXTPComboBoxTheme : public CXTPControlTheme { public: /** * @brief * Default constructor. */ CXTPComboBoxTheme(); /** * @brief * Destructor handles cleanup and deallocation. */ virtual ~CXTPComboBoxTheme(); /** * @brief * Called by the combobox to fill a rectangle using the brush * specifed by hBrush. * @param hdc Handle to a valid device context. * @param x Left side of the rectangle to draw. * @param y Top side of the rectangle to draw. * @param cx Width of the rectangle to draw. * @param cy Height of the rectangle to draw. * @param hBrush Handle to a HBRUSH object representing the background * fill color. */ virtual void FillSolidRect(HDC hdc, int x, int y, int cx, int cy, HBRUSH hBrush); /** * @brief * Called by the combobox to draw a frame rectangle using the brush * specified by hBrush. * @param hdc Handle to a valid device context. * @param lprc Pointer to a RECT structure representing the size of * rectangle to draw. * @param nSize Width in pixels of the rectangle borders. * @param hBrush Handle to a HBRUSH object representing the border * fill color. */ virtual void DrawFrame(HDC hdc, LPRECT lprc, int nSize, HBRUSH hBrush); /** * @brief * Called by the framework to draw the combobox control. * @param pDC Pointer to a valid device context. * @param pComboBox Pointer to the CXTPComboBox object to be drawn. * @return TRUE if successful; otherwise FALSE. */ virtual BOOL DrawComboBox(CDC* pDC, CXTPComboBox* pComboBox); /** * @brief * This member function is called to draw the combobox background. * @param pDC Pointer to a valid device context. * @param pComboBox Pointer to the combobox to be drawn. */ virtual void DrawBackground(CDC* pDC, CXTPComboBox* pComboBox); /** * @brief * Called by the paint manager to draw the button portion of the * combobox control. * @param pDC Pointer to the device context for the combobox. * @param pComboBox Pointer to a CXTPComboBox object. * @param rcBtn Size of the button to draw. */ virtual void DrawButton(CDC* pDC, CXTPComboBox* pComboBox, CRect rcBtn); /** * @brief * Called by the paint manager to draw the drop down arrow for * the combobox drop button. * @param pDC Pointer to the device context for the combobox. * @param pComboBox Pointer to a CXTPComboBox object. * @param rcBtn Size of the button to draw. */ virtual void DrawButtonTriangle(CDC* pDC, CXTPComboBox* pComboBox, CRect rcBtn); /** * @brief * This member function is called by the theme manager to refresh * the visual styles used by each component's theme. * @param pComboBox Pointer to a CXTPComboBox object. */ virtual void RefreshMetrics(CXTPComboBox* pComboBox); /** * @brief * Call this member function to retrieve the background color * of the CXTPComboBox control. * @return * An RGB color value representing the background color * of the CXTPComboBox control. * @see * SetTextColor, ResetTextColor, SetBackColor, GetTextColor */ COLORREF GetBackColor() const; /** * @brief * Call this member function to set the background color * for the CXTPComboBox control. * @param clrBackground An RGB color value representing the background color * for the CXTPComboBox control. * @return * An RGB color value representing the previous background color * for the CXTPComboBox control. * @see * SetTextColor, ResetTextColor, GetBackColor, GetTextColor */ COLORREF SetBackColor(COLORREF clrBackground); /** * @brief * Call this member function to reset the background color * for the CXTPComboBox control. * @see * GetTextColor, SetTextColor, GetBackColor, GetTextColor */ void ResetBackColor(); /** * @brief * Call this member function to retrieve the text color * of the CXTPComboBox control. * @return * An RGB color value representing the text color * of the CXTPComboBox control. * @see * SetTextColor, ResetTextColor, SetBackColor, GetBackColor */ COLORREF GetTextColor() const; /** * @brief * Call this member function to set the text color * for the CXTPComboBox control. * @param clrText An RGB color value representing the text color * for the CXTPComboBox control. * @return * An RGB color value representing the previous text color * for the CXTPComboBox control. * @see * GetTextColor, ResetTextColor, SetBackColor, GetBackColor */ COLORREF SetTextColor(COLORREF clrText); /** * @brief * Call this member function to reset the text color * for the CXTPComboBox control. * @see * GetTextColor, SetTextColor, SetBackColor, GetBackColor */ void ResetTextColor(); /** * @brief * Call this member function to retrieve a reference to a CBrush * object used to draw the combobox background. * @return * A reference to a CBrush object used to draw the combobox * background. */ const CBrush& GetBackgroundBrush() const; protected: /** * @brief * Called by the framework to update the color value used by * the combobox background brush. */ void UpdateBackgroundBrush(); int m_nThumbWidth; /**< Size in pixels of the drop button width. */ CXTPBrush m_xtpBrushBackground; /**< Brush used by the combobox to fill the background color. */ XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CBrush, m_brBackground, m_xtpBrushBackground, GetBackgroundBrushHandle); CXTPWinThemeWrapper* m_themeComboBox; /**< Windows API wrapper used to draw windows theme. */ public: CXTPPaintManagerColor m_clrBorderDisabled; /**< RGB value used to draw the disabled border color. */ CXTPPaintManagerColor m_clrBorderHot; /**< RGB value used to draw the hilighted border color. */ CXTPPaintManagerColor m_clrBorderNormal; /**< RGB value used to draw the normal border color. */ CXTPPaintManagerColor m_clrButtonPressed; /**< RGB value used to draw the pressed button color. */ CXTPPaintManagerColor m_clrButtonHot; /**< RGB value used to draw the highlighted button color. */ CXTPPaintManagerColor m_clrButtonNormal; /**< RGB value used to draw the normal button color. */ CXTPPaintManagerColor m_clrButtonArrowPressed; /**< RGB value used to draw the pressed button arrow color. */ CXTPPaintManagerColor m_clrButtonArrowHot; /**< RGB value used to draw the highlighted button arrow color. */ CXTPPaintManagerColor m_clrButtonArrowNormal; /**< RGB value used to draw the normal button arrow color. */ CXTPPaintManagerColor m_clrBackground; /**< RGB color value representing background color. */ CXTPPaintManagerColor m_clrBackDisabled; /**< RGB color value representing disabled background color. */ CXTPPaintManagerColor m_clrBackHighlight; /**< RGB color value representing highlight background color. */ CXTPPaintManagerColor m_clrText; /**< RGB color value representing text color. */ CXTPPaintManagerColor m_clrTextDisabled; /**< RGB color value representing disabled text color. */ CXTPPaintManagerColor m_clrTextHighlight; /**< RGB color value representing highlight text color. */ CXTPPaintManagerColorGradient m_grcButton; /**< RGB value used to draw the button gradient color. */ CXTPPaintManagerColorGradient m_grcButtonHilite; /**< RGB value used to draw the button highlighted gradient color. */ CXTPPaintManagerColorGradient m_grcButtonPushed; /**< RGB value used to draw the button pushed gradient color. */ private: friend class CXTPComboBox; }; ///////////////////////////////////////////////////////////////////////////// /** @cond */ AFX_INLINE COLORREF CXTPComboBoxTheme::GetBackColor() const { return m_clrBackground; } AFX_INLINE COLORREF CXTPComboBoxTheme::SetBackColor(COLORREF clrBackground) { COLORREF clrOldBackground = m_clrBackground; m_clrBackground.SetCustomValue(clrBackground); return clrOldBackground; } AFX_INLINE void CXTPComboBoxTheme::ResetBackColor() { m_clrBackground.SetDefaultValue(); } AFX_INLINE COLORREF CXTPComboBoxTheme::GetTextColor() const { return m_clrText; } AFX_INLINE COLORREF CXTPComboBoxTheme::SetTextColor(COLORREF clrText) { COLORREF clrOldText = m_clrText; m_clrText.SetCustomValue(clrText); return clrOldText; } AFX_INLINE void CXTPComboBoxTheme::ResetTextColor() { m_clrText.SetDefaultValue(); } AFX_INLINE const CBrush& CXTPComboBoxTheme::GetBackgroundBrush() const { return m_xtpBrushBackground; } /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // __XTPCOMBOBOXTHEME_H__ /** @endcond */