]> git.saurik.com Git - wxWidgets.git/commitdiff
Moved the popup menu event handlers to dialog event handler
authorJulian Smart <julian@anthemion.co.uk>
Fri, 18 Jan 2002 11:50:14 +0000 (11:50 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 18 Jan 2002 11:50:14 +0000 (11:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

utils/dialoged/src/dialoged.cpp
utils/dialoged/src/dialoged.h
utils/dialoged/src/dlghndlr.cpp
utils/dialoged/src/dlghndlr.h
utils/dialoged/src/reseditr.cpp

index eb015a49d65fff03d59a91c21d2a0c02e63a3fc2..3485d5dae506c420de549810cd6430ac9cba9862 100644 (file)
@@ -32,8 +32,6 @@
 IMPLEMENT_APP(MyApp)
 
 BEGIN_EVENT_TABLE(MyApp, wxApp)
-EVT_MENU(OBJECT_MENU_EDIT, MyApp::OnObjectPopupMenu)
-EVT_MENU(OBJECT_MENU_DELETE, MyApp::OnObjectPopupMenu)
 END_EVENT_TABLE()
 
 MyApp::MyApp(void)
index 458733bc17c6d300947f586546086dae46a078ed..7c9770730f59a25088476dd4a92c04436a342b01 100644 (file)
@@ -19,8 +19,6 @@
 #include "wx/proplist.h"
 #include "reseditr.h"
 
-extern void ObjectMenuProc(wxMenu *menu, wxCommandEvent& event);
-
 class MyChild;
 
 // Define a new application
@@ -31,11 +29,6 @@ public:
     bool OnInit(void);
     int OnExit(void);
     
-    void OnObjectPopupMenu(wxCommandEvent& event)
-    {
-        ObjectMenuProc((wxMenu *)event.GetEventObject(), event);
-    }
-    
 private:
     DECLARE_EVENT_TABLE()
 };
index 2be4b234f2b6894b683acbca2a2d82b737d16a22..f6d33587123ff1a50541b401db742538fcbc84e6 100644 (file)
@@ -42,6 +42,8 @@ BEGIN_EVENT_TABLE(wxResourceEditorDialogHandler, wxEvtHandler)
 EVT_PAINT(wxResourceEditorDialogHandler::OnPaint)
 EVT_MOUSE_EVENTS(wxResourceEditorDialogHandler::OnMouseEvent)
 EVT_SIZE(wxResourceEditorDialogHandler::OnSize)
+EVT_MENU(OBJECT_MENU_EDIT, wxResourceEditorDialogHandler::OnObjectEdit)
+EVT_MENU(OBJECT_MENU_DELETE, wxResourceEditorDialogHandler::OnObjectDelete)
 END_EVENT_TABLE()
 
 BEGIN_EVENT_TABLE(wxResourceEditorControlHandler, wxEvtHandler)
@@ -867,6 +869,43 @@ void wxResourceEditorDialogHandler::OnDragEnd(int x, int y, int WXUNUSED(keys),
 
 }  // wxResourceEditorDialogHandler::OnDragEnd()
 
+void wxResourceEditorDialogHandler::OnObjectEdit(wxCommandEvent& event)
+{
+       wxMenu* menu = (wxMenu*) event.GetEventObject();
+
+    wxWindow *data = (wxWindow *)menu->GetClientData();
+    if (!data)
+        return;
+    
+    wxResourceManager::GetCurrentResourceManager()->EditWindow(data);
+}
+
+void wxResourceEditorDialogHandler::OnObjectDelete(wxCommandEvent& event)
+{
+       wxMenu* menu = (wxMenu*) event.GetEventObject();
+
+    wxWindow *data = (wxWindow *)menu->GetClientData();
+    if (!data)
+        return;
+    
+       // Before deleting a dialog, give the user a last chance
+       // change their mind, in case they accidentally right
+       // clicked the dialog rather than the widget they were
+       // aiming for.
+       if (data->IsKindOf(CLASSINFO(wxPanel)))
+       {
+               wxString str(wxT("Deleting dialog : "));
+               str += data->GetName();
+               if (wxMessageBox(wxT("Are you sure?"), str, wxYES_NO | wxCENTRE) == wxNO)
+                       return;
+       }
+
+       wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(data);
+       
+       wxResourceManager::GetCurrentResourceManager()->SaveInfoAndDeleteHandler(data);
+       wxResourceManager::GetCurrentResourceManager()->DeleteResource(data);
+       wxResourceManager::GetCurrentResourceManager()->DeleteWindow(data);
+}
 
 
 
index 9a14434b148f5c2b599fc2c9c4f52af9f6c4d154..ce39f648fadc1ed3cafb57f1017a797e15715678 100644 (file)
@@ -52,6 +52,8 @@ public:
     void OnPaint(wxPaintEvent& event);
     void OnMouseEvent(wxMouseEvent& event);
     void OnSize(wxSizeEvent& event);
+       void OnObjectEdit(wxCommandEvent& event);
+       void OnObjectDelete(wxCommandEvent& event);
     
     virtual void OnItemEvent(wxControl *win, wxMouseEvent& event);
     virtual void OnLeftClick(int x, int y, int keys);
index bad86bcbebcc7ff7508767214cc2f7f7d33b3401..d228a23834e11c01017c0833cd2c2052d036db9c 100644 (file)
@@ -2397,51 +2397,6 @@ void wxResourceEditorScrolledWindow::DrawTitle(wxDC& dc)
     }
 }
 
-// Popup menu callback
-void ObjectMenuProc(wxMenu *menu, wxCommandEvent& event)
-{
-    wxWindow *data = (wxWindow *)menu->GetClientData();
-    if (!data)
-        return;
-    
-    switch (event.GetId())
-    {
-    case OBJECT_MENU_TITLE:
-        {
-            event.Skip();
-            break;
-        }
-    case OBJECT_MENU_EDIT:
-        {
-            wxResourceManager::GetCurrentResourceManager()->EditWindow(data);
-            break;
-        }
-    case OBJECT_MENU_DELETE:
-        {
-            // Before deleting a dialog, give the user a last chance
-            // change their mind, in case they accidentally right
-            // clicked the dialog rather than the widget they were
-            // aiming for.
-            if (data->IsKindOf(CLASSINFO(wxPanel)))
-            {
-                wxString str(wxT("Deleting dialog : "));
-                str += data->GetName();
-                if (wxMessageBox(wxT("Are you sure?"), str, wxYES_NO | wxCENTRE) == wxNO)
-                    return;
-            }
-
-            wxResourceManager::GetCurrentResourceManager()->DeselectItemIfNecessary(data);
-
-            wxResourceManager::GetCurrentResourceManager()->SaveInfoAndDeleteHandler(data);
-            wxResourceManager::GetCurrentResourceManager()->DeleteResource(data);
-            wxResourceManager::GetCurrentResourceManager()->DeleteWindow(data);
-            break;
-        }
-    default:
-        break;
-    }
-}
-
 /*
 * Main toolbar
 *