]> 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 2c617aaba9f70f9a4af98f46e62ae32601e6480f..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()); }
@@ -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