controls can now be put in the toolbars (MSW only so far, preliminary version)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4478 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-11-12 02:17:44 +00:00
parent 7c74e7fe1d
commit 1c383dbac9
6 changed files with 790 additions and 538 deletions

View File

@@ -85,6 +85,8 @@ public:
void OnToolLeftClick(wxCommandEvent& event);
void OnToolEnter(wxCommandEvent& event);
void OnCombo(wxCommandEvent& event);
private:
void DoEnablePrint();
void DoToggleHelp();
@@ -105,7 +107,9 @@ enum
{
IDM_TOOLBAR_TOGGLETOOLBAR = 200,
IDM_TOOLBAR_ENABLEPRINT,
IDM_TOOLBAR_TOGGLEHELP
IDM_TOOLBAR_TOGGLEHELP,
ID_COMBO = 1000
};
// ----------------------------------------------------------------------------
@@ -125,6 +129,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(-1, MyFrame::OnToolLeftClick)
EVT_COMBOBOX(ID_COMBO, MyFrame::OnCombo)
EVT_TOOL_ENTER(ID_TOOLBAR, MyFrame::OnToolEnter)
END_EVENT_TABLE()
@@ -205,9 +211,19 @@ bool MyApp::InitToolbar(wxToolBar* toolBar, bool smallicons)
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");
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 )
{
toolBar->AddSeparator();
currentX += width + 5;
toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Toggle button 1");
currentX += width + 5;
@@ -343,6 +359,11 @@ void MyFrame::OnToolLeftClick(wxCommandEvent& event)
}
}
void MyFrame::OnCombo(wxCommandEvent& event)
{
wxLogStatus(_T("Combobox string '%s' selected"), event.GetString().c_str());
}
void MyFrame::DoEnablePrint()
{
wxToolBar *tb = GetToolBar();