|
BCGControlBar Library framework allows you to create various application
"skins" and easily change the look and feel of user-interface elements.
On the picture below you can see a screenshot taken from the "BCGSkins"
example:

The framework maintains a global object of CBCGVisualManager
class, that by default draws the following GUI elements:
- bar borders (OnDrawBarBorder)
- bar grippers (OnDrawBarGripper)
- button borders (OnDrawButtonBorder)
- caption buttons (OnDrawCaptionButton)
- menu borders (OnDrawMenuBorder)
- separators (OnDrawSeparator)
- fills bar background (OnFillBarBackground)
- fills button interior (OnFillButtonInterior)
- highlights menu items (OnHighlightMenuItem)
Each element is displayed by separate virtual function.
To implement your own skin you should perform the following steps:
- Derive your own class from the CBCGVisualManager
class.
- For each GUI element whose appearance you want to customize override the
relevant drawing function.
- CBCGVisualManager object is a singleton. When you want to
instantiate a visual manager object, you should delete the previous
instance. Use the CBCGVisualManager::GetInstance
static function to get access to the current instance.
The following example shows how to switch between default and custom visual
managers:
void
CBCGSkinsApp::SetSkin (int iIndex)
{
if
(CBCGVisualManager::GetInstance () != NULL)
{
delete
CBCGVisualManager::GetInstance ();
}
switch (iIndex)
{
case
DEFAULT_STYLE:
CBCGVisualManager::GetInstance ();
break;
case MAC_STYLE:
new
CMacStyle ();
break;
}
CBCGVisualManager::GetInstance ()->SetLook2000
();
CBCGVisualManager::GetInstance ()->RedrawAll
();
}
|
Back to the Developer Area
|