The BCGControlBar Library framework supports Outlook-style shortcut control bars. You can use these bars to enhance workspace management in your application.
The shortcuts bar has the following elements:
- Caption - displays the currently selected page name
- Page with shortcut buttons or embedded control
- Splitter between page and page buttons
- Page buttons with a page name and icon on left
- Bottom-located toolbar with page small icons and options menu
The functionality of "outlook" control bars is provided by CBCGPOutlookBar class. To use this class please perform the following steps:
- Add outlook page large icons list to your application resources (the
suggested icon size is 24x24). For example, the resource ID will be
IDB_PAGES.
- Add outlook page small icons list (will be displayed on
the bottom-located toolbar) to your application resources (the suggested
icon size is 16x16). For example, the resource ID will be IDB_PAGES_SMALL.
-
Prepare icons for each shortcut (IDI_SHORTCUT1, IDI_SHORTCUT1, ...).
- Add
the following members to your CMainFrame class:
CBCGPOutlookBar m_wndShortcutsBar;
CBCGPOutlookBarPane m_wndShortcutsPane1;
CBCGPOutlookBarPane m_wndShortcutsPane2;
- Initialize the shortcuts bar in CMainFrame::OnCreate by the following way:
CBCGPOutlookWnd::EnableAnimation();
const int nWidth = 150;
const CString strCaption = _T("Shortcuts");
m_wndShortcutsBar.SetMode2003();
if (!m_wndShortcutsBar.Create(
strCaption,
this,
CRect(0, 0, nWidth, nWidth),
ID_VIEW_OUTLOOKBAR,
WS_CHILD | WS_VISIBLE | CBRS_LEFT))
{
TRACE0("Failed to create the bar\n");
return FALSE; // fail to create
}
CBCGPOutlookWnd* pContainer =
DYNAMIC_DOWNCAST(CBCGPOutlookWnd,
m_wndShortcutsBar.GetUnderlinedWindow());
if (pContainer == NULL)
{
TRACE0("Cannot get container\n");
return FALSE;
}
pContainer->SetImageList(
IDB_PAGES, 24);
pContainer->SetToolbarImageList(
IDB_PAGES_SMALL, 16);
// Create first page:
m_wndShortcutsPane1.Create(
&m_wndShortcutsBar,
dwDefaultToolbarStyle,
ID_SHORTCUTS_PANE_1);
m_wndShortcutsPane1.SetOwner(this);
m_wndShortcutsPane1.EnableTextLabels();
m_wndShortcutsPane1.EnableDocking(
CBRS_ALIGN_ANY);
m_wndShortcutsPane1.AddButton(
theApp.LoadIcon(IDI_SHORTCUT1),
_T("Shortcut 1"),
ID_SHORTCUT_1);
m_wndShortcutsPane1.AddButton(
theApp.LoadIcon(IDI_SHORTCUT2),
_T("Shortcut 2"),
ID_SHORTCUT_2);
pContainer->AddTab(
&m_wndShortcutsPane1,
_T("Page 1"),
0,
FALSE);
m_wndShortcutsPane1.EnableDocking(
CBRS_ALIGN_ANY);
// Create second page:
m_wndShortcutsPane2.Create(
&m_wndShortcutsBar,
dwDefaultToolbarStyle,
ID_SHORTCUTS_PANE_2);
m_wndShortcutsPane2.SetOwner(this);
m_wndShortcutsPane2.EnableTextLabels();
m_wndShortcutsPane2.EnableDocking(
CBRS_ALIGN_ANY);
m_wndShortcutsPane2.AddButton(
theApp.LoadIcon(IDI_SHORTCUT3),
_T("Shortcut 3"),
ID_SHORTCUT_3);
m_wndShortcutsPane2.AddButton(
theApp.LoadIcon(IDI_SHORTCUT4),
_T("Shortcut 4"),
ID_SHORTCUT_4);
pContainer->AddTab(
&m_wndShortcutsPane2,
_T("Page 2"), 1, FALSE);
Back to the Developer Area