X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7a9763046b9f7b99399d5538d204b3d8c03bbc2e..e960c20e389061c0db09e03fdaf9ffe3a418779b:/samples/toolbar/toolbar.cpp diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index 4f983764ec..8812040c03 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -32,6 +32,8 @@ #include "wx/log.h" #include "wx/image.h" #include "wx/filedlg.h" +#include "wx/spinctrl.h" +#include "wx/srchctrl.h" // define this to use XPMs everywhere (by default, BMPs are used under Win) // BMPs use less space, but aren't compiled into the executable on other platforms @@ -267,6 +269,9 @@ IMPLEMENT_APP(MyApp) // main frame bool MyApp::OnInit() { + if ( !wxApp::OnInit() ) + return false; + // Create the main frame window MyFrame* frame = new MyFrame((wxFrame *) NULL, wxID_ANY, _T("wxToolBar Sample"), @@ -391,7 +396,7 @@ void MyFrame::RecreateToolbar() // adding a combo to a vertical toolbar is not very smart if ( !( toolBar->IsVertical() ) ) { - wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, wxEmptyString, wxDefaultPosition, wxSize(200,wxDefaultCoord) ); + wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, wxEmptyString, wxDefaultPosition, wxSize(100,-1) ); combo->Append(_T("This")); combo->Append(_T("is a")); combo->Append(_T("combobox")); @@ -399,8 +404,14 @@ void MyFrame::RecreateToolbar() combo->Append(_T("toolbar")); toolBar->AddControl(combo); - //wxSpinCtrl *spin = new wxSpinCtrl( toolBar, ID_SPIN, wxT("0"), wxDefaultPosition, wxSize(80,wxDefaultCoord), 0, 100, 0 ); - //toolBar->AddControl( spin ); + wxSpinCtrl *spin = new wxSpinCtrl( toolBar, ID_SPIN, wxT("0"), wxDefaultPosition, wxSize(80,wxDefaultCoord), 0, 0, 100 ); + toolBar->AddControl( spin ); + + wxTextCtrl *text = new wxTextCtrl( toolBar, -1, wxT("text"), wxDefaultPosition, wxSize(80,wxDefaultCoord) ); + toolBar->AddControl( text ); + + wxSearchCtrl *srch = new wxSearchCtrl( toolBar, -1, wxT("xx"), wxDefaultPosition, wxSize(80,wxDefaultCoord), wxSUNKEN_BORDER ); + toolBar->AddControl( srch ); } #endif // toolbars which don't support controls @@ -575,19 +586,6 @@ MyFrame::MyFrame(wxFrame* parent, m_textWindow = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); } -#if USE_GENERIC_TBAR - -wxToolBar* MyFrame::OnCreateToolBar(long style, - wxWindowID id, - const wxString& name) -{ - return (wxToolBar *)new wxToolBarSimple(this, id, - wxDefaultPosition, wxDefaultSize, - style, name); -} - -#endif // USE_GENERIC_TBAR - void MyFrame::LayoutChildren() { wxSize size = GetClientSize();