/**
* @file XTPTabColorSetWinNative.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(__XTPTABCOLORSETWINNATIVE_H__)
# define __XTPTABCOLORSETWINNATIVE_H__
/** @endcond */
# if _MSC_VER > 1000
# pragma once
# endif // _MSC_VER > 1000
# include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h"
/**
* @brief
* CColorSetWinNative implements a Windows XP tab color set.
* @details
* To use the Windows XP color set, SetColor is used to apply
* the xtpTabColorWinNative XTPTabColorStyle.
*
* The following appearances (XTPTabAppearanceStyle) support CColorSetWinNative:
* xtpTabAppearancePropertyPage: Office 2000 appearance.
* xtpTabAppearancePropertyPageSelected: Office 2000 selected appearance.
* xtpTabAppearanceStateButtons: State Button appearance.
* @see
* XTPTabColorStyle, XTPTabAppearanceStyle, SetAppearance, GetAppearance,
* GetAppearanceSet, SetColor, GetColor, GetColorSet, SetColorSet, SetAppearanceSet
*/
class _XTP_EXT_CLASS CColorSetWinNative : public CXTPTabColorSetDefault
{
public:
CColorSetWinNative();
virtual ~CColorSetWinNative();
/**
* @brief
* Refreshes the visual metrics of the tabs.
* Override this method to change the colors of the color members.
* @details
* All of the color members are refreshed when this method is called.
*/
virtual void RefreshMetrics();
/**
* @brief
* Fills a specified tab button.
* @param pDC Pointer to a valid device context.
* @param rcItem Bounding rectangle of the tab button to fill.
* @param pItem Pointer to the tab button to fill.
* @return
* XTP_TABMANAGER_COLOR_NONE
* @details
* This method is used to fill all tab buttons except when
* XTPTabAppearanceStyle is set to xtpTabAppearanceStateButtons.
* xtpTabAppearanceStateButtons requires the FillStateButton member.
*
* If IsAppThemed is FALSE, then
* CXTPTabColorSetDefault::FillPropertyButton is used.
* @see
* FillStateButton
*/
virtual COLORREF FillPropertyButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem);
/**
* @brief
* Fills the tab client area of a specified tab manager.
* @param pDC Pointer to a valid device context.
* @param rc Bounding rectangle of the tab client area.
* @param pTabManager Pointer to the tab manager with the tab client area to fill.
* @details
* The bounding rectangle of the tab client area can be retrieved by using
* CXTPTabPaintManagerTheme::GetClientRect or CXTPTabManager::GetClientRect.
* @return
* If IsAppThemed is TRUE, then a value of 0 is returned.
*
* If IsAppThemed is FALSE and a tab is selected, then the color from
* CXTPTabManager::GetItemColor for the currently selected tab is returned.
*
* If IsAppThemed is FALSE and a tab is not selected, then
* CXTPTabPaintManagerColorSet::m_clrButtonSelected is returned.
*/
virtual COLORREF FillClient(CDC* pDC, CRect rc, CXTPTabManager* pTabManager);
/**
* @brief
* Sets a clipping region for the specified tab client area.
* @param pDC Pointer to a valid device context.
* @param rcClient Bounding rectangle of the tab client area. This will
* be the clipping region for the device context.
* @param pTabManager Pointer to the tab manager.
*/
virtual void SelectClipRgn(CDC* pDC, CRect rcClient, CXTPTabManager* pTabManager);
/**
* @brief
* Fills a specified tab navigation button.
* @param pDC Pointer to a valid device context.
* @param pButton Pointer to the tab navigation button to fill.
* @param rc Reference to the bounding rectangle of the tab navigation button.
* @details
* This method is used to fill the tab navigation buttons in the header of
* the tab client and is overridden by XTPTabColorStyle and
* CXTPTabPaintManagerColorSet to perform actions such as painting
* the highlighted, pressed, and normal versions of tab navigation buttons.
*
* If IsAppThemed is FALSE, then
* CXTPTabColorSetDefault::FillNavigationButton is used.
* @see
* CXTPTabManager::GetNavigateButton, CXTPTabManagerNavigateButton
*/
virtual void FillNavigateButton(CDC* pDC, CXTPTabManagerNavigateButton* pButton, CRect& rc);
/**
* @brief
* Fills a specified tab button when XTPTabAppearanceStyle
* is xtpTabAppearanceStateButtons.
* @param pDC Pointer to a valid device context.
* @param rcItem Bounding rectangle of the tab button to fill.
* @param pItem Pointer to the tab button to fill.
* @details
* This method is only used to fill buttons when XTPTabAppearanceStyle
* is xtpTabAppearanceStateButtons. Otherwise, FillPropertyButton is used.
*
* If IsAppThemed is FALSE and/or the tab button is not selected, then
* CXTPTabColorSetDefault::FillStateButton is used.
* @see
* FillPropertyButton
*/
virtual void FillStateButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem);
/**
* @brief
* Determines if Windows XP themes are enabled and if
* a Windows XP theme is currently used.
* @return
* TRUE if Windows XP themes are enabled and if
* a Windows XP theme is currently used, otherwise FALSE.
* @details
* IsAppThemed will return FALSE if running an operating system before
* Windows XP (i.e. 98, 2000, NT) or if Windows XP is used
* with Standard/Classic themes.
*
* This method is called internally to determine how to colorize
* tab buttons. If this method returns TRUE, then Windows XP colorization
* is used to colorize tab buttons. If this method returns FALSE, then
* CXTPTabPaintManager::CXTPTabColorSetDefault is used to colorize tab buttons.
* @see
* CXTPTabPaintManager::IsAppThemed
*/
virtual BOOL IsAppThemed() const;
private:
typedef void(AFX_CDECL* LPFNDRAWROTATEDBITS)(int cx, int cy, UINT* pSrcBits, UINT* pDestBits);
/** @cond */
public:
void DrawRotatedButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem, BOOL bSwap,
LPFNDRAWROTATEDBITS pfnRotatedProc);
static void AFX_CDECL DrawRotatedBitsBottom(int cx, int cy, UINT* pSrcBits, UINT* pDestBits);
static void AFX_CDECL DrawRotatedBitsRight(int cx, int cy, UINT* pSrcBits, UINT* pDestBits);
static void AFX_CDECL DrawRotatedBitsLeft(int cx, int cy, UINT* pSrcBits, UINT* pDestBits);
static void AFX_CDECL DrawRotatedBitsInvertRight(int cx, int cy, UINT* pSrcBits,
UINT* pDestBits);
/** @endcond */
protected:
CXTPWinThemeWrapper* m_themeTabButton; /**< Internally used helper to draw property page buttons
using Windows XP color set. */
CXTPWinThemeWrapper* m_themeToolbar; /**< Internally used helper to draw state buttons using
Windows XP color set. */
};
/** @cond */
// obsolete, for backward compatibility only.
class _XTP_EXT_CLASS CColorSetWinXP : public CColorSetWinNative
{
};
/** @endcond */
# include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h"
/** @cond */
#endif // !defined(__XTPTABCOLORSETWINNATIVE_H__)
/** @endcond */