void OnToolLeftClick(wxCommandEvent& event);
void OnToolEnter(wxCommandEvent& event);
+ void OnCombo(wxCommandEvent& event);
+
private:
void DoEnablePrint();
void DoToggleHelp();
{
IDM_TOOLBAR_TOGGLETOOLBAR = 200,
IDM_TOOLBAR_ENABLEPRINT,
- IDM_TOOLBAR_TOGGLEHELP
+ IDM_TOOLBAR_TOGGLEHELP,
+
+ ID_COMBO = 1000
};
// ----------------------------------------------------------------------------
EVT_MENU(-1, MyFrame::OnToolLeftClick)
+ EVT_COMBOBOX(ID_COMBO, MyFrame::OnCombo)
+
EVT_TOOL_ENTER(ID_TOOLBAR, MyFrame::OnToolEnter)
END_EVENT_TABLE()
toolBar->AddTool(wxID_NEW, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "New file");
currentX += width + 5;
toolBar->AddTool(wxID_OPEN, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Open file");
+ currentX += width + 5;
+ toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Toggle button 1");
+
+ toolBar->AddSeparator();
+
+ wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO);
+ combo->Append("This");
+ combo->Append("is a");
+ combo->Append("combobox");
+ combo->Append("in a");
+ combo->Append("toolbar");
+ toolBar->AddControl(combo);
if ( !smallicons )
{
currentX += width + 5;
- toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Toggle button 1");
- currentX += width + 5;
- toolBar->AddSeparator();
toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Toggle button 2");
currentX += width + 5;
toolBar->AddTool(wxID_CUT, *(toolBarBitmaps[4]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Toggle/Untoggle help button");
toolBar->Realize();
// Can delete the bitmaps since they're reference counted
- int i, max = smallicons ? 2 : WXSIZEOF(toolBarBitmaps);
+ int i, max = smallicons ? 3 : WXSIZEOF(toolBarBitmaps);
for (i = 0; i < max; i++)
delete toolBarBitmaps[i];
}
}
+void MyFrame::OnCombo(wxCommandEvent& event)
+{
+ wxLogStatus(_T("Combobox string '%s' selected"), event.GetString().c_str());
+}
+
void MyFrame::DoEnablePrint()
{
wxToolBar *tb = GetToolBar();