]> git.saurik.com Git - wxWidgets.git/commitdiff
Move wxMSW wxMenu::GetWindow() down to wxMenuBase.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 24 Apr 2010 15:07:39 +0000 (15:07 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 24 Apr 2010 15:07:39 +0000 (15:07 +0000)
GetInvokingWindow() can only be used for the popup menus which have the
invoking window, so add a new function which can be used to get the window
associated with any kind of menu in all ports -- it already existed in wxMSW
but is needed elsewhere too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64123 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/menu.h
include/wx/msw/menu.h
src/common/menucmn.cpp
src/msw/menu.cpp

index 1a5ef27737e77b040817cba080fdf6a7136338d0..8914432b714a0d4221177b52e009a298879cc616 100644 (file)
@@ -27,6 +27,7 @@
 // included wx/menu.h
 #include "wx/menuitem.h"
 
+class WXDLLIMPEXP_FWD_CORE wxFrame;
 class WXDLLIMPEXP_FWD_CORE wxMenu;
 class WXDLLIMPEXP_FWD_CORE wxMenuBarBase;
 class WXDLLIMPEXP_FWD_CORE wxMenuBar;
@@ -261,6 +262,11 @@ public:
     void SetInvokingWindow(wxWindow *win);
     wxWindow *GetInvokingWindow() const;
 
+    // the window associated with this menu: this is the invoking window for
+    // popup menus or the top level window to which the menu bar is attached
+    // for menus which are part of a menu bar
+    wxWindow *GetWindow() const;
+
     // style
     long GetStyle() const { return m_style; }
 
index 852bb646a60dc7c57502331883e44865cf986e14..f19beacbf76ea631772bf0a4eb7c2be684bf26f9 100644 (file)
@@ -67,10 +67,7 @@ public:
 
     bool MSWCommand(WXUINT param, WXWORD id);
 
-    // semi-private accessors
-        // get the window which contains this menu
-    wxWindow *GetWindow() const;
-        // get the menu handle
+    // get the native menu handle
     WXHMENU GetHMenu() const { return m_hMenu; }
 
 #if wxUSE_ACCEL
index 76f17e9481874f5de903c7782fc50bfb2db97936..74d5fd843dd779214bcf9a3b63750adab2782a6b 100644 (file)
@@ -540,6 +540,11 @@ wxWindow *wxMenuBase::GetInvokingWindow() const
     return menu->m_invokingWindow;
 }
 
+wxWindow *wxMenuBase::GetWindow() const
+{
+    return GetMenuBar() ? GetMenuBar()->GetFrame() : GetInvokingWindow();
+}
+
 // ----------------------------------------------------------------------------
 // wxMenu functions forwarded to wxMenuItem
 // ----------------------------------------------------------------------------
index 7c62184ce2bcf2607f6f032dc8c2b857be84f9b6..9df0797d692b03caf5fb3ed2a4c9bb867d2b8dee 100644 (file)
@@ -978,15 +978,6 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id_)
     return true;
 }
 
-// ---------------------------------------------------------------------------
-// other
-// ---------------------------------------------------------------------------
-
-wxWindow *wxMenu::GetWindow() const
-{
-    return GetMenuBar() ? GetMenuBar()->GetFrame() : GetInvokingWindow();
-}
-
 // ---------------------------------------------------------------------------
 // Menu Bar
 // ---------------------------------------------------------------------------