[wxMSW 2.6.3] Toolbar layout problem
Lothar Behrens
lothar.behrens at lollisoft.de
Sat Apr 21 02:21:27 PDT 2007
Hi,
I have trouble creating a toolbar that fits it's size to their tool
buttons. The toolbar is always
as big as for 8 to 10 tools. So a second toolbar does not look nice
because of the space to
the first toolbar. I have no information how many toolbar buttons are
added, because the code
is in a helper DLL I use from other code.
The only way would be to store the list of tools in a separate list
and recreate the whole
toolbar by adding a new tool. Then I could calculate the size and
replace wxDefaultSize
with the calculated.
Is it possible to shrink the size (X) to the size of all added tools ?
Note: The toolbar size does correctly resize on Mac OS X.
Thanks, Lothar
wxToolBar* maintb;
#ifdef USE_WXAUI
maintb = (wxToolBar*) m_mgr.GetPane("Main Toolbar").window;
if (maintb == NULL) {
maintb = new wxToolBar(this, wxID_ANY, wxDefaultPosition,
wxDefaultSize, wxTB_HORIZONTAL);
wxImage::AddHandler(new wxXPMHandler);
wxImage::AddHandler(new wxPNGHandler);
maintb->SetToolBitmapSize(wxSize(32, 32));
wxImage* im;
im = new wxImage("exit.png", wxBITMAP_TYPE_PNG);
wxBitmap bm = wxBitmap(im);
maintb->AddTool(DYNAMIC_QUIT, bm, _trans("Exit"));
maintb->Realize();
maintb->Fit(); // <-- Doesn't help
SetToolBar(maintb);
m_mgr.AddPane(maintb, wxPaneInfo().
Name(wxT("Main Toolbar")).Caption(wxT("Main
Toolbar")).
ToolbarPane().Top().
LeftDockable(false).RightDockable(false));
m_mgr.Update();
}
#endif
More information about the wx-users
mailing list