]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/menu.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMenu, wxMenuBar, wxMenuItem
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "menu.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
29 #include "wx/ownerdrw.h"
32 #include "wx/os2/private.h"
34 // other standard headers
37 // ----------------------------------------------------------------------------
39 // ----------------------------------------------------------------------------
41 extern wxMenu
* wxCurrentPopupMenu
;
43 // ----------------------------------------------------------------------------
45 // ----------------------------------------------------------------------------
48 // The (popup) menu title has this special id
50 static const int idMenuTitle
= -2;
53 // The unique ID for Menus
56 USHORT
wxMenu::m_nextMenuId
= 0;
58 static USHORT
wxMenu::m_nextMenuId
= 0;
61 // ----------------------------------------------------------------------------
63 // ----------------------------------------------------------------------------
65 IMPLEMENT_DYNAMIC_CLASS(wxMenu
, wxEvtHandler
)
66 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar
, wxEvtHandler
)
68 // ----------------------------------------------------------------------------
69 // static function for translating menu labels
70 // ----------------------------------------------------------------------------
72 static wxString
TextToLabel(const wxString
& rTitle
)
76 for (pc
= rTitle
.c_str(); *pc
!= wxT('\0'); pc
++ )
80 if (*(pc
+1) == wxT('&'))
90 if ( *pc
== wxT('~') )
92 // tildes must be doubled to prevent them from being
93 // interpreted as accelerator character prefix by PM ???
102 // ============================================================================
104 // ============================================================================
106 // ---------------------------------------------------------------------------
107 // wxMenu construction, adding and removing menu items
108 // ---------------------------------------------------------------------------
111 // Construct a menu with optional title (then use append)
118 // Create the menu (to be used as a submenu or a popup)
120 if ((m_hMenu
= ::WinCreateWindow( HWND_DESKTOP
135 wxLogLastError("WinLoadMenu");
137 m_vMenuData
.iPosition
= 0;
138 m_vMenuData
.afStyle
= MIS_SUBMENU
| MIS_TEXT
;
139 m_vMenuData
.afAttribute
= (USHORT
)0;
140 m_vMenuData
.id
= m_nextMenuId
++;
141 m_vMenuData
.hwndSubMenu
= m_hMenu
;
142 m_vMenuData
.hItem
= NULLHANDLE
;
145 // If we have a title, insert it in the beginning of the menu
147 if (!m_title
.IsEmpty())
154 } // end of wxMenu::Init
157 // The wxWindow destructor will take care of deleting the submenus.
162 // We should free PM resources only if PM doesn't do it for us
163 // which happens if we're attached to a menubar or a submenu of another
165 if (!IsAttached() && !GetParent())
167 if (!::WinDestroyWindow((HWND
)GetHmenu()) )
169 wxLogLastError("WinDestroyWindow");
177 #if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
178 WX_CLEAR_ARRAY(m_vAccels
);
180 #endif // wxUSE_ACCEL
181 } // end of wxMenu::~wxMenu
185 // this will take effect during the next call to Append()
187 } // end of wxMenu::Break
191 int wxMenu::FindAccel(
196 size_t nCount
= m_vAccels
.GetCount();
198 for (n
= 0; n
< nCount
; n
++)
200 if (m_vAccels
[n
]->m_command
== nId
)
204 } // end of wxMenu::FindAccel
206 void wxMenu::UpdateAccel(
211 // Find the (new) accel for this item
213 wxAcceleratorEntry
* pAccel
= wxGetAccelFromString(pItem
->GetText());
216 pAccel
->m_command
= pItem
->GetId();
221 int n
= FindAccel(pItem
->GetId());
223 if (n
== wxNOT_FOUND
)
226 // No old, add new if any
229 m_vAccels
.Add(pAccel
);
231 return; // skipping RebuildAccelTable() below
236 // Replace old with new or just remove the old one if no new
241 m_vAccels
[n
] = pAccel
;
243 m_vAccels
.RemoveAt(n
);
248 m_menuBar
->RebuildAccelTable();
250 } // wxMenu::UpdateAccel
252 #endif // wxUSE_ACCEL
255 // Append a new item or submenu to the menu
257 bool wxMenu::DoInsertOrAppend(
267 #endif // wxUSE_ACCEL
270 // rItem is the member MENUITEM for the menu items and the submenu's
271 // MENUITEM for submenus as required by ::MM_INSERTITEM message API
274 wxMenu
* pSubmenu
= pItem
->GetSubMenu();
275 MENUITEM
& rItem
= (pSubmenu
!= NULL
)?pSubmenu
->m_vMenuData
:
279 wxASSERT_MSG(pSubmenu
->GetHMenu(), wxT("invalid submenu"));
280 pSubmenu
->SetParent(this);
281 rItem
.afStyle
|= MIS_SUBMENU
| MIS_TEXT
;
285 // If "Break" has just been called, insert a menu break before this item
286 // (and don't forget to reset the flag)
290 rItem
.afStyle
|= MIS_BREAK
;
294 if (pItem
->IsSeparator())
296 rItem
.afStyle
|= MIS_SEPARATOR
;
300 // Id is the numeric id for normal menu items and HMENU for submenus as
301 // required by ::MM_INSERTITEM message API
304 if (pSubmenu
!= NULL
)
306 wxASSERT_MSG(pSubmenu
->GetHMenu(), wxT("invalid submenu"));
307 pSubmenu
->SetParent(this);
309 rItem
.iPosition
= 0; // submenus have a 0 position
310 rItem
.id
= (USHORT
)pSubmenu
->GetHMenu();
311 rItem
.afStyle
|= MIS_SUBMENU
| MIS_TEXT
;
315 rItem
.id
= pItem
->GetId();
320 #if wxUSE_OWNER_DRAWN
321 if (pItem
->IsOwnerDrawn())
324 // Want to get {Measure|Draw}Item messages?
325 // item draws itself, passing pointer to data doesn't work in OS/2
326 // Will eventually need to set the image handle somewhere into vItem.hItem
328 rItem
.afStyle
|= MIS_OWNERDRAW
;
330 rItem
.hItem
= (HBITMAP
)pItem
->GetBitmap().GetHBITMAP();
331 pItem
->m_vMenuData
.afStyle
= rItem
.afStyle
;
332 pItem
->m_vMenuData
.hItem
= rItem
.hItem
;
338 // Menu is just a normal string (passed in data parameter)
340 rItem
.afStyle
|= MIS_TEXT
;
341 pData
= (char*)pItem
->GetText().c_str();
344 if (nPos
== (size_t)-1)
346 rItem
.iPosition
= MIT_END
;
350 rItem
.iPosition
= nPos
;
355 rc
= (APIRET
)::WinSendMsg( GetHmenu()
360 #if wxUSE_OWNER_DRAWN
361 if (pItem
->IsOwnerDrawn())
366 ::WinSendMsg( GetHmenu()
368 ,MPFROM2SHORT( (USHORT
)pItem
->GetId()
375 if (rc
== MIT_MEMERROR
|| rc
== MIT_ERROR
)
377 vError
= ::WinGetLastError(vHabmain
);
378 sError
= wxPMErrorToStr(vError
);
379 wxLogError("Error inserting or appending a menuitem. Error: %s\n", sError
);
380 wxLogLastError("Insert or AppendMenu");
386 // If we're already attached to the menubar, we must update it
388 if (IsAttached() && m_menuBar
->IsAttached())
390 m_menuBar
->Refresh();
395 } // end of wxMenu::DoInsertOrAppend
397 bool wxMenu::DoAppend(
401 wxCHECK_MSG( pItem
, FALSE
, _T("NULL item in wxMenu::DoAppend") );
405 if (pItem
->GetKind() == wxITEM_RADIO
)
407 int nCount
= GetMenuItemCount();
409 if (m_lStartRadioGroup
== -1)
412 // Start a new radio group
414 m_lStartRadioGroup
= lCount
;
417 // For now it has just one element
419 pItem
->SetAsRadioGroupStart();
420 pItem
->SetRadioGroupEnd(m_startRadioGroup
);
423 // Ensure that we have a checked item in the radio group
427 else // extend the current radio group
430 // We need to update its end item
432 pItem
->SetRadioGroupStart(m_lStartRadioGroup
);
433 wxMenuItemList::Node
*node
= GetMenuItems().Item(m_startRadioGroup
);
437 node
->GetData()->SetRadioGroupEnd(count
);
441 wxFAIL_MSG( _T("where is the radio group start item?") );
445 else // not a radio item
449 if (!wxMenuBase::DoAppend(pItem
) || !DoInsertOrAppend(pItem
))
458 } // end of wxMenu::DoInsert
460 bool wxMenu::DoInsert(
465 return ( wxMenuBase::DoInsert( nPos
467 DoInsertOrAppend( pItem
470 } // end of wxMenu::DoInsert
472 wxMenuItem
* wxMenu::DoRemove(
477 // We need to find the items position in the child list
480 wxMenuItemList::Node
* pNode
= GetMenuItems().GetFirst();
482 for (nPos
= 0; pNode
; nPos
++)
484 if (pNode
->GetData() == pItem
)
486 pNode
= pNode
->GetNext();
490 // DoRemove() (unlike Remove) can only be called for existing item!
492 wxCHECK_MSG(pNode
, NULL
, wxT("bug in wxMenu::Remove logic"));
496 // Remove the corresponding accel from the accel table
498 int n
= FindAccel(pItem
->GetId());
500 if (n
!= wxNOT_FOUND
)
503 m_vAccels
.RemoveAt(n
);
506 #endif // wxUSE_ACCEL
508 // Remove the item from the menu
510 ::WinSendMsg( GetHmenu()
512 ,MPFROM2SHORT(pItem
->GetId(), TRUE
)
515 if (IsAttached() && m_menuBar
->IsAttached())
518 // Otherwise, the chane won't be visible
520 m_menuBar
->Refresh();
524 // And from internal data structures
526 return wxMenuBase::DoRemove(pItem
);
527 } // end of wxMenu::DoRemove
529 // ---------------------------------------------------------------------------
530 // accelerator helpers
531 // ---------------------------------------------------------------------------
536 // Create the wxAcceleratorEntries for our accels and put them into provided
537 // array - return the number of accels we have
539 size_t wxMenu::CopyAccels(
540 wxAcceleratorEntry
* pAccels
543 size_t nCount
= GetAccelCount();
545 for (size_t n
= 0; n
< nCount
; n
++)
547 *pAccels
++ = *m_vAccels
[n
];
550 } // end of wxMenu::CopyAccels
552 #endif // wxUSE_ACCEL
554 // ---------------------------------------------------------------------------
556 // ---------------------------------------------------------------------------
558 void wxMenu::SetTitle(
559 const wxString
& rLabel
562 bool bHasNoTitle
= m_title
.IsEmpty();
563 HWND hMenu
= GetHmenu();
568 if (!rLabel
.IsEmpty())
570 if (!::WinSetWindowText(hMenu
, rLabel
.c_str()))
572 wxLogLastError("SetMenuTitle");
578 if (rLabel
.IsEmpty() )
580 ::WinSendMsg( GetHmenu()
582 ,MPFROM2SHORT(hMenu
, TRUE
)
591 if (!::WinSetWindowText(hMenu
, rLabel
.c_str()))
593 wxLogLastError("SetMenuTitle");
597 } // end of wxMenu::SetTitle
599 // ---------------------------------------------------------------------------
601 // ---------------------------------------------------------------------------
603 bool wxMenu::OS2Command(
604 WXUINT
WXUNUSED(uParam
)
609 // Ignore commands from the menu title
612 if (vId
!= (WXWORD
)idMenuTitle
)
615 ,(int)::WinSendMsg( GetHmenu()
623 } // end of wxMenu::OS2Command
625 // ---------------------------------------------------------------------------
627 // ---------------------------------------------------------------------------
629 wxWindow
* wxMenu::GetWindow() const
631 if (m_invokingWindow
!= NULL
)
632 return m_invokingWindow
;
633 else if ( m_menuBar
!= NULL
)
634 return m_menuBar
->GetFrame();
637 } // end of wxMenu::GetWindow
639 // recursive search for item by id
640 wxMenuItem
* wxMenu::FindItem(
643 , wxMenu
** ppItemMenu
649 wxMenuItem
* pItem
= NULL
;
651 for ( wxMenuItemList::Node
*node
= m_items
.GetFirst();
653 node
= node
->GetNext() )
655 pItem
= node
->GetData();
657 if ( pItem
->GetId() == nItemId
&& pItem
->m_vMenuData
.hItem
== hItem
)
660 *ppItemMenu
= (wxMenu
*)this;
662 else if ( pItem
->IsSubMenu() )
664 pItem
= pItem
->GetSubMenu()->FindItem( nItemId
673 // don't exit the loop
678 } // end of wxMenu::FindItem
680 // ---------------------------------------------------------------------------
682 // ---------------------------------------------------------------------------
684 void wxMenuBar::Init()
686 m_eventHandler
= this;
687 m_menuBarFrame
= NULL
;
689 } // end of wxMenuBar::Init
691 wxMenuBar::wxMenuBar()
694 } // end of wxMenuBar::wxMenuBar
696 wxMenuBar::wxMenuBar(
697 long WXUNUSED(lStyle
)
701 } // end of wxMenuBar::wxMenuBar
703 wxMenuBar::wxMenuBar(
706 , const wxString sTitles
[]
711 m_titles
.Alloc(nCount
);
712 for ( int i
= 0; i
< nCount
; i
++ )
714 m_menus
.Append(vMenus
[i
]);
715 m_titles
.Add(sTitles
[i
]);
716 vMenus
[i
]->Attach(this);
718 } // end of wxMenuBar::wxMenuBar
720 wxMenuBar::~wxMenuBar()
722 } // end of wxMenuBar::~wxMenuBar
724 // ---------------------------------------------------------------------------
726 // ---------------------------------------------------------------------------
728 void wxMenuBar::Refresh()
730 wxCHECK_RET( IsAttached(), wxT("can't refresh unatteched menubar") );
732 WinSendMsg(GetWinHwnd(m_menuBarFrame
), WM_UPDATEFRAME
, (MPARAM
)FCF_MENU
, (MPARAM
)0);
733 } // end of wxMenuBar::Refresh
735 WXHMENU
wxMenuBar::Create()
743 wxCHECK_MSG(!m_hMenu
, TRUE
, wxT("menubar already created"));
746 // Menubars should be associated with a frame otherwise they are popups
748 if (m_menuBarFrame
!= NULL
)
749 hFrame
= GetWinHwnd(m_menuBarFrame
);
751 hFrame
= HWND_DESKTOP
;
753 // Create an empty menu and then fill it with insertions
755 if ((m_hMenu
= ::WinCreateWindow( hFrame
758 ,MS_ACTIONBAR
| WS_SYNCPAINT
| WS_VISIBLE
770 wxLogLastError("WinLoadMenu");
774 size_t nCount
= GetMenuCount();
776 for (size_t i
= 0; i
< nCount
; i
++)
784 // Set the parent and owner of the submenues to be the menubar, not the desktop
786 hSubMenu
= m_menus
[i
]->m_vMenuData
.hwndSubMenu
;
787 if (!::WinSetParent(m_menus
[i
]->m_vMenuData
.hwndSubMenu
, m_hMenu
, FALSE
))
789 vError
= ::WinGetLastError(vHabmain
);
790 sError
= wxPMErrorToStr(vError
);
791 wxLogError("Error setting parent for submenu. Error: %s\n", sError
);
795 if (!::WinSetOwner(m_menus
[i
]->m_vMenuData
.hwndSubMenu
, m_hMenu
))
797 vError
= ::WinGetLastError(vHabmain
);
798 sError
= wxPMErrorToStr(vError
);
799 wxLogError("Error setting parent for submenu. Error: %s\n", sError
);
803 m_menus
[i
]->m_vMenuData
.iPosition
= i
;
805 rc
= (APIRET
)::WinSendMsg(m_hMenu
, MM_INSERTITEM
, (MPARAM
)&m_menus
[i
]->m_vMenuData
, (MPARAM
)m_titles
[i
].c_str());
806 if (rc
== MIT_MEMERROR
|| rc
== MIT_ERROR
)
808 vError
= ::WinGetLastError(vHabmain
);
809 sError
= wxPMErrorToStr(vError
);
810 wxLogError("Error inserting or appending a menuitem. Error: %s\n", sError
);
816 } // end of wxMenuBar::Create
818 // ---------------------------------------------------------------------------
819 // wxMenuBar functions to work with the top level submenus
820 // ---------------------------------------------------------------------------
823 // NB: we don't support owner drawn top level items for now, if we do these
824 // functions would have to be changed to use wxMenuItem as well
826 void wxMenuBar::EnableTop(
831 wxCHECK_RET(IsAttached(), wxT("doesn't work with unattached menubars"));
836 uFlag
= MIA_DISABLED
;
838 nId
= SHORT1FROMMR(::WinSendMsg((HWND
)m_hMenu
, MM_ITEMIDFROMPOSITION
, MPFROMSHORT(nPos
), (MPARAM
)0));
839 if (nId
== MIT_ERROR
)
841 wxLogLastError("LogLastError");
844 ::WinSendMsg((HWND
)m_hMenu
, MM_SETITEMATTR
, MPFROM2SHORT(nId
, TRUE
), MPFROM2SHORT(MIA_DISABLED
, uFlag
));
846 } // end of wxMenuBar::EnableTop
848 void wxMenuBar::SetLabelTop(
850 , const wxString
& rLabel
856 wxCHECK_RET(nPos
< GetMenuCount(), wxT("invalid menu index"));
857 m_titles
[nPos
] = rLabel
;
864 nId
= SHORT1FROMMR(::WinSendMsg((HWND
)m_hMenu
, MM_ITEMIDFROMPOSITION
, MPFROMSHORT(nPos
), (MPARAM
)0));
865 if (nId
== MIT_ERROR
)
867 wxLogLastError("LogLastError");
870 if(!::WinSendMsg( (HWND
)m_hMenu
872 ,MPFROM2SHORT(nId
, TRUE
)
876 wxLogLastError("QueryItem");
880 if (::WinSendMsg(GetHmenu(), MM_SETITEMTEXT
, MPFROMSHORT(nId
), (MPARAM
)rLabel
.c_str()));
882 wxLogLastError("ModifyMenu");
885 } // end of wxMenuBar::SetLabelTop
887 wxString
wxMenuBar::GetLabelTop(
891 wxCHECK_MSG( nPos
< GetMenuCount(), wxEmptyString
,
892 wxT("invalid menu index in wxMenuBar::GetLabelTop") );
893 return m_titles
[nPos
];
894 } // end of wxMenuBar::GetLabelTop
896 // ---------------------------------------------------------------------------
897 // wxMenuBar construction
898 // ---------------------------------------------------------------------------
900 wxMenu
* wxMenuBar::Replace(
903 , const wxString
& rTitle
907 wxString Title
= TextToLabel(rTitle
);
908 wxMenu
* pMenuOld
= wxMenuBarBase::Replace( nPos
914 nId
= SHORT1FROMMR(::WinSendMsg((HWND
)m_hMenu
, MM_ITEMIDFROMPOSITION
, MPFROMSHORT(nPos
), (MPARAM
)0));
915 if (nId
== MIT_ERROR
)
917 wxLogLastError("LogLastError");
922 m_titles
[nPos
] = Title
;
925 ::WinSendMsg((HWND
)m_hMenu
, MM_REMOVEITEM
, MPFROM2SHORT(nId
, TRUE
), (MPARAM
)0);
926 ::WinSendMsg((HWND
)m_hMenu
, MM_INSERTITEM
, (MPARAM
)&pMenu
->m_vMenuData
, (MPARAM
)Title
.c_str());
929 if (pMenuOld
->HasAccels() || pMenu
->HasAccels())
932 // Need to rebuild accell table
936 #endif // wxUSE_ACCEL
940 } // end of wxMenuBar::Replace
942 bool wxMenuBar::Insert(
945 , const wxString
& rTitle
948 wxString Title
= TextToLabel(rTitle
);
949 if (!wxMenuBarBase::Insert( nPos
955 m_titles
.Insert( Title
961 ::WinSendMsg((HWND
)m_hMenu
, MM_INSERTITEM
, (MPARAM
)&pMenu
->m_vMenuData
, (MPARAM
)Title
.c_str());
963 if (pMenu
->HasAccels())
965 // need to rebuild accell table
968 #endif // wxUSE_ACCEL
972 } // end of wxMenuBar::Insert
974 bool wxMenuBar::Append(
976 , const wxString
& rTitle
979 WXHMENU hSubmenu
= pMenu
? pMenu
->GetHMenu() : 0;
981 wxCHECK_MSG(hSubmenu
, FALSE
, wxT("can't append invalid menu to menubar"));
983 wxString Title
= TextToLabel(rTitle
);
984 if (!wxMenuBarBase::Append(pMenu
, Title
))
991 pMenu
->m_vMenuData
.iPosition
= MIT_END
;
992 ::WinSendMsg((HWND
)m_hMenu
, MM_INSERTITEM
, (MPARAM
)&pMenu
->m_vMenuData
, (MPARAM
)Title
.c_str());
994 if (pMenu
->HasAccels())
997 // Need to rebuild accell table
1001 #endif // wxUSE_ACCEL
1005 } // end of wxMenuBar::Append
1007 wxMenu
* wxMenuBar::Remove(
1011 wxMenu
* pMenu
= wxMenuBarBase::Remove(nPos
);
1017 nId
= SHORT1FROMMR(::WinSendMsg((HWND
)GetHmenu(), MM_ITEMIDFROMPOSITION
, MPFROMSHORT(nPos
), (MPARAM
)0));
1018 if (nId
== MIT_ERROR
)
1020 wxLogLastError("LogLastError");
1025 ::WinSendMsg((HWND
)GetHmenu(), MM_REMOVEITEM
, MPFROM2SHORT(nId
, TRUE
), (MPARAM
)0);
1028 if (pMenu
->HasAccels())
1031 // Need to rebuild accell table
1033 RebuildAccelTable();
1035 #endif // wxUSE_ACCEL
1038 m_titles
.Remove(nPos
);
1040 } // end of wxMenuBar::Remove
1044 void wxMenuBar::RebuildAccelTable()
1047 // Merge the accelerators of all menus into one accel table
1049 size_t nAccelCount
= 0;
1051 size_t nCount
= GetMenuCount();
1053 for (i
= 0; i
< nCount
; i
++)
1055 nAccelCount
+= m_menus
[i
]->GetAccelCount();
1060 wxAcceleratorEntry
* pAccelEntries
= new wxAcceleratorEntry
[nAccelCount
];
1063 for (i
= 0; i
< nCount
; i
++)
1065 nAccelCount
+= m_menus
[i
]->CopyAccels(&pAccelEntries
[nAccelCount
]);
1067 m_vAccelTable
= wxAcceleratorTable( nAccelCount
1070 delete [] pAccelEntries
;
1072 } // end of wxMenuBar::RebuildAccelTable
1074 #endif // wxUSE_ACCEL
1076 void wxMenuBar::Attach(
1080 wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
1083 RebuildAccelTable();
1085 // Ensure the accelerator table is set to the frame (not the client!)
1087 if (!::WinSetAccelTable( vHabmain
1088 ,(HWND
)pFrame
->GetHWND()
1089 ,m_vAccelTable
.GetHACCEL()
1091 wxLogLastError("WinSetAccelTable");
1092 #endif // wxUSE_ACCEL
1093 } // end of wxMenuBar::Attach
1095 void wxMenuBar::Detach()
1097 ::WinDestroyWindow((HWND
)m_hMenu
);
1098 m_hMenu
= (WXHMENU
)NULL
;
1099 m_menuBarFrame
= NULL
;
1100 } // end of wxMenuBar::Detach
1102 // ---------------------------------------------------------------------------
1103 // wxMenuBar searching for menu items
1104 // ---------------------------------------------------------------------------
1107 // Find the itemString in menuString, and return the item id or wxNOT_FOUND
1109 int wxMenuBar::FindMenuItem(
1110 const wxString
& rMenuString
1111 , const wxString
& rItemString
1114 wxString sMenuLabel
= wxStripMenuCodes(rMenuString
);
1115 size_t nCount
= GetMenuCount();
1117 for (size_t i
= 0; i
< nCount
; i
++)
1119 wxString sTitle
= wxStripMenuCodes(m_titles
[i
]);
1121 if (rMenuString
== sTitle
)
1122 return m_menus
[i
]->FindItem(rItemString
);
1125 } // end of wxMenuBar::FindMenuItem
1127 wxMenuItem
* wxMenuBar::FindItem(
1129 , wxMenu
** ppItemMenu
1135 wxMenuItem
* pItem
= NULL
;
1136 size_t nCount
= GetMenuCount();
1138 for (size_t i
= 0; !pItem
&& (i
< nCount
); i
++)
1140 pItem
= m_menus
[i
]->FindItem( nId
1145 } // end of wxMenuBar::FindItem
1147 wxMenuItem
* wxMenuBar::FindItem(
1150 , wxMenu
** ppItemMenu
1156 wxMenuItem
* pItem
= NULL
;
1157 size_t nCount
= GetMenuCount();
1159 for (size_t i
= 0; !pItem
&& (i
< nCount
); i
++)
1161 pItem
= m_menus
[i
]->FindItem( nId
1167 } // end of wxMenuBar::FindItem