X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/422d0ff0bec79832494fe4605ffdcf8e87ba6c03..9149aa8c961e1bfccc159526eeee5dc089eaf906:/samples/toolbar/toolbar.cpp

diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp
index ddc516aa7d..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)
@@ -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
@@ -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());