X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bc2ec626ea6114fdafb18da7752be495088b8832..c4e2838090992384911a6a6aa44cac985d79a555:/samples/toolbar/toolbar.cpp diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index c13dc5050e..747a49f142 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -119,6 +119,7 @@ public: void OnToolbarStyle(wxCommandEvent& event); void OnToolLeftClick(wxCommandEvent& event); + void OnToolRightClick(wxCommandEvent& event); void OnToolEnter(wxCommandEvent& event); void OnCombo(wxCommandEvent& event); @@ -228,6 +229,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_COMBOBOX(ID_COMBO, MyFrame::OnCombo) EVT_TOOL_ENTER(ID_TOOLBAR, MyFrame::OnToolEnter) + EVT_TOOL_RCLICKED(wxID_ANY, MyFrame::OnToolRightClick) EVT_UPDATE_UI(wxID_COPY, MyFrame::OnUpdateCopyAndCut) EVT_UPDATE_UI(wxID_CUT, MyFrame::OnUpdateCopyAndCut) @@ -265,7 +267,7 @@ bool MyApp::OnInit() frame->Show(true); -#ifndef __SMARTPHONE__ +#if wxUSE_STATUSBAR frame->SetStatusText(_T("Hello, wxWidgets")); #endif @@ -279,7 +281,7 @@ void MyFrame::RecreateToolbar() #ifdef __WXWINCE__ // On Windows CE, we should not delete the // previous toolbar in case it contains the menubar. - // We'll try to accomodate this usage in due course. + // We'll try to accommodate this usage in due course. wxToolBar* toolBar = CreateToolBar(); #else // delete and recreate the toolbar @@ -343,7 +345,7 @@ void MyFrame::RecreateToolbar() // adding a combo to a vertical toolbar is not very smart if ( m_horzToolbar ) { - wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, _T(""), wxDefaultPosition, wxSize(200,wxDefaultSize.y) ); + wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, _T(""), wxDefaultPosition, wxSize(200,wxDefaultCoord) ); combo->Append(_T("This")); combo->Append(_T("is a")); combo->Append(_T("combobox")); @@ -389,7 +391,7 @@ MyFrame::MyFrame(wxFrame* parent, m_rows = 1; m_nPrint = 1; -#ifndef __SMARTPHONE__ +#if wxUSE_STATUSBAR // Give it a status line CreateStatusBar(); #endif @@ -483,7 +485,7 @@ void MyFrame::LayoutChildren() int offset; if ( m_tbar ) { - m_tbar->SetSize(wxDefaultSize.x, size.y); + m_tbar->SetSize(wxDefaultCoord, size.y); m_tbar->Move(0, 0); offset = m_tbar->GetSize().x; @@ -623,6 +625,13 @@ void MyFrame::OnToolLeftClick(wxCommandEvent& event) } } +void MyFrame::OnToolRightClick(wxCommandEvent& event) +{ + m_textWindow->AppendText( + wxString::Format(_T("Tool %d right clicked.\n"), + (int) event.GetInt())); +} + void MyFrame::OnCombo(wxCommandEvent& event) { wxLogStatus(_T("Combobox string '%s' selected"), event.GetString().c_str()); @@ -711,7 +720,7 @@ void MyFrame::OnInsertPrint(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnToolEnter(wxCommandEvent& event) { -#ifndef __SMARTPHONE__ +#if wxUSE_STATUSBAR if (event.GetSelection() > -1) { wxString str; @@ -720,7 +729,9 @@ void MyFrame::OnToolEnter(wxCommandEvent& event) } else SetStatusText(_T("")); -#endif +#else + wxUnusedVar(event); +#endif // wxUSE_STATUSBAR } void MyFrame::OnToggleRadioBtn(wxCommandEvent& event)