Edit

Share via


CMFCBaseVisualManager Class

A layer between derived visual managers and the Windows Theme API.

CMFCBaseVisualManager loads UxTheme.dll, if available, and manages access to Windows Theme API methods.

This class is for internal use only.

Syntax

class CMFCBaseVisualManager: public CObject

Members

Public Constructors

Name Description
CMFCBaseVisualManager::CMFCBaseVisualManager Constructs and initializes a CMFCBaseVisualManager object.
CMFCBaseVisualManager::~CMFCBaseVisualManager Destructor.

Public Methods

Name Description
CMFCBaseVisualManager::DrawCheckBox Draws a check box control by using the current Windows theme.
CMFCBaseVisualManager::DrawComboBorder Draws a combo box border using the current Windows theme.
CMFCBaseVisualManager::DrawComboDropButton Draws a combo box drop-down button using the current Windows theme.
CMFCBaseVisualManager::DrawPushButton Draws a push button using the current Windows theme.
CMFCBaseVisualManager::DrawRadioButton Draws a radio button control by using the current Windows theme.
CMFCBaseVisualManager::DrawStatusBarProgress Draws a progress bar on a status bar control ( CMFCStatusBar Class) using the current Windows theme.
CMFCBaseVisualManager::FillReBarPane Fills the background of the rebar control by using the current Windows theme.
CMFCBaseVisualManager::GetStandardWindowsTheme Gets the current Windows theme.

Protected Methods

Name Description
CMFCBaseVisualManager::CleanUpThemes Calls CloseThemeData for all handles obtained in UpdateSystemColors.
CMFCBaseVisualManager::UpdateSystemColors Calls OpenThemeData to obtain handles for drawing various controls: windows, toolbars, buttons, and so on.

Remarks

You do not have to instantiate objects of this class directly.

Because it is a base class for all visual managers, you can just call CMFCVisualManager::GetInstance, obtain a pointer to the current Visual Manager, and access the methods for CMFCBaseVisualManager using that pointer. However, if you have to display a control by using the current Windows theme, it is better to use the CMFCVisualManagerWindows interface.

Inheritance Hierarchy

CObject

CMFCBaseVisualManager

Requirements

Header: afxvisualmanager.h

CMFCBaseVisualManager::CleanUpThemes

Calls CloseThemeData for all handles obtained in UpdateSystemColors.

void CleanUpThemes();

Remarks

For internal use only.

CMFCBaseVisualManager::CMFCBaseVisualManager

Constructs and initializes a CMFCBaseVisualManager object.

CMFCBaseVisualManager();

CMFCBaseVisualManager::DrawCheckBox

Draws a check box control by using the current Windows theme.

virtual BOOL DrawCheckBox(
    CDC* pDC,
    CRect rect,
    BOOL bHighlighted,
    int nState,
    BOOL bEnabled,
    BOOL bPressed);

);

Parameters

pDC
[in] A pointer to a device context

rect
[in] The bounding rectangle of the check box.

bHighlighted
[in] Specifies whether the check box is highlighted.

nState
[in] 0 for unchecked, 1 for checked normal,

2 for mixed normal.

bEnabled
[in] Specifies whether the check box is enabled.

bPressed
[in] Specifies whether the check box is pressed.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

Remarks

The values of nState correspond to the following check box styles.

nState Check box style
0 CBS_UNCHECKEDNORMAL
1 CBS_CHECKEDNORMAL
2 CBS_MIXEDNORMAL

CMFCBaseVisualManager::DrawComboBorder

Draws the combo box border using the current Windows theme.

virtual BOOL DrawComboBorder(
    CDC* pDC,
    CRect rect,
    BOOL bDisabled,
    BOOL bIsDropped,
    BOOL bIsHighlighted);

Parameters

pDC
[in] A pointer to a device context.

rect
[in] Bounding rectangle of the combo box border.

bDisabled
[in] Specifies whether the combo box border is disabled.

bIsDropped
[in] Specifies whether the combo box border is dropped down.

bIsHighlighted
[in] Specifies whether the combo box border is highlighted.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

CMFCBaseVisualManager::DrawComboDropButton

Draws a combo box drop-down button using the current Windows theme.

