1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMenu, wxMenuBar, wxMenuItem
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 // ============================================================================
14 // headers & declarations
15 // ============================================================================
21 #pragma implementation "menu.h"
22 #pragma implementation "menuitem.h"
27 #include "wx/menuitem.h"
28 #include "wx/window.h"
32 #include "wx/mac/uma.h"
34 // other standard headers
35 // ----------------------
38 #if !USE_SHARED_LIBRARY
39 IMPLEMENT_DYNAMIC_CLASS(wxMenu
, wxEvtHandler
)
40 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar
, wxEvtHandler
)
43 // the (popup) menu title has this special id
44 static const int idMenuTitle
= -2;
45 static int formerHelpMenuItems
= 0 ;
47 const short kwxMacMenuBarResource
= 1 ;
48 const short kwxMacAppleMenuId
= 1 ;
50 // ============================================================================
52 // ============================================================================
57 // Construct a menu with optional title (then use append)
59 short wxMenu::s_macNextMenuId
= 2 ;
67 wxMenuItem::MacBuildMenuString( label
, NULL
, NULL
, m_title
, false );
68 m_macMenuId
= s_macNextMenuId
++;
69 wxCHECK_RET( s_macNextMenuId
< 236 , "menu ids > 235 cannot be used for submenus on mac" );
70 m_hMenu
= UMANewMenu(m_macMenuId
, label
);
74 wxLogLastError("CreatePopupMenu");
77 // if we have a title, insert it in the beginning of the menu
80 Append(idMenuTitle
, m_title
) ;
88 UMADisposeMenu(m_hMenu
);
92 WX_CLEAR_ARRAY(m_accels
);
98 // not available on the mac platform
103 int wxMenu::FindAccel(int id
) const
105 size_t n
, count
= m_accels
.GetCount();
106 for ( n
= 0; n
< count
; n
++ )
108 if ( m_accels
[n
]->m_command
== id
)
115 void wxMenu::UpdateAccel(wxMenuItem
*item
)
117 // find the (new) accel for this item
118 wxAcceleratorEntry
*accel
= wxGetAccelFromString(item
->GetText());
120 accel
->m_command
= item
->GetId();
123 int n
= FindAccel(item
->GetId());
124 if ( n
== wxNOT_FOUND
)
126 // no old, add new if any
130 return; // skipping RebuildAccelTable() below
134 // replace old with new or just remove the old one if no new
144 m_menuBar
->RebuildAccelTable();
148 #endif // wxUSE_ACCEL
150 // function appends a new item or submenu to the menu
151 // append a new item or submenu to the menu
152 bool wxMenu::DoInsertOrAppend(wxMenuItem
*pItem
, size_t pos
)
154 wxASSERT_MSG( pItem
!= NULL
, "can't append NULL item to the menu" );
157 #endif // wxUSE_ACCEL
159 if ( pItem
->IsSeparator() )
161 if ( pos
== (size_t)-1 )
163 MacAppendMenu(m_hMenu
, "\p-");
167 MacInsertMenuItem(m_hMenu
, "\p-" , pos
);
172 wxMenu
*pSubMenu
= pItem
->GetSubMenu() ;
173 if ( pSubMenu
!= NULL
)
176 wxASSERT_MSG( pSubMenu
->m_hMenu
!= NULL
, "invalid submenu added");
177 pSubMenu
->m_menuParent
= this ;
178 wxMenuItem::MacBuildMenuString( label
, NULL
, NULL
, pItem
->GetText() ,false);
180 if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar
)
182 UMAInsertMenu( pSubMenu
->m_hMenu
, -1 ) ;
185 if ( pos
== (size_t)-1 )
187 UMAAppendSubMenuItem(m_hMenu
, label
, pSubMenu
->m_macMenuId
);
191 UMAInsertSubMenuItem(m_hMenu
, label
, pos
, pSubMenu
->m_macMenuId
);
199 wxMenuItem::MacBuildMenuString( label
, &key
, &modifiers
, pItem
->GetText(), pItem
->GetId() == wxApp::s_macAboutMenuItemId
);
202 // we cannot add empty menus on mac
206 if ( pos
== (size_t)-1 )
208 UMAAppendMenuItem(m_hMenu
, label
,key
,modifiers
);
212 UMAInsertMenuItem(m_hMenu
, label
, pos
,key
,modifiers
);
214 if ( pItem
->GetId() == idMenuTitle
)
216 if ( pos
== (size_t)-1 )
218 UMADisableMenuItem( m_hMenu
, CountMenuItems( m_hMenu
) ) ;
222 UMADisableMenuItem( m_hMenu
, pos
+ 1 ) ;
227 // if we're already attached to the menubar, we must update it
230 m_menuBar
->Refresh();
235 bool wxMenu::DoAppend(wxMenuItem
*item
)
237 return wxMenuBase::DoAppend(item
) && DoInsertOrAppend(item
);
240 bool wxMenu::DoInsert(size_t pos
, wxMenuItem
*item
)
242 return wxMenuBase::DoInsert(pos
, item
) && DoInsertOrAppend(item
, pos
);
245 wxMenuItem
*wxMenu::DoRemove(wxMenuItem
*item
)
247 // we need to find the items position in the child list
249 wxMenuItemList::Node
*node
= GetMenuItems().GetFirst();
250 for ( pos
= 0; node
; pos
++ )
252 if ( node
->GetData() == item
)
255 node
= node
->GetNext();
258 // DoRemove() (unlike Remove) can only be called for existing item!
259 wxCHECK_MSG( node
, NULL
, wxT("bug in wxMenu::Remove logic") );
262 // remove the corresponding accel from the accel table
263 int n
= FindAccel(item
->GetId());
264 if ( n
!= wxNOT_FOUND
)
270 //else: this item doesn't have an accel, nothing to do
271 #endif // wxUSE_ACCEL
273 ::DeleteMenuItem( m_hMenu
, pos
+ 1);
277 // otherwise, the chane won't be visible
278 m_menuBar
->Refresh();
281 // and from internal data structures
282 return wxMenuBase::DoRemove(item
);
285 // ---------------------------------------------------------------------------
286 // accelerator helpers
287 // ---------------------------------------------------------------------------
291 // create the wxAcceleratorEntries for our accels and put them into provided
292 // array - return the number of accels we have
293 size_t wxMenu::CopyAccels(wxAcceleratorEntry
*accels
) const
295 size_t count
= GetAccelCount();
296 for ( size_t n
= 0; n
< count
; n
++ )
298 *accels
++ = *m_accels
[n
];
304 #endif // wxUSE_ACCEL
306 void wxMenu::SetTitle(const wxString
& label
)
310 wxMenuItem::MacBuildMenuString( title
, NULL
, NULL
, label
, false );
311 UMASetMenuTitle( m_hMenu
, title
) ;
313 bool wxMenu::ProcessCommand(wxCommandEvent
& event
)
315 bool processed
= FALSE
;
317 #if WXWIN_COMPATIBILITY
321 (void)(*(m_callback
))(*this, event
);
324 #endif WXWIN_COMPATIBILITY
326 // Try the menu's event handler
327 if ( !processed
&& GetEventHandler())
329 processed
= GetEventHandler()->ProcessEvent(event
);
332 // Try the window the menu was popped up from (and up through the
334 wxWindow
*win
= GetInvokingWindow();
335 if ( !processed
&& win
)
336 processed
= win
->GetEventHandler()->ProcessEvent(event
);
342 // ---------------------------------------------------------------------------
344 // ---------------------------------------------------------------------------
346 void wxMenu::Attach(wxMenuBar
*menubar
)
348 // menu can be in at most one menubar because otherwise they would both
349 // delete the menu pointer
350 wxASSERT_MSG( !m_menuBar
, wxT("menu belongs to 2 menubars, expect a crash") );
355 void wxMenu::Detach()
357 wxASSERT_MSG( m_menuBar
, wxT("can't detach menu if it's not attached") );
362 wxWindow
*wxMenu::GetWindow() const
364 if ( m_invokingWindow
!= NULL
)
365 return m_invokingWindow
;
366 else if ( m_menuBar
!= NULL
)
367 return (wxWindow
*) m_menuBar
->GetFrame();
372 // helper functions returning the mac menu position for a certain item, note that this is
373 // mac-wise 1 - based, i.e. the first item has index 1 whereas on MSWin it has pos 0
375 int wxMenu::MacGetIndexFromId( int id
)
378 wxMenuItemList::Node
*node
= GetMenuItems().GetFirst();
379 for ( pos
= 0; node
; pos
++ )
381 if ( node
->GetData()->GetId() == id
)
384 node
= node
->GetNext();
393 int wxMenu::MacGetIndexFromItem( wxMenuItem
*pItem
)
396 wxMenuItemList::Node
*node
= GetMenuItems().GetFirst();
397 for ( pos
= 0; node
; pos
++ )
399 if ( node
->GetData() == pItem
)
402 node
= node
->GetNext();
411 void wxMenu::MacEnableMenu( bool bDoEnable
)
414 UMAEnableMenuItem( m_hMenu
, 0 ) ;
416 UMADisableMenuItem( m_hMenu
, 0 ) ;
421 bool wxMenu::MacMenuSelect( wxEvtHandler
* handler
, long when
, int macMenuId
, int macMenuItemNum
)
426 if ( m_macMenuId
== macMenuId
)
428 node
= GetMenuItems().Nth(macMenuItemNum
-1);
431 wxMenuItem
*pItem
= (wxMenuItem
*)node
->Data();
433 if (pItem
->IsCheckable())
434 pItem
->Check(! pItem
->IsChecked());
436 wxCommandEvent
event(wxEVT_COMMAND_MENU_SELECTED
, pItem
->GetId());
437 event
.m_timeStamp
= when
;
438 event
.SetEventObject(handler
);
439 event
.SetInt( pItem
->GetId() );
441 bool processed
= false ;
443 #if WXWIN_COMPATIBILITY
447 (void) (*(m_callback
)) (*this, event
);
451 // Try the menu's event handler
452 if ( !processed
&& handler
)
454 processed
= handler
->ProcessEvent(event
);
457 // Try the window the menu was popped up from (and up
458 // through the hierarchy)
459 if ( !processed
&& GetInvokingWindow())
460 processed
= GetInvokingWindow()->GetEventHandler()->ProcessEvent(event
);
466 else if ( macMenuId
== kHMHelpMenuID
)
468 int menuItem
= formerHelpMenuItems
;
469 for (pos
= 0, node
= GetMenuItems().First(); node
; node
= node
->Next(), pos
++)
471 wxMenuItem
* pItem
= (wxMenuItem
*) node
->Data() ;
473 wxMenu
*pSubMenu
= pItem
->GetSubMenu() ;
474 if ( pSubMenu
!= NULL
)
479 if ( pItem
->GetId() != wxApp::s_macAboutMenuItemId
)
482 if ( menuItem
== macMenuItemNum
)
484 wxCommandEvent
event(wxEVT_COMMAND_MENU_SELECTED
, pItem
->GetId());
485 event
.m_timeStamp
= when
;
486 event
.SetEventObject(handler
);
487 event
.SetInt( pItem
->GetId() );
489 bool processed
= false ;
490 #if WXWIN_COMPATIBILITY
494 (void) (*(m_callback
)) (*this, event
);
498 // Try the menu's event handler
499 if ( !processed
&& handler
)
501 processed
= handler
->ProcessEvent(event
);
504 // Try the window the menu was popped up from (and up
505 // through the hierarchy)
506 if ( !processed
&& GetInvokingWindow())
507 processed
= GetInvokingWindow()->GetEventHandler()->ProcessEvent(event
);
514 #endif // __WXMAC_X__
516 for (pos
= 0, node
= GetMenuItems().First(); node
; node
= node
->Next(), pos
++)
518 wxMenuItem
* pItem
= (wxMenuItem
*) node
->Data() ;
520 wxMenu
*pSubMenu
= pItem
->GetSubMenu() ;
521 if ( pSubMenu
!= NULL
)
523 if ( pSubMenu
->MacMenuSelect( handler
, when
, macMenuId
, macMenuItemNum
) )
535 Mac Implementation note :
537 The Mac has only one global menubar, so we attempt to install the currently
538 active menubar from a frame, we currently don't take into account mdi-frames
539 which would ask for menu-merging
541 Secondly there is no mac api for changing a menubar that is not the current
542 menubar, so we have to wait for preparing the actual menubar until the
543 wxMenubar is to be used
545 We can in subsequent versions use MacInstallMenuBar to provide some sort of
546 auto-merge for MDI in case this will be necessary
550 wxMenuBar
* wxMenuBar::s_macInstalledMenuBar
= NULL
;
552 void wxMenuBar::Init()
554 m_eventHandler
= this;
555 m_menuBarFrame
= NULL
;
558 wxMenuBar::wxMenuBar()
563 wxMenuBar::wxMenuBar( long WXUNUSED(style
) )
569 wxMenuBar::wxMenuBar(int count
, wxMenu
*menus
[], const wxString titles
[])
573 m_titles
.Alloc(count
);
575 for ( int i
= 0; i
< count
; i
++ )
577 m_menus
.Append(menus
[i
]);
578 m_titles
.Add(titles
[i
]);
580 menus
[i
]->Attach(this);
584 wxMenuBar::~wxMenuBar()
586 if (s_macInstalledMenuBar
== this)
589 s_macInstalledMenuBar
= NULL
;
594 void wxMenuBar::Refresh()
596 wxCHECK_RET( IsAttached(), wxT("can't refresh unatteched menubar") );
603 void wxMenuBar::RebuildAccelTable()
605 // merge the accelerators of all menus into one accel table
606 size_t nAccelCount
= 0;
607 size_t i
, count
= GetMenuCount();
608 for ( i
= 0; i
< count
; i
++ )
610 nAccelCount
+= m_menus
[i
]->GetAccelCount();
615 wxAcceleratorEntry
*accelEntries
= new wxAcceleratorEntry
[nAccelCount
];
618 for ( i
= 0; i
< count
; i
++ )
620 nAccelCount
+= m_menus
[i
]->CopyAccels(&accelEntries
[nAccelCount
]);
623 m_accelTable
= wxAcceleratorTable(nAccelCount
, accelEntries
);
625 delete [] accelEntries
;
629 #endif // wxUSE_ACCEL
632 void wxMenuBar::MacInstallMenuBar()
634 if ( s_macInstalledMenuBar
== this )
637 Handle menubar
= ::GetNewMBar( kwxMacMenuBarResource
) ;
639 wxCHECK_RET( menubar
!= NULL
, "can't read MBAR resource" );
640 ::SetMenuBar( menubar
) ;
641 ::DisposeHandle( menubar
) ;
643 MenuHandle menu
= ::GetMenuHandle( kwxMacAppleMenuId
) ;
644 ::AppendResMenu(menu
, 'DRVR');
646 for (int i
= 0; i
< m_menus
.GetCount(); i
++)
652 wxMenu
* menu
= m_menus
[i
] , *subMenu
= NULL
;
655 /* the help menu does not exist in CARBON anymore */
656 if( m_titles
[i
] == "?" || m_titles
[i
] == "&?" || m_titles
[i
] == wxApp::s_macHelpMenuTitleName
)
658 MenuHandle mh
= NULL
;
659 if ( HMGetHelpMenuHandle( &mh
) != noErr
)
663 if ( formerHelpMenuItems
== 0 )
666 formerHelpMenuItems
= CountMenuItems( mh
) ;
669 for (pos
= 0 , node
= menu
->GetMenuItems().First(); node
; node
= node
->Next(), pos
++)
671 item
= (wxMenuItem
*)node
->Data();
672 subMenu
= item
->GetSubMenu() ;
675 // we don't support hierarchical menus in the help menu yet
679 if ( item
->IsSeparator() )
682 UMAAppendMenuItem(mh
, "\p-" );
689 wxMenuItem::MacBuildMenuString( label
, &key
, &modifiers
, item
->GetText(), item
->GetId() != wxApp::s_macAboutMenuItemId
); // no shortcut in about menu
692 // we cannot add empty menus on mac
696 if ( item
->GetId() == wxApp::s_macAboutMenuItemId
)
698 UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId
) , 1 , label
);
699 UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId
) , 1 );
704 UMAAppendMenuItem(mh
, label
, key
, modifiers
);
711 if( m_titles
[i
] == "?" || m_titles
[i
] == "&?" || m_titles
[i
] == wxApp::s_macHelpMenuTitleName
)
713 wxMenuItem::MacBuildMenuString( label
, NULL
, NULL
, m_titles
[i
] , false );
714 UMASetMenuTitle( menu
->GetHMenu() , label
) ;
716 for (pos
= 0 , node
= menu
->GetMenuItems().First(); node
; node
= node
->Next(), pos
++)
718 item
= (wxMenuItem
*)node
->Data();
719 subMenu
= item
->GetSubMenu() ;
722 UMAInsertMenu( subMenu
->GetHMenu() , -1 ) ;
726 if ( item
->GetId() == wxApp::s_macAboutMenuItemId
)
731 wxMenuItem::MacBuildMenuString( label
, &key
, &modifiers
, item
->GetText(), item
->GetId() != wxApp::s_macAboutMenuItemId
); // no shortcut in about menu
732 UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId
) , 1 , label
);
733 UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId
) , 1 );
737 UMAInsertMenu(m_menus
[i
]->GetHMenu(), 0);
742 wxMenuItem::MacBuildMenuString( label
, NULL
, NULL
, m_titles
[i
] , false );
743 UMASetMenuTitle( menu
->GetHMenu() , label
) ;
744 for (pos
= 0, node
= menu
->GetMenuItems().First(); node
; node
= node
->Next(), pos
++)
746 item
= (wxMenuItem
*)node
->Data();
747 subMenu
= item
->GetSubMenu() ;
750 UMAInsertMenu( subMenu
->GetHMenu() , -1 ) ;
753 UMAInsertMenu(m_menus
[i
]->GetHMenu(), 0);
758 s_macInstalledMenuBar
= this;
761 void wxMenuBar::EnableTop(size_t pos
, bool enable
)
763 wxCHECK_RET( IsAttached(), wxT("doesn't work with unattached menubars") );
764 m_menus
[pos
]->MacEnableMenu( enable
) ;
768 void wxMenuBar::SetLabelTop(size_t pos
, const wxString
& label
)
770 wxCHECK_RET( pos
< GetMenuCount(), wxT("invalid menu index") );
772 m_titles
[pos
] = label
;
779 m_menus
[pos
]->SetTitle( label
) ;
780 if (wxMenuBar::s_macInstalledMenuBar
== this) // are we currently installed ?
782 ::SetMenuBar( GetMenuBar() ) ;
787 wxString
wxMenuBar::GetLabelTop(size_t pos
) const
789 wxCHECK_MSG( pos
< GetMenuCount(), wxEmptyString
,
790 wxT("invalid menu index in wxMenuBar::GetLabelTop") );
792 return m_titles
[pos
];
795 int wxMenuBar::FindMenu(const wxString
& title
)
797 wxString menuTitle
= wxStripMenuCodes(title
);
799 size_t count
= GetMenuCount();
800 for ( size_t i
= 0; i
< count
; i
++ )
802 wxString title
= wxStripMenuCodes(m_titles
[i
]);
803 if ( menuTitle
== title
)
812 // ---------------------------------------------------------------------------
813 // wxMenuBar construction
814 // ---------------------------------------------------------------------------
816 // ---------------------------------------------------------------------------
817 // wxMenuBar construction
818 // ---------------------------------------------------------------------------
820 wxMenu
*wxMenuBar::Replace(size_t pos
, wxMenu
*menu
, const wxString
& title
)
822 wxMenu
*menuOld
= wxMenuBarBase::Replace(pos
, menu
, title
);
825 m_titles
[pos
] = title
;
829 if (s_macInstalledMenuBar
== this)
831 UMADeleteMenu( menuOld
->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
834 wxMenuItem::MacBuildMenuString( label
, NULL
, NULL
, title
, false );
835 UMASetMenuTitle( menu
->GetHMenu() , label
) ;
836 if ( pos
== m_menus
.GetCount() - 1)
838 UMAInsertMenu( menu
->GetHMenu() , 0 ) ;
842 UMAInsertMenu( menu
->GetHMenu() , m_menus
[pos
+1]->MacGetMenuId() ) ;
849 if ( menuOld
->HasAccels() || menu
->HasAccels() )
851 // need to rebuild accell table
854 #endif // wxUSE_ACCEL
862 bool wxMenuBar::Insert(size_t pos
, wxMenu
*menu
, const wxString
& title
)
864 if ( !wxMenuBarBase::Insert(pos
, menu
, title
) )
867 m_titles
.Insert(title
, pos
);
873 if ( pos
== (size_t) -1 )
875 ::InsertMenu( menu
->GetHMenu() , 0 ) ;
879 ::InsertMenu( menu
->GetHMenu() , m_menus
[pos
+1]->MacGetMenuId() ) ;
883 if ( menu
->HasAccels() )
885 // need to rebuild accell table
888 #endif // wxUSE_ACCEL
896 void wxMenuBar::MacMenuSelect(wxEvtHandler
* handler
, long when
, int macMenuId
, int macMenuItemNum
)
898 // first scan fast for direct commands, i.e. menus which have these commands directly in their own list
900 if ( macMenuId
== kwxMacAppleMenuId
&& macMenuItemNum
== 1 )
902 wxCommandEvent
event(wxEVT_COMMAND_MENU_SELECTED
, wxApp::s_macAboutMenuItemId
);
903 event
.m_timeStamp
= when
;
904 event
.SetEventObject(handler
);
905 event
.SetInt( wxApp::s_macAboutMenuItemId
);
906 handler
->ProcessEvent(event
);
910 for (int i
= 0; i
< m_menus
.GetCount() ; i
++)
912 if ( m_menus
[i
]->MacGetMenuId() == macMenuId
915 ( macMenuId
== kHMHelpMenuID
&& ( m_titles
[i
] == "?" || m_titles
[i
] == "&?" || m_titles
[i
] == wxApp::s_macHelpMenuTitleName
) )
919 if ( m_menus
[i
]->MacMenuSelect( handler
, when
, macMenuId
, macMenuItemNum
) )
923 //TODO flag this as an error since it must contain the item
929 for (int i
= 0; i
< m_menus
.GetCount(); i
++)
931 if ( m_menus
[i
]->MacMenuSelect( handler
, when
, macMenuId
, macMenuItemNum
) )
939 wxMenu
*wxMenuBar::Remove(size_t pos
)
941 wxMenu
*menu
= wxMenuBarBase::Remove(pos
);
947 if (s_macInstalledMenuBar
== this)
949 ::DeleteMenu( menu
->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
955 if ( menu
->HasAccels() )
957 // need to rebuild accell table
960 #endif // wxUSE_ACCEL
965 m_titles
.Remove(pos
);
970 bool wxMenuBar::Append(wxMenu
*menu
, const wxString
& title
)
972 WXHMENU submenu
= menu
? menu
->GetHMenu() : 0;
973 wxCHECK_MSG( submenu
, FALSE
, wxT("can't append invalid menu to menubar") );
975 if ( !wxMenuBarBase::Append(menu
, title
) )
984 if (s_macInstalledMenuBar
== this)
986 ::InsertMenu( menu
->GetHMenu() , 0 ) ;
990 if ( menu
->HasAccels() )
992 // need to rebuild accell table
995 #endif // wxUSE_ACCEL
1003 void wxMenuBar::Attach(wxFrame
*frame
)
1005 // wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
1007 m_menuBarFrame
= frame
;
1010 RebuildAccelTable();
1011 #endif // wxUSE_ACCEL
1013 // ---------------------------------------------------------------------------
1014 // wxMenuBar searching for menu items
1015 // ---------------------------------------------------------------------------
1017 // Find the itemString in menuString, and return the item id or wxNOT_FOUND
1018 int wxMenuBar::FindMenuItem(const wxString
& menuString
,
1019 const wxString
& itemString
) const
1021 wxString menuLabel
= wxStripMenuCodes(menuString
);
1022 size_t count
= GetMenuCount();
1023 for ( size_t i
= 0; i
< count
; i
++ )
1025 wxString title
= wxStripMenuCodes(m_titles
[i
]);
1026 if ( menuString
== title
)
1027 return m_menus
[i
]->FindItem(itemString
);
1033 wxMenuItem
*wxMenuBar::FindItem(int id
, wxMenu
**itemMenu
) const
1038 wxMenuItem
*item
= NULL
;
1039 size_t count
= GetMenuCount();
1040 for ( size_t i
= 0; !item
&& (i
< count
); i
++ )
1042 item
= m_menus
[i
]->FindItem(id
, itemMenu
);