I added a wxToolBar into a wxPanel using wxSizer, and it works fine. Then I add some separator between buttons, but there is only a gap between buttons, no a vertical line that I expected.
My code is as follows:
Code: Select all
void MyPanel::CreateGuiControls()
{
CreateToolbar();
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
SetSizer(sizer);
SetAutoLayout(true);
// create and add tool bar
sizer->Add(CreateToolbar(), 0, wxALIGN_LEFT | wxGROW);
// create packet list control
sizer->Add(CreatePacketListCtrl(), 5, wxEXPAND);
}
wxToolBar* MyPanel::CreateToolbar()
{
wxToolBar* toolBar = new wxToolBar(this, wxID_ANY);
long style = wxTB_FLAT | wxTB_NODIVIDER /*| wxTB_HORZ_LAYOUT*/;
toolBar->SetWindowStyle(style);
WXBITMAP(bmpBack, _T("res/dissect_back.png"), wxBITMAP_TYPE_PNG);
WXBITMAP(bmpForward, _T("res/disscet_forward.png"), wxBITMAP_TYPE_PNG);
WXBITMAP(bmpTree, _T("res/dissect_tree.png"), wxBITMAP_TYPE_PNG);
WXBITMAP(bmpHex, _T("res/dissect_hex.png"), wxBITMAP_TYPE_PNG);
int w = bmpBack.GetWidth();
int h = bmpBack.GetHeight();
toolBar->SetToolBitmapSize(wxSize(w, h));
toolBar->SetToolPacking(5);
// navigate button
toolBar->AddTool(1, _("Back"), bmpBack, wxNullBitmap, wxITEM_NORMAL, _("Go back"));
toolBar->AddTool(2, _("Forward"), bmpForward, wxNullBitmap, wxITEM_NORMAL, _("Go gorward"));
toolBar->AddSeparator();
toolBar->AddTool(3, _("Tree View"), bmpTree, wxNullBitmap, wxITEM_CHECK, _("Show tree view"));
toolBar->AddTool(4, _("Hex View"), bmpHex, wxNullBitmap, wxITEM_CHECK, _("Show hex view"));
toolBar->Realize();
return toolBar;
}
Any suggestion? Thanks in advance!
Andrew