/**
* @file XTPTabPaintManager.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(__XTPTABPAINTMANAGER_H__)
# define __XTPTABPAINTMANAGER_H__
/** @endcond */
# if _MSC_VER > 1000
# pragma once
# endif // _MSC_VER > 1000
# include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h"
class CXTPTabManager;
class CXTPTabManagerAtom;
class CXTPTabManagerItem;
class CXTPTabManagerNavigateButton;
class CXTPWinThemeWrapper;
class CXTPTabPaintManager;
class CXTPTabPaintManagerColorSet;
class CXTPTabPaintManagerTheme;
/**
* @brief
* CXTPTabPaintManager is used to store the color and appearance information
* of the tabs in the tab manager.
*/
class _XTP_EXT_CLASS CXTPTabPaintManager : public CXTPCmdTarget
{
public:
class CAppearanceSetPropertyPage;
class CAppearanceSetFlat;
class CColorSetDefault;
public:
/**
* @brief
* Constructs a CXTPTabPaintManager object.
* @param bPanelManager TRUE indicates that this is a panel manager, FALSE for tab manager.
*/
CXTPTabPaintManager(BOOL bPanelManager = FALSE);
/**
* @brief
* Destroys a CXTPTabPaintManager object, handles cleanup and deallocation.
*/
virtual ~CXTPTabPaintManager();
public:
/**
* @brief
* Applies one of the "built-in" color sets for the tabs.
* @param tabColor "Built-in" color set to be applied; must be one of
* the values defined by the XTPTabColorStyle enumeration.
* @return
* A pointer to the newly applied "built-in" color set.
* @details
* Use SetColor to apply a "built-in" color set.
* Use SetColorSet to apply a custom color set.
*
* Color sets are used to colorize the tabs. For example, applying
* the xtpTabColorWinNative color set will give the tabs a Windows XP colorization.
* @see
* XTPTabColorStyle, SetColorSet, GetColor, GetColorSet, XTPTabAppearanceStyle,
* SetAppearanceSet, SetAppearance, GetAppearance, GetAppearanceSet
*/
virtual CXTPTabPaintManagerColorSet* SetColor(XTPTabColorStyle tabColor);
/**
* @brief
* Applies a custom color set for the tabs.
* @param pColorSet Pointer to the custom color set to be applied.
* @return
* A pointer to the newly applied custom color set.
* @details
* Use SetColor to apply a "built-in" color set.
* Use SetColorSet to apply a custom color set.
*
* Color sets are used to colorize the tabs. For example, applying
* the xtpTabColorWinNative color set will give the tabs a Windows XP colorization.
* @see
* XTPTabColorStyle, SetColor, GetColor, GetColorSet, XTPTabAppearanceStyle,
* SetAppearanceSet, SetAppearance, GetAppearance, GetAppearanceSet
*/
virtual CXTPTabPaintManagerColorSet* SetColorSet(CXTPTabPaintManagerColorSet* pColorSet);
/**
* @brief
* Applies one of the "built-in" appearance sets for the tabs.
* @param tabAppearance "Built-in" appearance set to be applied; must be one of
* the values defined by the XTPTabAppearanceStyle enumeration.
* @return
* A pointer to the newly applied "built-in" appearance set.
* @details
* Use SetAppearance to apply a "built-in" appearance.
* Use SetAppearanceSet to apply a custom appearance.
*
* An appearance set specifies how tabs will look. This is
* the actual physical structure of the tab buttons. For example,
* tab buttons with an Excel appearance set will have a half-hexagon shape.
* @see
* XTPTabAppearanceStyle, SetAppearanceSet, GetAppearance, GetAppearanceSet,
* SetColor, GetColor, GetColorSet, SetColorSet
*/
virtual CXTPTabPaintManagerTheme* SetAppearance(XTPTabAppearanceStyle tabAppearance);
/**
* @brief
* Applies a custom appearance set for the tabs.
* @param pAppearanceSet Pointer to the custom appearance set to be applied.
* @details
* Use SetAppearance to apply a "built-in" appearance.
* Use SetAppearanceSet to apply a custom appearance.
*
* An appearance set specifies how tabs will look. This is
* the actual physical structure of the tab buttons. For example,
* tab buttons with an Excel appearance set will have a half-hexagon shape.
*
* SetColorSet is used to set custom colors.
*
* See the GUI_Eclipse sample for an example of how to create
* a custom appearance set and apply it for the tabs.
* @return
* A pointer to the newly applied custom appearance set.
* @see
* XTPTabAppearanceStyle, SetAppearance, GetAppearance, GetAppearanceSet,
* SetColor, GetColor, GetColorSet, SetColorSet
*/
virtual CXTPTabPaintManagerTheme* SetAppearanceSet(CXTPTabPaintManagerTheme* pAppearanceSet);
/**
* @brief
* Gets the currently applied custom appearance set.
* @return
* A pointer to the currently applied custom appearance set.
* @details
* An appearance set specifies how tabs will look. This is
* the actual physical structure of the tab buttons. For example,
* tab buttons with an Excel appearance set will have a half-hexagon shape.
*
* SetColorSet is used to set custom colors.
*
* See the GUI_Eclipse sample for an example of how to create
* a custom appearance set and apply it for the tabs.
* @see
* GetAppearanceSet, SetAppearanceSet, SetAppearance
*/
CXTPTabPaintManagerTheme* GetAppearanceSet() const;
/**
* @brief
* Gets the currently applied custom color set.
* @return
* A pointer to the currently applied custom color set.
* @details
* Color sets are used to colorize the tabs. For example, applying
* the xtpTabColorWinNative color set will give the tabs a Windows XP colorization.
* @see
* XTPTabColorStyle, GetColor, SetColorSet, SetColor
*/
CXTPTabPaintManagerColorSet* GetColorSet() const;
/**
* @brief
* Gets the currently applied "built-in appearance set.
* @return
* The currently applied "built-in" appearance set; one of
* the values defined by the XTPTabAppearanceStyle enumeration.
* @details
* An appearance set specifies how tabs will look. This is
* the actual physical structure of the tab buttons. For example,
* tab buttons with an Excel appearance set will have a half-hexagon shape.
* @see
* XTPTabAppearanceStyle, GetAppearanceSet, SetAppearanceSet, SetAppearance
*/
XTPTabAppearanceStyle GetAppearance() const;
/**
* @brief
* Gets the currently applied "built-in" color set.
* @return
* The currently applied "built-in" color set.
* @details
* Color sets are used to colorize the tabs. For example, applying
* the xtpTabColorWinNative color set will give the tabs a Windows XP colorization.
* @see
* XTPTabColorStyle, SetColor, GetColorSet, SetColorSet
*/
XTPTabColorStyle GetColor() const;
/**
* @brief
* Determines if luna colors are disabled/enabled.
* @return
* TRUE if luna colors are disabled, FALSE is luna colors are enabled.
* @details
* Luna colors are the Windows XP colors (Silver, Blue, Olive).
* CXTPDrawHelpers::GetCurrentSystemTheme can be called to get
* the currently used system theme.
* @see
* DisableLunaColors, XTPCurrentSystemTheme,
* CXTPDrawHelpers::GetCurrentSystemTheme
*/
BOOL IsLunaColorsDisabled() const;
/**
* @brief
* Disables/enables luna colors.
* @param bDisableLunaColors TRUE to disable luna colors,
* FALSE to enable luna colors.
* @details
* Luna colors are the Windows XP colors (Silver, Blue, Olive).
* CXTPDrawHelpers::GetCurrentSystemTheme can be called to get
* the currently used system theme.
* @see
* IsLunaColorsDisabled, XTPCurrentSystemTheme,
* CXTPDrawHelpers::GetCurrentSystemTheme
*/
void DisableLunaColors(BOOL bDisableLunaColors);
/**
* @brief
* Retrieves the RGB value of a specified OneNote color.
* @param tabColor XTPTabOneNoteColor flag indicating which OneNote color to retrieve
* the RGB value of. See remarks section for available flags.
* @details
* The tab manager calls this member function to retrieve the RGB
* color for the value specified by tabColor. tabColor
* can be one of the following values:
* xtpTabColorBlue: Blue tab color used when OneNote
* colors are enabled.
* xtpTabColorYellow: Yellow tab color used when OneNote
* colors are enabled.
* xtpTabColorGreen: Green tab color used when OneNote
* colors are enabled.
* xtpTabColorRed: Red tab color used when OneNote
* colors are enabled.
* xtpTabColorPurple: Purple tab color used when OneNote
* colors are enabled.
* xtpTabColorCyan: Cyan tab color used when OneNote
* colors are enabled.
* xtpTabColorOrange: Orange tab color used when OneNote
* colors are enabled.
* xtpTabColorMagenta: Magenta tab color used when OneNote
* colors are enabled.
* @return
* The RGB value of the specified OneNote color.
*
* Example:
* See WM_XTP_GETTABCOLOR for an example.
* @see
* XTPTabOneNoteColor
*/
static COLORREF AFX_CDECL GetOneNoteColor(XTPTabOneNoteColor tabColor);
/**
* @brief
* Enables/disables OneNote colorization for the tabs.
* @param bOneNoteColors TRUE to enable OneNote colorization,
* FALSE to disable OneNote colorization.
* @details
* OneNote colors are similar to the tab colorization for
* tabs in Microsoft OneNote.
*/
void SetOneNoteColors(BOOL bOneNoteColors);
/**
* @brief
* Sets the tab position.
* @param tabPosition Tab position to be set; must be one of the
* values defined by the XTPTabPosition enumeration.
* @details
* The tab position refers to where the tab buttons are located.
* The tab buttons can be positioned on either the top, bottom,
* left, or right side of the tab client area.
* @see
* XTPTabPosition, GetPosition
*/
void SetPosition(XTPTabPosition tabPosition);
/**
* @brief
* Sets the tab layout style.
* @param tabLayout Tab layout style to be set; must be one of the
* values defined by the XTPTabLayoutStyle enumeration.
* @details
* The tab layout style refers to how the tab buttons are sized
* within the tab client header. The tab buttons can be in either
* a compressed, fixed, auto-size, or size-to-fit layout.
* @see
* XTPTabPosition, GetLayout
*/
void SetLayout(XTPTabLayoutStyle tabLayout);
/**
* @brief
* Gets the tab position.
* @return
* The tab position; one of the values defined by
* the XTPTabPosition enumeration.
* @details
* The tab position refers to where the tab buttons are located.
* The tab buttons can be positioned on either the top, bottom,
* left, or right side of the tab client area.
* @see
* XTPTabPosition, SetPosition
*/
XTPTabPosition GetPosition() const;
/**
* @brief
* Gets the tab layout style.
* @return
* The tab layout style; one of the values defined by
* the XTPTabLayoutStyle enumeration.
* @details
* The tab layout style refers to how the tab buttons are sized
* within the tab client header. The tab buttons can be in either
* a compressed, fixed, auto-size, or size-to-fit layout.
* @see
* XTPTabLayoutStyle, SetLayoutStyle
*/
XTPTabLayoutStyle GetLayout() const;
/**
* @brief
* Sets the font for the tabs.
* @param pLogFont Font to be set.
* @param bUseStandardFont The value of this parameter should only be TRUE when
* this method is called internally. Otherwise the value
* of this parameter should always be FALSE to indicate
* that pLogFont should be used as the font for the tabs.
* @details
* When bUseStandardFont is TRUE, the standard system "icon" font
* will be used (i.e. Tahoma 8pt).
*/
void SetFontIndirect(LOGFONT* pLogFont, BOOL bUseStandardFont = FALSE);
public:
/**
* @brief
* Draws the tab control.
* @param pTabManager Pointer to the tab manager to draw.
* @param pDC Pointer to a valid device context.
* @param rcControl Bounding rectangle of the client area.
* @details
* This method is called during various Draw and Paint functions.
*
* This method will call CXTPTabPaintManagerTheme::DrawTabControl
* for the currently set appearance. CXTPTabPaintManagerTheme::DrawTabControl
* will then call CXTPTabPaintManager::DrawTabControlEx.
*/
virtual void DrawTabControl(CXTPTabManager* pTabManager, CDC* pDC, CRect rcControl);
/**
* @brief
* Adjusts the tab client rectangle.
* @param pTabManager Pointer to the tab manager to adjust the tab client rectangle.
* @param rcClient [out] Reference to a CRect object to receive
* the new tab client rectangle with margins included.
* @details
* Both AdjustClientRect and RepositionTabControl are called
* when the window is resized. When DrawTabControl is called,
* the changes will be used when drawing the tab control.
*
* This method will adjust the tab client rectangle of
* the entire tab manager if IsDrawStaticFrame is TRUE
* in order to make room to draw the static frame.
*
* CXTPTabPaintManagerTheme::AdjustClientRect will be called if
* there is one or more tabs in the tab manager.
* @see
* CXTPTabPaintManagerTheme::AdjustClientRect
*/
virtual void AdjustClientRect(CXTPTabManager* pTabManager, CRect& rcClient);
/**
* @brief
* Moves the tab buttons of the tab control to their correct positions.
* @param pTabManager Pointer to the tab manager that the tab buttons are on.
* @param pDC Pointer to a valid device context.
* @param rcControl Client rectangle of the tab control.
* @details
* Both AdjustClientRect and RepositionTabControl are called
* when the window is resized. When DrawTabControl is called,
* the changes will be used when drawing the tab control.
*
* CXTPTabPaintManagerTheme::RepositionTabControl will be called
* for the currently set appearance.
*/
virtual void RepositionTabControl(CXTPTabManager* pTabManager, CDC* pDC, CRect rcControl);
/**
* @brief
* Repositions the tab navigation buttons.
* @param pTabManager Pointer to the tab manager that the tab navigation buttons are on.
* @param rcClient Client rectangle of the tab control.
* @return
* The bounding rectangle of the tab header (including header margins).
* @details
* CXTPTabPaintManager::RepositionTabControlEx calls this method
* to reposition the tab navigation buttons.
*/
CRect RepositionNavigateButtons(CXTPTabManager* pTabManager, CRect rcClient);
/**
* @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 calls m_pColorSet->FillNavigateButton.
*
* The XTPTabColorStyle CXTPTabPaintManagerColorSet classes override
* this method to perform actions such as painting
* the highlighted, pressed, and normal versions of tab navigation buttons.
* @see
* CXTPTabPaintManagerColorSet::FillNavigateButton,
* CXTPTabManager::GetNavigateButton, CXTPTabManagerNavigateButton
*/
void FillNavigateButton(CDC* pDC, CXTPTabManagerNavigateButton* pButton, CRect& rc);
/**
* @brief
* Draws a specified tab navigation button.
* @param pDC Pointer to a valid device context.
* @param pButton Pointer to the tab navigation button to draw.
* @param rc Reference to the bounding rectangle of the tab navigation button.
* @see
* CXTPTabPaintManagerColorSet::FillNavigateButton,
* CXTPTabManager::GetNavigateButton, CXTPTabManagerNavigateButton
*/
virtual void DrawNavigateButton(CDC* pDC, CXTPTabManagerNavigateButton* pButton, CRect& rc);
/**
* @brief
* Draws the text and icon of a specified tab button.
* @param pDC Pointer to a valid device context.
* @param pItem Pointer to the tab button to draw the text and icon of.
* @param rcItem Bounding rectangle of the tab.
* @param bDraw TRUE to draw the tab button's text and icon,
* FALSE to only calculate the button width (no drawing is performed).
* @return
* If bDraw is TRUE, then a value of 0 is returned.
* If bDraw is FALSE, then the button width including both
* the left and right button margins is returned.
* @details
* This method is only used to draw the text and icon of a tab button.
* This method does not draw the tab button.
*
* CXTPTabPaintManagerTheme::DrawSingleButton calls
* CXTPTabPaintManager::DrawSingleButtonIconAndText after
* the button is drawn to draw the button's icon and text.
* @see
* CXTPTabPaintManager::DrawTabControlEx, CXTPTabPaintManagerTheme::DrawSingleButton
*/
virtual int DrawSingleButtonIconAndText(CDC* pDC, CXTPTabManagerItem* pItem, CRect rcItem,
BOOL bDraw);
/**
* @brief
* Ensures that a specified tab is visible.
* @param pTabManager Pointer to the tab manager that the tab is on.
* @param pItem Pointer to the tab to ensure the visibility of.
* @see
* CXTPTabManager::SetHeaderOffset, CXTPTabManager::GetHeaderOffset
*/
void EnsureVisible(CXTPTabManager* pTabManager, CXTPTabManagerItem* pItem);
/**
* @brief
* Refreshes the visual metrics of the main tab manager.
* @details
* This method checks if m_bUseStandardFont is TRUE.
* If m_bUseStandardFont is TRUE, then this method updates
* the font with the standard system "icon" font (i.e. Tahoma 8pt).
*
* This method calls RefreshMetrics for the currently used
* CXTPTabPaintManagerColorSet and CXTPTabPaintManagerTheme.
*/
virtual void RefreshMetrics();
/**
* @brief
* Adds a control to the list of controls that receives a notification
* when a property of the paint manager is changed.
* @param pObserver Pointer to the control to be added to the list of controls.
* @details
* This method is not used in the MFC version.
* This method is only used in the ActiveX version and does nothing in MFC.
*/
void AddObserver(CXTPTabManagerAtom* pObserver);
/**
* @brief
* Sets the behaviour for tooltips.
* @param behaviour Tooltips behaviour to be set.
* See the Remarks section for available flags.
* @details
* The behaviour parameter can be one of the following:
* xtpTabToolTipNever: Never show tooltips for tabs.
* xtpTabToolTipAlways: Always show tooltips for tabs.
* xtpTabToolTipShrinkedOnly: Only show tooltips if the tab was shrinked
* (see xtpTabLayoutSizeToFit layout).
*/
void EnableToolTips(XTPTabToolTipBehaviour behaviour = xtpTabToolTipAlways);
public:
/**
* @brief
* Gets the font used to display caption text in the tab buttons.
* @param bVertical TRUE if XTPTabPosition is vertical,
* FALSE if XTPTabPosition is horizontal.
* @return
* The font used to display caption text in the tab buttons.
* @see
* GetBoldFont
*/
CFont* GetFont(BOOL bVertical = FALSE);
/**
* @brief
* Gets the font used to display bold caption text in the tab buttons.
* @param bVertical TRUE if XTPTabPosition is vertical,
* FALSE if XTPTabPosition is horizontal.
* @return
* The font used to display bold caption text in the tab buttons.
* @details
* Bold font is used to display caption text when a tab
* is selected and m_bBoldSelected = TRUE.
*
* If m_bBoldNormal = TRUE, then tabs will use bold font
* even when they are not selected.
* @see
* m_bBoldNormal, m_bBoldSelected, GetFont
*/
CFont* GetBoldFont(BOOL bVertical = FALSE);
protected:
/**
* @brief
* Changes the tab button size when
* XTPTabLayoutStyle is set to xtpTabLayoutSizeToFit.
* @param pTabManager Pointer to the tab manager.
* @param nWidth Total width that all tab buttons must fit within.
* @details
* When calculating nWidth, the width of both the left and right
* rcHeaderMargin and the width of the tab navigation button
* should be subtracted from the width of the tab client.
* @see
* XTPTabLayoutStyle, SetLayout, GetLayout
*/
void SizeToFit(CXTPTabManager* pTabManager, int nWidth);
/**
* @brief
* Draws the tab control.
* @param pTabManager Pointer to the tab manager to draw.
* @param pDC Pointer to a valid device context.
* @param rcControl Bounding rectangle of the client area.
* @details
* DrawTabControl calls CXTPTabPaintManagerTheme::DrawTabControl
* which will then call DrawTabControlEx if it has not been overridden.
* @see
* CXTPTabPaintManagerTheme::DrawTabControl
*/
void DrawTabControlEx(CXTPTabManager* pTabManager, CDC* pDC, CRect rcControl);
/**
* @brief
* Moves the tab buttons of the tab control to their correct positions.
* @param pTabManager Pointer to the tab manager that the tab buttons are on.
* @param pDC Pointer to a valid device context.
* @param rcClient Client rectangle of the tab control.
* @details
* Both AdjustClientRect and RepositionTabControl are called
* when the window is resized. When DrawTabControl is called,
* the changes will be used when drawing the tab control.
*
* RepositionTabControl calls CXTPTabPaintManagerTheme::RepositionTabControl
* which will then call RepositionTabControlEx if it has not been overridden.
* @see
* CXTPTabPaintManagerTheme::RepositionTabControl
*/
void RepositionTabControlEx(CXTPTabManager* pTabManager, CDC* pDC, CRect rcClient);
/**
* @brief
* Moves the tab buttons of the multi-row tab control to their correct positions.
* @param pTabManager Pointer to the tab manager that the tab buttons are on.
* @param pDC Pointer to a valid device context.
* @param rcClient Client rectangle of the tab control.
*/
void RepositionTabControlMultiRow(CXTPTabManager* pTabManager, CDC* pDC, CRect rcClient);
/**
* @brief
* This method is called when a property of the tab paint manager is changed.
*/
virtual void OnPropertyChanged();
protected:
/**
* @brief
* Gets the total button length of a tab button including
* the left and right button margins.
* @param nValue Width of the tab button.
* @param nMin Minimum width of the tab button.
* @param nMax Maximum width of the tab button.
* @return
* The total button length of a tab button including
* the left and right button margins.
* @see
* CXTPTabManager::GetItemMetrics
*/
int _GetButtonLength(int nValue, int nMin, int nMax);
/**
* @brief
* Draws an ellipse "..." in the middle of a specified string.
* @param pDC Pointer to a valid device context.
* @param pManager Pointer to the tab manager to draw.
* @param strItem Reference to the string item to draw the ellipse in.
* @param rcItem Bounding rectangle of the tab button. This is the rectangle
* (in logical coordinates) in which the text is to be formatted.
* @param uFormat See nFormat parameter of CDC DrawText.
*/
void DrawTextPathEllipsis(CDC* pDC, CXTPTabManager* pManager, const CString& strItem,
CRect rcItem, UINT uFormat);
protected:
/** @cond */
int GetPrefixTextExtent(CDC* pDC, CXTPTabManager* pManager, const CString& str, CRect rcItem,
UINT uFormat);
void StripMnemonics(CString& strClear);
void DrawRowItems(CXTPTabManager* pTabManager, CDC* pDC, const CRect& rcClient, int nItemRow);
void CreateMultiRowIndexer(CXTPTabManager* pTabManager, CDC* pDC, int nWidth);
virtual void DrawFocusRect(CDC* pDC, CXTPTabManagerItem* pItem, CRect rcItem);
BOOL _CreateMultiRowIndexerBestFit(CXTPTabManager* pTabManager, int nWidth, int nRow,
int nTotalLength);
BOOL _CreateMultiRowIndexerPlain(CXTPTabManager* pTabManager, int nWidth, int nRow,
int nTotalLength);
int _ReduceNumberOfRowsForPlainIndexer(CXTPTabManager* pTabManager, int nRowCount, int nWidth,
int nTotalLength); /**< returns nRowCount or a lesser
value when plain indexer can
produce extra rows */
static int AFX_CDECL _SizeToFitCompare(const void* arg1, const void* arg2);
/** @endcond */
public:
BOOL m_bHotTracking; /**< If TRUE, then tab hot tracking will be enabled. */
BOOL m_bShowIcons; /**< If TRUE, then tab icons will be drawn if icons were added. */
BOOL m_bBoldSelected; /**< If TRUE, then the text of selected tabs will be displayed in bold
font. */
BOOL m_bBoldNormal; /**< If TRUE, then bold font will be used for all tabs regardless of whether
they are selected or non-selected. */
BOOL m_bDisableLunaColors; /** If FALSE, then tabs will not use luna colors * the current theme
uses luna colors. */
BOOL m_bOneNoteColors; /** If TRUE, then tabs will use OneNote colorization. */
XTPTabClientFrame m_clientFrame; /**< Frame style of the tab client area. */
BOOL m_bStaticFrame; /**< If TRUE, then a static frame will be drawn around the entire tab area.
*/
CRect m_rcClientMargin; /**< Margin around the tab client area. */
CRect m_rcControlMargin; /**< Margin around the entire tab control (i.e. tab client header and
tab client area). */
CRect m_rcButtonMargin; /**< Margin around the text in tab button. */
CRect m_rcButtonTextPadding; /**< Margin around the text in tab button. */
BOOL m_bInvertGradient; /**< If TRUE, then the colors passed into
CXTPTabPaintManagerColorSet::GradientFill will be swapped before the
rectangle is filled with the gradient. */
BOOL m_bFillBackground; /**< If TRUE, then the tab client space is filled using
CXTPTabPaintManager.CXTPTabPaintManagerColorSet.m_clrControlFace
color. This is only FALSE when drawing docking pane panel auto-hide
tabs because there is no client area to draw. */
CSize m_szIcon; /**< Size of the icon displayed in the tab button. */
BOOL m_bDrawTextPathEllipsis; /**< If TRUE, when the size of a tab button is too small to
display the caption, the middle of the caption will be replaced
with an ellipse "...". If FALSE, then the end of the caption
will be replaced with the ellipse. */
BOOL m_bDrawTextEndEllipsis; /**< If TRUE, when the size of a tab button is too small to display
the caption, the end of the caption will be replaced with an
ellipse "...". If FALSE, then the end of the caption will be
replaced with the ellipse. */
BOOL m_bDrawTextNoPrefix; /**< If FALSE, then an ampersand '&' in the tab button caption will be
ignored and a double ampersand '&&' will display a single ampersand
'&'. If TRUE, then the caption will be displayed unmodified. */
UINT m_nDrawTextFormat; /**< Text format for tabs (default - DT_LEFT | DT_VCENTER). */
BOOL m_bDrawTextHidePrefix; /**< If FALSE, then an ampersand '&' in the tab button caption will
be ignored and a double ampersand '&&' will display a single
ampersand '&'. If TRUE, then the caption will be hidden. */
BOOL m_bMultiRowFixedSelection; /**< FALSE to move row with selected item close to client pane.
*/
BOOL m_bMultiRowJustified; /**< TRUE to stretch each row of tabs to fill the entire width of the
control. */
BOOL m_bDrawFocusRect; /**< TRUE to draw focus rect for focused item. */
int m_bSelectOnDragOver; /**< 1 - to activate tab when user drag files/text under it. 2 - to
activate with small delay. */
int m_nButtonExtraLength; /**< Additional padding of tabs. */
BOOL m_bSelectOnButtonDown; /**< If TRUE, then tab selected on mouse button down. */
BOOL m_bClearTypeTextQuality; /**< TRUE to enable ClearType text for the font. */
BOOL m_bRotateImageOnVerticalDraw; /**< TRUE to rotate image when tab located left or right. */
BOOL m_bClipHeader; /**< TRUE to select clip rectangle before draw tabs. */
CSize m_szNavigateButton; /**< Navigate buttons size. */
CSize m_szTabCloseButton; /**< Tab close button size. */
BOOL m_bShowTabs; /**< TRUE to show tabs. */
BOOL m_bMultiRowTabsOptimization; /**< TRUE if the tab manager will arrange tabs according to
their widths. TRUE by default. Otherwise plain ordering. */
int m_nMinTabWidth; /**< Minimum tabs width. */
int m_nMaxTabWidth; /**< Maximum tabs width. */
int m_nFixedTabWidth; /**< Tabs width for fixed layout. */
XTPTabToolTipBehaviour m_toolBehaviour; /**< Tootips behaviour. */
BOOL m_bVerticalTextTopToBottom; /**< Draw vertical text Top-to-Bottom or Bottom-to-Top. */
BOOL m_bPanelManager; /**< TRUE indicates that this is a panel manager, FALSE for tab manager.
*/
static DWORD m_nSelectOnDragOverDelay; /**< Delay before Select-on-Drag-Over (300 by default).
*/
protected:
CXTPTabPaintManagerTheme* m_pAppearanceSet; /**< Currently set CXTPTabPaintManagerTheme. */
CXTPTabPaintManagerColorSet* m_pColorSet; /**< Currently used CXTPTabPaintManagerColorSet. */
CArray m_arrObservers; /**< List of controls that
receive a notification when
a property of the paint
manager has changed. */
XTPTabAppearanceStyle m_tabAppearance; /**< Currently set appearance style. */
XTPTabColorStyle m_tabColor; /**< Currently used color style. */
XTPTabPosition m_tabPosition; /**< Currently set tab button position. The position refers to
where the tab buttons are located. The tab buttons can be
positioned on the top, bottom, left, or right side of the tab
client area. */
XTPTabLayoutStyle m_tabLayout; /**< Currently set tab button layout. The layout refers to how
the tab buttons are sized within the tab client header. */
CXTPFont m_xtpFontNormal; /**< Font used to display text in tab buttons. */
CXTPFont m_xtpFontBold; /**< Font used to display bold text in the tab buttons (i.e. when a tab
is selected and m_bBoldSelected = TRUE). */
CXTPFont m_xtpFontVerticalNormal; /**< Font used to display tab button caption when the tab
position is vertical. */
CXTPFont m_xtpFontVerticalBold; /**< Font used to display bold text in the tab buttons when the
tab position is vertical (i.e. when a tab is selected and
m_bBoldSelected = TRUE). */
XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fntNormal, m_xtpFontNormal, GetNormalFontHandle);
XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fntBold, m_xtpFontBold, GetBoldFontHandle);
XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fntVerticalNormal, m_xtpFontVerticalNormal,
GetVerticalNormalFontHandle);
XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fntVerticalBold, m_xtpFontVerticalBold,
GetVerticalBoldFontHandle);
BOOL m_bUseStandardFont; /**< TRUE to use standard system "icon" font (i.e. Tahoma 8pt). */
private:
int m_nItemColor;
friend class CXTPTabPaintManagerTheme;
friend class CXTPTabPaintManagerColorSet;
friend class CXTPTabManager;
# ifdef _XTP_ACTIVEX
/** @cond */
public:
afx_msg BOOL OleIsColorSupported(long nColor);
afx_msg LPDISPATCH OleGetClientMargin();
afx_msg LPDISPATCH OleGetControlMargin();
afx_msg LPDISPATCH OleGetHeaderMargin();
afx_msg LPDISPATCH OleGetButtonMargin();
afx_msg void OleSetFont(LPFONTDISP pFontDisp);
afx_msg LPFONTDISP OleGetFont();
afx_msg LPDISPATCH OleGetColorSet();
afx_msg void OleSetIconSize(long cx, long cy);
afx_msg void OleRefreshMetrics();
afx_msg void OnClearTypeTextQualityChanged();
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
DECLARE_OLETYPELIB_EX(CXTPTabPaintManager);
friend class CXTPTabPaintManagerMargin;
/** @endcond */
# endif
};
//////////////////////////////////////////////////////////////////////////
AFX_INLINE CFont* CXTPTabPaintManager::GetFont(BOOL bVertical)
{
return bVertical ? &m_xtpFontVerticalNormal : &m_xtpFontNormal;
}
AFX_INLINE CFont* CXTPTabPaintManager::GetBoldFont(BOOL bVertical)
{
return bVertical ? &m_xtpFontVerticalBold : &m_xtpFontBold;
}
AFX_INLINE CXTPTabPaintManagerTheme* CXTPTabPaintManager::GetAppearanceSet() const
{
return m_pAppearanceSet;
}
AFX_INLINE CXTPTabPaintManagerColorSet* CXTPTabPaintManager::GetColorSet() const
{
return m_pColorSet;
}
AFX_INLINE void CXTPTabPaintManager::EnableToolTips(XTPTabToolTipBehaviour behaviour)
{
m_toolBehaviour = behaviour;
}
# include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h"
/** @cond */
#endif // !defined(__XTPTABPAINTMANAGER_H__)
/** @endcond */