The multi row layout toolbars we advised you in our previous answer do not support user defined row wrapping. The multi row layout toolbars are toolbars which are using layout and behavior of menu bar. So, you need another solution. Fortunately it exists and it’s also based on the toolbar control.
Please take a look at the CMainFrame::m_wndPalette
window in the DRAWCLI sample application. This is the dockable CExtToolControlBar
toolbar control switched into the palette mode. The toolbars in palette mode support independent button layout in horizontally docked, vertically docked and floating states. In each state, the layout of buttons in such palette toolbar is organized into rows. The last button in each row is marked with the wrap flag. Here is how the toolbar control in palette mode is initialized in the CMainFrame::OnCreate()
method of the DRAWCLI sample application:
m_wndPalette.m_bPaletteMode = true;
if( !m_wndPalette.Create(
NULL,
this,
ID_VIEW_PALETTE
)
||
!m_wndPalette.LoadToolBar(IDR_TOOLBAR_HELPER_ICONS)
)
{
TRACE0("Failed to create m_wndPalette toolbar\n");
return -1; // fail to create
}
m_wndPalette.InsertButton();
nBtnIdx = m_wndPalette.GetButtonsCount();
m_pBtnColorFillP =
new CExtBarColorButton(
&m_wndPalette,
ID_OBJECT_FILLCOLOR, 0, COLORREF(-1), RGB(0,0,0),
ID_OBJECT_FILLCOLOR, true, true,
(LPCTSTR)sNoFill, NULL,
CExtBarColorButton::__DIT_CHAR_2007
);
m_pBtnColorFillP->SetSeparatedDropDown();
VERIFY(
m_wndPalette.InsertSpecButton(
nBtnIdx,
m_pBtnColorFillP,
FALSE
)
);
nBtnIdx++;
m_pBtnColorOutlineP =
new CExtBarColorButton(
&m_wndPalette,
ID_OBJECT_LINECOLOR, 0, COLORREF(-1), RGB(0,0,0),
ID_OBJECT_LINECOLOR, true, true,
(LPCTSTR)sNoOutline, NULL,
CExtBarColorButton::__DIT_FRAME
);
VERIFY(
m_wndPalette.InsertSpecButton(
nBtnIdx,
m_pBtnColorOutlineP,
FALSE
)
);
m_wndPalette.GetButton( 3 )->SetWrap( CExtBarButton::__EVT_HORZ );
m_wndPalette.GetButton( 8 )->SetWrap( CExtBarButton::__EVT_HORZ );
m_wndPalette.GetButton( 14 )->SetWrap( CExtBarButton::__EVT_HORZ );
m_wndPalette.GetButton( 3 )->SetWrap( CExtBarButton::__EVT_VERT );
m_wndPalette.GetButton( 6 )->SetWrap( CExtBarButton::__EVT_VERT );
m_wndPalette.GetButton( 9 )->SetWrap( CExtBarButton::__EVT_VERT );
m_wndPalette.GetButton( 12 )->SetWrap( CExtBarButton::__EVT_VERT );
m_wndPalette.GetButton( 14 )->SetWrap( CExtBarButton::__EVT_VERT );
m_wndPalette.GetButton( 3 )->SetWrap( CExtBarButton::__EVT_FLOAT );
m_wndPalette.GetButton( 5 )->SetWrap( CExtBarButton::__EVT_FLOAT );
m_wndPalette.GetButton( 7 )->SetWrap( CExtBarButton::__EVT_FLOAT );
m_wndPalette.GetButton( 9 )->SetWrap( CExtBarButton::__EVT_FLOAT );
m_wndPalette.GetButton( 11 )->SetWrap( CExtBarButton::__EVT_FLOAT );
m_wndPalette.GetButton( 14 )->SetWrap( CExtBarButton::__EVT_FLOAT );
You can just create a non-dockable toolbar with palette mode as a child of a resizable control bar.
Even more, a toolbar control in palette mode supports separator buttons which automatically look like horizontal or vertical separators depending on the palette toolbar layout. You can see such separators in the palette mode toolbar in
DRAWCLI sample application. You can use these separators to for highlighting differences between group of buttons displayed on your schematic screen shots.
Please note, the toolbar buttons are based on the command identifiers registered in the command manager. So, you may need to allocate required number of command identifiers in the command manager using the
g_CmdManager->CmdAllocPtr()
code (the
CExtCmdManager::CmdAllocPtr()
method) before inserting them into your palette toolbar as palette items.
The
CMainFrame::m_wndPalette
window in the
DRAWCLI sample application is initialized via loading set of buttons from the toolbar resource. Then the set of code lines like
m_wndPalette.GetButton( . . . ) -> SetWrap( . . . )
is invoked for assigning wrapping flags to toolbar buttons. You will need to initialize toolbar with buttons manually using the
CExtToolControlBar::InsertButton()
method and specifying pre-allocated in the command manager identifier in parameters.
If you have any difficulties with this task, please let us know.