virtual BOOL DrawComboDropButton(
    CDC* pDC,
    CRect rect,
    BOOL bDisabled,
    BOOL bIsDropped,
    BOOL bIsHighlighted);

Parameters

pDC
[in] A pointer to a device context.

rect
[in] The bounding rectangle of the combo box drop-down button.

bDisabled
[in] Specifies whether the combo box drop-down button is disabled.

bIsDropped
[in] Specifies whether the combo box drop-down button is dropped down.

bIsHighlighted
[in] Specifies whether the combo box drop-down button is highlighted.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

CMFCBaseVisualManager::DrawPushButton

Draws a push button using the current Windows theme.

virtual BOOL DrawPushButton(
    CDC* pDC,
    CRect rect,
    CMFCButton* pButton,
    UINT uiState);

Parameters

pDC
[in] A pointer to a device context.

rect
[in] The bounding rectangle of the push button.

pButton
[in] A pointer to the CMFCButton Class object to draw.

uiState
[in] Ignored. The state is taken from pButton.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

CMFCBaseVisualManager::DrawRadioButton

Draws a radio button control by using the current Windows theme.

virtual BOOL DrawRadioButton(
    CDC* pDC,
    CRect rect,
    BOOL bHighlighted,
    BOOL bChecked,
    BOOL bEnabled,
    BOOL bPressed);

Parameters

pDC
[in] A pointer to a device context.

rect
[in] The bounding rectangle of the radio button.

bHighlighted
[in] Specifies whether the radio button is highlighted.

bChecked
[in] Specifies whether the radio button is checked.

bEnabled
[in] Specifies whether the radio button is enabled.

bPressed
[in] Specifies whether the radio button is pressed.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

CMFCBaseVisualManager::DrawStatusBarProgress

Draws progress bar on status bar control ( CMFCStatusBar Class) using the current Windows theme.

virtual BOOL DrawStatusBarProgress(
    CDC* pDC,
    CMFCStatusBar* pStatusBar,
    CRect rectProgress,
    int nProgressTotal,
    int nProgressCurr,
    COLORREF clrBar,
    COLORREF clrProgressBarDest,
    COLORREF clrProgressText,
    BOOL bProgressText);

Parameters

pDC
[in] A pointer to a device context.

pStatusBar
[in] A pointer to status bar. This value is ignored.

rectProgress
[in] The bounding rectangle of the progress bar in pDC coordinates.

nProgressTotal
[in] The total progress value.

nProgressCurr
[in] The current progress value.

clrBar
[in] The start color. CMFCBaseVisualManager ignores this. Derived classes can use it for color gradients.

clrProgressBarDest
[in] The end color. CMFCBaseVisualManager ignores this. Derived classes can use it for color gradients.

clrProgressText
[in] Progress text color. CMFCBaseVisualManager ignores this. The text color is defined by afxGlobalData.clrBtnText.

bProgressText
[in] Specifies whether to display progress text.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

CMFCBaseVisualManager::FillReBarPane

Fills the background of the rebar control by using the current Windows theme.

virtual void FillReBarPane(
    CDC* pDC,
    CBasePane* pBar,
    CRect rectClient);

Parameters

pDC
[in] A pointer to a device context.

pBar
[in] A pointer to a pane whose background should be drawn.

rectClient
[in] The bounding rectangle of the area to be filled.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

CMFCBaseVisualManager::GetStandardWindowsTheme

Gets the current Windows theme.

virtual WinXpTheme GetStandardWindowsTheme();

Return Value

The currently selected Windows Theme color. Can be one of the following enumerated values:

  • WinXpTheme_None - there is no theme enabled.

  • WinXpTheme_NonStandard - non standard theme is selected (meaning a theme is selected, but none from the list below).

  • WinXpTheme_Blue - blue theme (Luna).

  • WinXpTheme_Olive - olive theme.

  • WinXpTheme_Silver - silver theme.

CMFCBaseVisualManager::UpdateSystemColors

Calls OpenThemeData to obtain handles for drawing various controls: windows, toolbars, buttons, and so on.

void UpdateSystemColors();

Remarks

For internal use only.

See also

Hierarchy Chart
Classes