1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMenu, wxMenuBar, wxMenuItem
4 // Author: Julian Smart
5 // Modified by: Vadim Zeitlin
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "menu.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
30 #include "wx/ownerdrw.h"
33 #include "wx/msw/private.h"
34 #include "wx/msw/menu.h"
35 #include "wx/menuitem.h"
38 // other standard headers
39 // ----------------------
42 // ----------------------------------------------------------------------------
44 // ----------------------------------------------------------------------------
46 // the (popup) menu title has this special id
47 static const int idMenuTitle
= -2;
49 // ----------------------------------------------------------------------------
51 // ----------------------------------------------------------------------------
52 #if !USE_SHARED_LIBRARY
53 IMPLEMENT_DYNAMIC_CLASS(wxMenu
, wxEvtHandler
)
54 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar
, wxEvtHandler
)
57 // ============================================================================
59 // ============================================================================
63 // Construct a menu with optional title (then use append)
64 wxMenu::wxMenu(const wxString
& Title
, const wxFunction func
)
68 m_eventHandler
= this;
69 m_pInvokingWindow
= NULL
;
73 m_hMenu
= (WXHMENU
) CreatePopupMenu();
75 m_topLevelMenu
= this;
78 Append(idMenuTitle
, m_title
) ;
85 // The wxWindow destructor will take care of deleting the submenus.
89 DestroyMenu((HMENU
) m_hMenu
);
92 // Windows seems really bad on Menu de-allocation...
93 // After many try, here is what I do: RemoveMenu() will ensure
94 // that popup are "disconnected" from their parent; then call
95 // delete method on each child (which in turn do a recursive job),
96 // and finally, DestroyMenu()
98 // With that, BoundCheckers is happy, and no complaints...
102 N = GetMenuItemCount(m_hMenu);
104 for (i = N-1; i >= 0; i--)
105 RemoveMenu(m_hMenu, i, MF_BYPOSITION);
108 // How is deleting submenus in this loop any different from deleting
109 // the submenus in the children list, via ~wxWindow ?
110 // I'll reinstate this deletion for now and remove addition
111 // from children list (which doesn't exist now)
113 wxNode
*node
= m_menuItems
.First();
116 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
118 // Delete child menus.
119 // Beware: they must not be appended to children list!!!
120 // (because order of delete is significant)
121 if (item
->GetSubMenu())
122 item
->DeleteSubMenu();
124 wxNode
*next
= node
->Next();
131 DestroyMenu(m_hMenu);
141 // function appends a new item or submenu to the menu
142 void wxMenu::Append(wxMenuItem
*pItem
)
144 wxCHECK_RET( pItem
!= NULL
, "can't append NULL item to the menu" );
146 m_menuItems
.Append(pItem
);
151 flags
|= MF_MENUBREAK
;
155 if ( pItem
->IsSeparator() ) {
156 flags
|= MF_SEPARATOR
;
159 // id is the numeric id for normal menu items and HMENU for submenus
161 wxMenu
*SubMenu
= pItem
->GetSubMenu();
162 if ( SubMenu
!= NULL
) {
163 wxASSERT( SubMenu
->m_hMenu
!= (WXHMENU
) NULL
);
165 id
= (UINT
)SubMenu
->m_hMenu
;
167 SubMenu
->m_topLevelMenu
= m_topLevelMenu
;
168 SubMenu
->m_parent
= this;
169 SubMenu
->m_savehMenu
= (WXHMENU
)id
;
170 SubMenu
->m_hMenu
= 0;
180 #if wxUSE_OWNER_DRAWN
181 if ( pItem
->IsOwnerDrawn() ) { // want to get {Measure|Draw}Item messages?
182 // item draws itself, pass pointer to it in data parameter
183 flags
|= MF_OWNERDRAW
;
184 pData
= (LPCSTR
)pItem
;
189 // menu is just a normal string (passed in data parameter)
191 pData
= pItem
->GetName();
194 // visually select the menu title
195 if ( id
== idMenuTitle
)
197 // TODO use SetMenuItemInfo(MFS_DEFAULT) to put it in bold face
200 HMENU hMenu
= (HMENU
)((m_hMenu
== 0) ? m_savehMenu
: m_hMenu
);
201 if ( !AppendMenu(hMenu
, flags
, id
, pData
) )
203 wxLogLastError("AppendMenu");
209 void wxMenu::AppendSeparator()
211 Append(new wxMenuItem(this, ID_SEPARATOR
));
215 void wxMenu::Append(int Id
, const wxString
& label
, wxMenu
*SubMenu
,
216 const wxString
& helpString
)
218 Append(new wxMenuItem(this, Id
, label
, helpString
, FALSE
, SubMenu
));
221 // Ordinary menu item
222 void wxMenu::Append(int Id
, const wxString
& label
,
223 const wxString
& helpString
, bool checkable
)
225 // 'checkable' parameter is useless for Windows.
226 Append(new wxMenuItem(this, Id
, label
, helpString
, checkable
));
229 void wxMenu::Delete(int id
)
236 for (pos
= 0, node
= m_menuItems
.First(); node
; node
= node
->Next(), pos
++) {
237 item
= (wxMenuItem
*)node
->Data();
238 if (item
->GetId() == id
)
245 menu
= (HMENU
)(m_hMenu
? m_hMenu
: m_savehMenu
);
247 wxMenu
*pSubMenu
= item
->GetSubMenu();
248 if ( pSubMenu
!= NULL
) {
249 RemoveMenu(menu
, (UINT
)pos
, MF_BYPOSITION
);
250 pSubMenu
->m_hMenu
= pSubMenu
->m_savehMenu
;
251 pSubMenu
->m_savehMenu
= 0;
252 pSubMenu
->m_parent
= NULL
;
253 // RemoveChild(item->subMenu);
254 pSubMenu
->m_topLevelMenu
= NULL
;
255 // TODO: Why isn't subMenu deleted here???
256 // Will put this in for now. Assuming this is supposed
257 // to delete the menu, not just remove it.
258 item
->DeleteSubMenu();
261 DeleteMenu(menu
, (UINT
)pos
, MF_BYPOSITION
);
264 m_menuItems
.DeleteNode(node
);
268 void wxMenu::Enable(int Id
, bool Flag
)
270 wxMenuItem
*item
= FindItemForId(Id
);
271 wxCHECK_RET( item
!= NULL
, "can't enable non-existing menu item" );
276 bool wxMenu::Enabled(int Id
) const
278 wxMenuItem
*item
= FindItemForId(Id
);
279 wxCHECK( item
!= NULL
, FALSE
);
281 return item
->IsEnabled();
284 void wxMenu::Check(int Id
, bool Flag
)
286 wxMenuItem
*item
= FindItemForId(Id
);
287 wxCHECK_RET( item
!= NULL
, "can't get status of non-existing menu item" );
292 bool wxMenu::Checked(int Id
) const
294 wxMenuItem
*item
= FindItemForId(Id
);
295 wxCHECK( item
!= NULL
, FALSE
);
297 return item
->IsChecked();
300 void wxMenu::SetTitle(const wxString
& label
)
302 bool hasNoTitle
= m_title
.IsEmpty();
305 HMENU hMenu
= (HMENU
)((m_hMenu
== 0) ? m_savehMenu
: m_hMenu
);
309 if ( !label
.IsEmpty() )
311 if ( !InsertMenu(hMenu
, 0, MF_BYPOSITION
| MF_STRING
,
312 idMenuTitle
, m_title
) ||
313 !InsertMenu(hMenu
, 1, MF_BYPOSITION
, -1, NULL
) )
315 wxLogLastError("InsertMenu");
321 if ( label
.IsEmpty() )
323 // remove the title and the separator after it
324 if ( !RemoveMenu(hMenu
, 0, MF_BYPOSITION
) ||
325 !RemoveMenu(hMenu
, 0, MF_BYPOSITION
) )
327 wxLogLastError("RemoveMenu");
333 if ( !ModifyMenu(hMenu
, 0,
334 MF_BYPOSITION
| MF_STRING
,
335 idMenuTitle
, m_title
) )
337 wxLogLastError("ModifyMenu");
342 // TODO use SetMenuItemInfo(MFS_DEFAULT) to put it in bold face
345 const wxString
wxMenu::GetTitle() const
350 void wxMenu::SetLabel(int Id
, const wxString
& label
)
352 wxMenuItem
*item
= FindItemForId(Id
) ;
356 if (item
->GetSubMenu()==NULL
)
360 UINT was_flag
= GetMenuState((HMENU
)m_hMenu
,Id
,MF_BYCOMMAND
) ;
361 ModifyMenu((HMENU
)m_hMenu
,Id
,MF_BYCOMMAND
|MF_STRING
|was_flag
,Id
,(const char *)label
) ;
363 else if (m_savehMenu
)
365 UINT was_flag
= GetMenuState((HMENU
)m_savehMenu
,Id
,MF_BYCOMMAND
) ;
366 ModifyMenu((HMENU
)m_savehMenu
,Id
,MF_BYCOMMAND
|MF_STRING
|was_flag
,Id
,(const char *)label
) ;
371 wxMenu
*father
= item
->GetSubMenu()->m_topLevelMenu
;
372 wxNode
*node
= father
->m_menuItems
.First() ;
376 wxMenuItem
*matched
= (wxMenuItem
*)node
->Data() ;
380 node
= node
->Next() ;
382 // Here, we have the position.
383 ModifyMenu((HMENU
)father
->m_savehMenu
,i
,
384 MF_BYPOSITION
|MF_STRING
|MF_POPUP
,
385 (UINT
)item
->GetSubMenu()->m_savehMenu
,(const char *)label
) ;
387 item
->SetName(label
);
390 wxString
wxMenu::GetLabel(int id
) const
393 static char tmp[128] ;
396 len = GetMenuString((HMENU)m_hMenu,Id,tmp,WXSIZEOF(tmp) - 1,MF_BYCOMMAND);
397 else if (m_savehMenu)
398 len = GetMenuString((HMENU)m_savehMenu,Id,tmp,WXSIZEOF(tmp) - 1,MF_BYCOMMAND);
402 return wxString(tmp) ;
405 wxMenuItem
*pItem
= FindItemForId(id
) ;
407 return pItem
->GetName() ;
409 return wxEmptyString
;
412 bool wxMenu::MSWCommand(WXUINT
WXUNUSED(param
), WXWORD id
)
414 wxCommandEvent
event(wxEVENT_TYPE_MENU_COMMAND
);
415 event
.SetEventObject( this );
418 ProcessCommand(event
);
422 // Finds the item id matching the given string, -1 if not found.
423 int wxMenu::FindItem (const wxString
& itemString
) const
427 wxStripMenuCodes ((char *)(const char *)itemString
, buf1
);
429 for (wxNode
* node
= m_menuItems
.First (); node
; node
= node
->Next ())
431 wxMenuItem
*item
= (wxMenuItem
*) node
->Data ();
432 if (item
->GetSubMenu())
434 int ans
= item
->GetSubMenu()->FindItem(itemString
);
438 if ( !item
->IsSeparator() )
440 wxStripMenuCodes((char *)item
->GetName().c_str(), buf2
);
441 if (strcmp(buf1
, buf2
) == 0)
442 return item
->GetId();
449 wxMenuItem
*wxMenu::FindItemForId(int itemId
, wxMenu
** itemMenu
) const
453 for (wxNode
* node
= m_menuItems
.First (); node
; node
= node
->Next ())
455 wxMenuItem
*item
= (wxMenuItem
*) node
->Data ();
457 if (item
->GetId() == itemId
)
460 *itemMenu
= (wxMenu
*) this;
464 if (item
->GetSubMenu())
466 wxMenuItem
*ans
= item
->GetSubMenu()->FindItemForId (itemId
, itemMenu
);
477 void wxMenu::SetHelpString(int itemId
, const wxString
& helpString
)
479 wxMenuItem
*item
= FindItemForId (itemId
);
481 item
->SetHelp(helpString
);
484 wxString
wxMenu::GetHelpString (int itemId
) const
486 wxMenuItem
*item
= FindItemForId (itemId
);
488 return (item
== NULL
) ? str
: item
->GetHelp();
491 void wxMenu::ProcessCommand(wxCommandEvent
& event
)
493 bool processed
= FALSE
;
498 (void)(*(m_callback
))(*this, event
);
502 // Try the menu's event handler
503 if ( !processed
&& GetEventHandler())
505 processed
= GetEventHandler()->ProcessEvent(event
);
508 // Try the window the menu was popped up from (and up
509 // through the hierarchy)
510 if ( !processed
&& GetInvokingWindow())
511 processed
= GetInvokingWindow()->ProcessEvent(event
);
514 extern wxMenu
*wxCurrentPopupMenu
;
515 bool wxWindow::PopupMenu(wxMenu
*menu
, int x
, int y
)
517 menu
->SetInvokingWindow(this);
519 HWND hWnd
= (HWND
) GetHWND();
520 HMENU hMenu
= (HMENU
)menu
->m_hMenu
;
524 ::ClientToScreen(hWnd
, &point
);
525 wxCurrentPopupMenu
= menu
;
526 ::TrackPopupMenu(hMenu
, TPM_RIGHTBUTTON
, point
.x
, point
.y
, 0, hWnd
, NULL
);
528 wxCurrentPopupMenu
= NULL
;
530 menu
->SetInvokingWindow(NULL
);
536 wxMenuBar::wxMenuBar()
538 m_eventHandler
= this;
543 m_menuBarFrame
= NULL
;
547 wxMenuBar::wxMenuBar(int N
, wxMenu
*Menus
[], const wxString Titles
[])
549 m_eventHandler
= this;
552 m_titles
= new wxString
[N
];
554 for ( i
= 0; i
< N
; i
++ )
555 m_titles
[i
] = Titles
[i
];
556 m_menuBarFrame
= NULL
;
557 for (i
= 0; i
< N
; i
++)
558 m_menus
[i
]->m_menuBar
= (wxMenuBar
*) this;
563 wxMenuBar::~wxMenuBar()
565 // In fact, don't want menu to be destroyed before MDI
566 // shuffling has taken place. Let it be destroyed
567 // automatically when the window is destroyed.
569 // DestroyMenu(menu);
574 // See remarks in ::~wxMenu() method
575 // BEWARE - this may interfere with MDI fixes, so
576 // may need to remove
579 if (m_menuBarFrame && ((m_menuBarFrame->GetWindowStyleFlag() & wxSDI) == wxSDI))
582 N = GetMenuItemCount(menu) ;
583 for (i = N-1; i >= 0; i--)
584 RemoveMenu(menu, i, MF_BYPOSITION);
587 for (i
= 0; i
< m_menuCount
; i
++)
594 /* Don't destroy menu here, in case we're MDI and
595 need to do some shuffling with VALID menu handles.
602 // Must only be used AFTER menu has been attached to frame,
603 // otherwise use individual menus to enable/disable items
604 void wxMenuBar::Enable(int Id
, bool Flag
)
608 ms_flag
= MF_ENABLED
;
612 wxMenu
*itemMenu
= NULL
;
613 wxMenuItem
*item
= FindItemForId(Id
, &itemMenu
) ;
617 if (itemMenu
->m_hMenu
)
618 EnableMenuItem((HMENU
)itemMenu
->m_hMenu
, Id
, MF_BYCOMMAND
| ms_flag
);
619 else if (itemMenu
->m_savehMenu
)
620 EnableMenuItem((HMENU
)itemMenu
->m_savehMenu
, Id
, MF_BYCOMMAND
| ms_flag
);
624 void wxMenuBar::EnableTop(int pos
, bool flag
)
628 ms_flag
= MF_ENABLED
;
632 EnableMenuItem((HMENU
)m_hMenu
, pos
, MF_BYPOSITION
| ms_flag
);
633 DrawMenuBar((HWND
) m_menuBarFrame
->GetHWND()) ;
636 // Must only be used AFTER menu has been attached to frame,
637 // otherwise use individual menus
638 void wxMenuBar::Check(int Id
, bool Flag
)
640 wxMenu
*itemMenu
= NULL
;
641 wxMenuItem
*item
= FindItemForId(Id
, &itemMenu
) ;
645 if (!item
->IsCheckable())
649 ms_flag
= MF_CHECKED
;
651 ms_flag
= MF_UNCHECKED
;
653 if (itemMenu
->m_hMenu
)
654 CheckMenuItem((HMENU
)itemMenu
->m_hMenu
, Id
, MF_BYCOMMAND
| ms_flag
);
655 else if (itemMenu
->m_savehMenu
)
656 CheckMenuItem((HMENU
)itemMenu
->m_savehMenu
, Id
, MF_BYCOMMAND
| ms_flag
);
658 // CheckMenuItem((HMENU)m_hMenu, Id, MF_BYCOMMAND | ms_flag);
661 bool wxMenuBar::Checked(int Id
) const
663 wxMenu
*itemMenu
= NULL
;
664 wxMenuItem
*item
= FindItemForId(Id
, &itemMenu
) ;
670 if (itemMenu
->m_hMenu
)
671 Flag
=GetMenuState((HMENU
)itemMenu
->m_hMenu
, Id
, MF_BYCOMMAND
) ;
672 else if (itemMenu
->m_savehMenu
)
673 Flag
=GetMenuState((HMENU
)itemMenu
->m_savehMenu
, Id
, MF_BYCOMMAND
) ;
675 // Flag=GetMenuState((HMENU)m_hMenu, Id, MF_BYCOMMAND) ;
683 bool wxMenuBar::Enabled(int Id
) const
685 wxMenu
*itemMenu
= NULL
;
686 wxMenuItem
*item
= FindItemForId(Id
, &itemMenu
) ;
692 if (itemMenu
->m_hMenu
)
693 Flag
=GetMenuState((HMENU
)itemMenu
->m_hMenu
, Id
, MF_BYCOMMAND
) ;
694 else if (itemMenu
->m_savehMenu
)
695 Flag
=GetMenuState((HMENU
)itemMenu
->m_savehMenu
, Id
, MF_BYCOMMAND
) ;
704 void wxMenuBar::SetLabel(int Id
, const wxString
& label
)
706 wxMenu
*itemMenu
= NULL
;
707 wxMenuItem
*item
= FindItemForId(Id
, &itemMenu
) ;
712 if (itemMenu
->m_hMenu
)
714 UINT was_flag
= GetMenuState((HMENU
)itemMenu
->m_hMenu
,Id
,MF_BYCOMMAND
) ;
715 ModifyMenu((HMENU
)itemMenu
->m_hMenu
,Id
,MF_BYCOMMAND
|MF_STRING
|was_flag
,Id
,(const char *)label
) ;
717 else if (itemMenu
->m_savehMenu
)
719 UINT was_flag
= GetMenuState((HMENU
)itemMenu
->m_savehMenu
,Id
,MF_BYCOMMAND
) ;
720 ModifyMenu((HMENU
)itemMenu
->m_savehMenu
,Id
,MF_BYCOMMAND
|MF_STRING
|was_flag
,Id
,(const char *)label
) ;
724 wxString
wxMenuBar::GetLabel(int Id
) const
726 wxMenu
*itemMenu
= NULL
;
727 wxMenuItem
*item
= FindItemForId(Id
, &itemMenu
) ;
732 static char tmp
[128] ;
734 if (itemMenu
->m_hMenu
)
736 len
= GetMenuString((HMENU
)itemMenu
->m_hMenu
,Id
,tmp
,127,MF_BYCOMMAND
) ;
738 else if (itemMenu
->m_savehMenu
)
740 len
= GetMenuString((HMENU
)itemMenu
->m_savehMenu
,Id
,tmp
,127,MF_BYCOMMAND
) ;
743 // int len = GetMenuString((HMENU)m_hMenu,Id,tmp,127,MF_BYCOMMAND) ;
745 return wxString(tmp
) ;
748 void wxMenuBar::SetLabelTop(int pos
, const wxString
& label
)
750 UINT was_flag
= GetMenuState((HMENU
)m_hMenu
,pos
,MF_BYPOSITION
) ;
751 if (was_flag
&MF_POPUP
)
754 HMENU popup
= GetSubMenu((HMENU
)m_hMenu
,pos
) ;
755 ModifyMenu((HMENU
)m_hMenu
,pos
,MF_BYPOSITION
|MF_STRING
|was_flag
,(UINT
)popup
,(const char *)label
) ;
758 ModifyMenu((HMENU
)m_hMenu
,pos
,MF_BYPOSITION
|MF_STRING
|was_flag
,pos
,(const char *)label
) ;
761 wxString
wxMenuBar::GetLabelTop(int pos
) const
763 static char tmp
[128] ;
764 int len
= GetMenuString((HMENU
)m_hMenu
,pos
,tmp
,127,MF_BYPOSITION
) ;
766 return wxString(tmp
);
769 bool wxMenuBar::OnDelete(wxMenu
*a_menu
, int pos
)
774 if (RemoveMenu((HMENU
)m_hMenu
, (UINT
)pos
, MF_BYPOSITION
)) {
775 m_menus
[pos
]->m_hMenu
= m_menus
[pos
]->m_savehMenu
;
776 m_menus
[pos
]->m_savehMenu
= 0;
778 if (m_menuBarFrame
) {
779 DrawMenuBar((HWND
) m_menuBarFrame
->GetHWND()) ;
788 bool wxMenuBar::OnAppend(wxMenu
*a_menu
, const char *title
)
790 if (!a_menu
->m_hMenu
)
796 a_menu
->m_savehMenu
= a_menu
->m_hMenu
;
799 AppendMenu((HMENU
)m_hMenu
, MF_POPUP
| MF_STRING
, (UINT
)a_menu
->m_savehMenu
, title
);
801 DrawMenuBar((HWND
) m_menuBarFrame
->GetHWND());
806 void wxMenuBar::Append (wxMenu
* menu
, const wxString
& title
)
808 if (!OnAppend(menu
, title
))
812 wxMenu
**new_menus
= new wxMenu
*[m_menuCount
];
813 wxString
*new_titles
= new wxString
[m_menuCount
];
816 for (i
= 0; i
< m_menuCount
- 1; i
++)
818 new_menus
[i
] = m_menus
[i
];
820 new_titles
[i
] = m_titles
[i
];
829 m_titles
= new_titles
;
831 m_menus
[m_menuCount
- 1] = (wxMenu
*)menu
;
832 m_titles
[m_menuCount
- 1] = title
;
834 ((wxMenu
*)menu
)->m_menuBar
= (wxMenuBar
*) this;
835 ((wxMenu
*)menu
)->SetParent(this);
838 void wxMenuBar::Delete(wxMenu
* menu
, int i
)
844 for (ii
= 0; ii
< m_menuCount
; ii
++) {
845 if (m_menus
[ii
] == menu
)
848 if (ii
>= m_menuCount
)
851 if (ii
< 0 || ii
>= m_menuCount
)
856 if (!OnDelete(menu
, ii
))
859 menu
->SetParent(NULL
);
862 for (j
= ii
; j
< m_menuCount
; j
++) {
863 m_menus
[j
] = m_menus
[j
+ 1];
864 m_titles
[j
] = m_titles
[j
+ 1];
868 // Find the menu menuString, item itemString, and return the item id.
869 // Returns -1 if none found.
870 int wxMenuBar::FindMenuItem (const wxString
& menuString
, const wxString
& itemString
) const
874 wxStripMenuCodes ((char *)(const char *)menuString
, buf1
);
876 for (i
= 0; i
< m_menuCount
; i
++)
878 wxStripMenuCodes ((char *)(const char *)m_titles
[i
], buf2
);
879 if (strcmp (buf1
, buf2
) == 0)
880 return m_menus
[i
]->FindItem (itemString
);
885 wxMenuItem
*wxMenuBar::FindItemForId (int Id
, wxMenu
** itemMenu
) const
890 wxMenuItem
*item
= NULL
;
892 for (i
= 0; i
< m_menuCount
; i
++)
893 if ((item
= m_menus
[i
]->FindItemForId (Id
, itemMenu
)))
898 void wxMenuBar::SetHelpString (int Id
, const wxString
& helpString
)
901 for (i
= 0; i
< m_menuCount
; i
++)
903 if (m_menus
[i
]->FindItemForId (Id
))
905 m_menus
[i
]->SetHelpString (Id
, helpString
);
911 wxString
wxMenuBar::GetHelpString (int Id
) const
914 for (i
= 0; i
< m_menuCount
; i
++)
916 if (m_menus
[i
]->FindItemForId (Id
))
917 return wxString(m_menus
[i
]->GetHelpString (Id
));
922 wxWindow
*wxMenu::GetWindow() const
924 if ( m_pInvokingWindow
!= NULL
)
925 return m_pInvokingWindow
;
926 if ( m_menuBar
!= NULL
)
927 return m_menuBar
->m_menuBarFrame
;
931 WXHMENU
wxMenu::GetHMenu() const
935 else if ( m_savehMenu
!= 0 )