X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a1f79c1e0064c7927ef4b8867acca5e061d1da67..4b37e99afcedd67292c24e93677a83b76dc6b625:/samples/toolbar/toolbar.cpp diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index df5e434c44..e115cb6be7 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -18,7 +18,7 @@ // ---------------------------------------------------------------------------- // For compilers that support precompilation, includes "wx/wx.h". -#include +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop @@ -31,6 +31,7 @@ #include #include #include +#include // define this to 1 to use wxToolBarSimple instead of the native one #define USE_GENERIC_TBAR 0 @@ -119,8 +120,6 @@ public: void OnUpdateCopyAndCut(wxUpdateUIEvent& event); - void OnToggleFullScreen(wxCommandEvent& event); - #if USE_GENERIC_TBAR virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, @@ -151,6 +150,8 @@ private: const int ID_TOOLBAR = 500; +static const long TOOLBAR_STYLE = wxNO_BORDER | wxTB_FLAT | wxTB_DOCKABLE; + enum { IDM_TOOLBAR_TOGGLETOOLBARSIZE = 200, @@ -160,7 +161,6 @@ enum IDM_TOOLBAR_DELETEPRINT, IDM_TOOLBAR_INSERTPRINT, IDM_TOOLBAR_TOGGLEHELP, - IDM_TOOLBAR_TOGGLEFULLSCREEN, IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR, IDM_TOOLBAR_CHANGE_TOOLTIP, @@ -190,7 +190,6 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(IDM_TOOLBAR_DELETEPRINT, MyFrame::OnDeletePrint) EVT_MENU(IDM_TOOLBAR_INSERTPRINT, MyFrame::OnInsertPrint) EVT_MENU(IDM_TOOLBAR_TOGGLEHELP, MyFrame::OnToggleHelp) - EVT_MENU(IDM_TOOLBAR_TOGGLEFULLSCREEN, MyFrame::OnToggleFullScreen) EVT_MENU(IDM_TOOLBAR_CHANGE_TOOLTIP, MyFrame::OnChangeToolTip) EVT_MENU(-1, MyFrame::OnToolLeftClick) @@ -239,11 +238,11 @@ void MyFrame::RecreateToolbar() SetToolBar(NULL); - long style = wxNO_BORDER | wxTB_FLAT | wxTB_DOCKABLE; + long style = TOOLBAR_STYLE; style |= m_horzToolbar ? wxTB_HORIZONTAL : wxTB_VERTICAL; toolBar = CreateToolBar(style, ID_TOOLBAR); - toolBar->SetMargins( 4, 4 ); + //toolBar->SetMargins( 4, 4 ); // Set up toolbar wxBitmap toolBarBitmaps[8]; @@ -294,16 +293,19 @@ void MyFrame::RecreateToolbar() toolBar->AddTool(wxID_OPEN, toolBarBitmaps[1], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Open file"); // neither the generic nor Motif native toolbars really support this -#if (wxUSE_TOOLBAR_NATIVE && !USE_GENERIC_TBAR) && !defined(__WXMOTIF__) +#if (wxUSE_TOOLBAR_NATIVE && !USE_GENERIC_TBAR) && !defined(__WXMOTIF__) && !defined(__WXX11__) // adding a combo to a vertical toolbar is not very smart if ( m_horzToolbar ) { - wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO); + wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, "", wxDefaultPosition, wxSize(200,-1) ); combo->Append("This"); combo->Append("is a"); combo->Append("combobox"); combo->Append("in a"); combo->Append("toolbar"); +/* + wxTextCtrl *combo = new wxTextCtrl( toolBar, -1, "", wxDefaultPosition, wxSize(80,-1) ); +*/ toolBar->AddControl(combo); } #endif // toolbars which don't support controls @@ -383,8 +385,6 @@ MyFrame::MyFrame(wxFrame* parent, tbarMenu->Append(IDM_TOOLBAR_TOGGLEHELP, "Toggle &help button\tCtrl-T", ""); tbarMenu->AppendSeparator(); tbarMenu->Append(IDM_TOOLBAR_CHANGE_TOOLTIP, "Change tool tip", ""); - tbarMenu->AppendSeparator(); - tbarMenu->Append(IDM_TOOLBAR_TOGGLEFULLSCREEN, "Toggle &full screen mode\tCtrl-F", ""); wxMenu *fileMenu = new wxMenu; fileMenu->Append(wxID_EXIT, "E&xit", "Quit toolbar sample" ); @@ -461,7 +461,7 @@ void MyFrame::OnToggleAnotherToolbar(wxCommandEvent& WXUNUSED(event)) { m_tbar = new wxToolBar(this, -1, wxDefaultPosition, wxDefaultSize, - wxTB_VERTICAL); + TOOLBAR_STYLE | wxTB_VERTICAL); m_tbar->AddTool(wxID_HELP, wxBITMAP(help), wxNullBitmap, FALSE, NULL, @@ -598,10 +598,3 @@ void MyFrame::OnToolEnter(wxCommandEvent& event) SetStatusText(""); } -void MyFrame::OnToggleFullScreen(wxCommandEvent& event) -{ -#ifdef __WXMSW__ - ShowFullScreen(!IsFullScreen()); -#endif -} -