]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/menu/menu.cpp
Make expat's configure detect if -ext o is needed (MW) so tests work correctly.
[wxWidgets.git] / samples / menu / menu.cpp
index 2949b68133ceb9a83bb92104b52cb2affa42a4e8..e8e5bd4eb18ddbabaa93f54db317b7f3a1bd181b 100644 (file)
@@ -125,8 +125,7 @@ protected:
     void OnUpdateSubMenuRadio(wxUpdateUIEvent& event);
 
 #if USE_CONTEXT_MENU
-    void OnContextMenu(wxContextMenuEvent& event)
-        { ShowContextMenu(ScreenToClient(event.GetPosition())); }
+    void OnContextMenu(wxContextMenuEvent& event);
 #else
     void OnRightUp(wxMouseEvent& event)
         { ShowContextMenu(event.GetPosition()); }
@@ -416,9 +415,9 @@ MyFrame::MyFrame()
     wxMenu* subMenu = new wxMenu;
     subMenu->Append(Menu_SubMenu_Normal, _T("&Normal submenu item"), _T("Disabled submenu item"));
     subMenu->AppendCheckItem(Menu_SubMenu_Check, _T("&Unchecked submenu item"), _T("Unchecked submenu item"));
-    subMenu->AppendRadioItem(Menu_SubMenu_Radio1, _T("&Radio item 1"), _T("Radio item"));
-    subMenu->AppendRadioItem(Menu_SubMenu_Radio2, _T("&Radio item 2"), _T("Radio item"));
-    subMenu->AppendRadioItem(Menu_SubMenu_Radio3, _T("&Radio item 3"), _T("Radio item"));
+    subMenu->AppendRadioItem(Menu_SubMenu_Radio1, _T("Radio item &1"), _T("Radio item"));
+    subMenu->AppendRadioItem(Menu_SubMenu_Radio2, _T("Radio item &2"), _T("Radio item"));
+    subMenu->AppendRadioItem(Menu_SubMenu_Radio3, _T("Radio item &3"), _T("Radio item"));
 
     menubarMenu->Append(Menu_SubMenu, _T("Submenu"), subMenu);
 
@@ -1000,6 +999,22 @@ void MyFrame::OnUpdateSubMenuRadio(wxUpdateUIEvent& event)
         event.Check(false);
 }
 
+#if USE_CONTEXT_MENU
+void MyFrame::OnContextMenu(wxContextMenuEvent& event)
+{
+    wxPoint point = event.GetPosition();
+    // If from keyboard
+    if (point.x == -1 && point.y == -1) {
+        wxSize size = GetSize();
+        point.x = size.x / 2;
+        point.y = size.y / 2;
+    } else {
+        point = ScreenToClient(point);
+    }
+    ShowContextMenu(point);
+}
+#endif
+
 void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event))
 {
 #if USE_LOG_WINDOW