]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/menu.cpp
09b81199006ab1c1d721c3fb23ce04322541d983
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
55 USHORT
wxMenu::m_nextMenuId
= 0;
57 // ----------------------------------------------------------------------------
59 // ----------------------------------------------------------------------------
61 IMPLEMENT_DYNAMIC_CLASS(wxMenu
, wxEvtHandler
)
62 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar
, wxEvtHandler
)
64 // ============================================================================
66 // ============================================================================
68 // ---------------------------------------------------------------------------
69 // wxMenu construction, adding and removing menu items
70 // ---------------------------------------------------------------------------
73 // Construct a menu with optional title (then use append)
78 m_nStartRadioGroup
= -1;
81 // Create the menu (to be used as a submenu or a popup)
83 if ((m_hMenu
= ::WinCreateWindow( HWND_DESKTOP
98 wxLogLastError("WinLoadMenu");
100 m_vMenuData
.iPosition
= 0;
101 m_vMenuData
.afStyle
= MIS_SUBMENU
| MIS_TEXT
;
102 m_vMenuData
.afAttribute
= (USHORT
)0;
103 m_vMenuData
.id
= m_nextMenuId
++;
104 m_vMenuData
.hwndSubMenu
= m_hMenu
;
105 m_vMenuData
.hItem
= NULLHANDLE
;
108 // If we have a title, insert it in the beginning of the menu
110 if (!m_title
.IsEmpty())
119 } // end of wxMenu::Init
122 // The wxWindow destructor will take care of deleting the submenus.
127 // We should free PM resources only if PM doesn't do it for us
128 // which happens if we're attached to a menubar or a submenu of another
130 if (!IsAttached() && !GetParent())
132 if (!::WinDestroyWindow((HWND
)GetHmenu()) )
134 wxLogLastError("WinDestroyWindow");
142 WX_CLEAR_ARRAY(m_vAccels
);
143 #endif // wxUSE_ACCEL
144 } // end of wxMenu::~wxMenu
148 // this will take effect during the next call to Append()
150 } // end of wxMenu::Break
153 wxMenuBarBase
* pMenubar
156 wxMenuBase::Attach(pMenubar
);
158 } // end of wxMenu::Break;
162 int wxMenu::FindAccel(
167 size_t nCount
= m_vAccels
.GetCount();
169 for (n
= 0; n
< nCount
; n
++)
170 if (m_vAccels
[n
]->m_command
== nId
)
173 } // end of wxMenu::FindAccel
175 void wxMenu::UpdateAccel(
179 if (pItem
->IsSubMenu())
181 wxMenu
* pSubmenu
= pItem
->GetSubMenu();
182 wxMenuItemList::Node
* pNode
= pSubmenu
->GetMenuItems().GetFirst();
186 UpdateAccel(pNode
->GetData());
187 pNode
= pNode
->GetNext();
190 else if (!pItem
->IsSeparator())
193 // Find the (new) accel for this item
195 wxAcceleratorEntry
* pAccel
= wxGetAccelFromString(pItem
->GetText());
198 pAccel
->m_command
= pItem
->GetId();
203 size_t n
= FindAccel(pItem
->GetId());
205 if (n
== wxNOT_FOUND
)
208 // No old, add new if any
211 m_vAccels
.Add(pAccel
);
218 // Replace old with new or just remove the old one if no new
222 m_vAccels
[n
] = pAccel
;
224 m_vAccels
.RemoveAt(n
);
229 m_menuBar
->RebuildAccelTable();
232 } // wxMenu::UpdateAccel
234 #endif // wxUSE_ACCEL
237 // Append a new item or submenu to the menu
239 bool wxMenu::DoInsertOrAppend(
244 wxMenu
* pSubmenu
= pItem
->GetSubMenu();
245 MENUITEM
& rItem
= (pSubmenu
!= NULL
)?pSubmenu
->m_vMenuData
:
254 #endif // wxUSE_ACCEL
257 // If "Break" has just been called, insert a menu break before this item
258 // (and don't forget to reset the flag)
262 rItem
.afStyle
|= MIS_BREAK
;
267 // Id is the numeric id for normal menu items and HMENU for submenus as
268 // required by ::MM_INSERTITEM message API
270 if (pSubmenu
!= NULL
)
272 wxASSERT_MSG(pSubmenu
->GetHMenu(), wxT("invalid submenu"));
273 pSubmenu
->SetParent(this);
275 rItem
.iPosition
= 0; // submenus have a 0 position
276 rItem
.id
= (USHORT
)pSubmenu
->GetHMenu();
277 rItem
.afStyle
|= MIS_SUBMENU
| MIS_TEXT
;
281 rItem
.id
= pItem
->GetId();
286 #if wxUSE_OWNER_DRAWN
287 if (pItem
->IsOwnerDrawn())
290 // Want to get {Measure|Draw}Item messages?
291 // item draws itself, passing pointer to data doesn't work in OS/2
292 // Will eventually need to set the image handle somewhere into vItem.hItem
294 rItem
.afStyle
|= MIS_OWNERDRAW
;
296 rItem
.hItem
= (HBITMAP
)pItem
->GetBitmap().GetHBITMAP();
297 pItem
->m_vMenuData
.afStyle
= rItem
.afStyle
;
298 pItem
->m_vMenuData
.hItem
= rItem
.hItem
;
302 if (pItem
->IsSeparator())
304 rItem
.afStyle
= MIS_SEPARATOR
;
309 // Menu is just a normal string (passed in data parameter)
311 rItem
.afStyle
|= MIS_TEXT
;
312 pData
= (char*)pItem
->GetText().c_str();
315 if (nPos
== (size_t)-1)
317 rItem
.iPosition
= MIT_END
;
321 rItem
.iPosition
= nPos
;
326 rc
= (APIRET
)::WinSendMsg( GetHmenu()
331 #if wxUSE_OWNER_DRAWN
332 if (pItem
->IsOwnerDrawn())
337 ::WinSendMsg( GetHmenu()
339 ,MPFROM2SHORT( (USHORT
)pItem
->GetId()
346 if (rc
== MIT_MEMERROR
|| rc
== MIT_ERROR
)
348 vError
= ::WinGetLastError(vHabmain
);
349 sError
= wxPMErrorToStr(vError
);
350 wxLogError("Error inserting or appending a menuitem. Error: %s\n", sError
.c_str());
351 wxLogLastError("Insert or AppendMenu");
357 // If we're already attached to the menubar, we must update it
359 if (IsAttached() && m_menuBar
->IsAttached())
361 m_menuBar
->Refresh();
366 } // end of wxMenu::DoInsertOrAppend
368 void wxMenu::EndRadioGroup()
371 // We're not inside a radio group any longer
373 m_nStartRadioGroup
= -1;
374 } // end of wxMenu::EndRadioGroup
376 wxMenuItem
* wxMenu::DoAppend(
380 wxCHECK_MSG( pItem
, NULL
, _T("NULL item in wxMenu::DoAppend") );
384 if (pItem
->GetKind() == wxITEM_RADIO
)
386 int nCount
= GetMenuItemCount();
388 if (m_nStartRadioGroup
== -1)
391 // Start a new radio group
393 m_nStartRadioGroup
= nCount
;
396 // For now it has just one element
398 pItem
->SetAsRadioGroupStart();
399 pItem
->SetRadioGroupEnd(m_nStartRadioGroup
);
402 // Ensure that we have a checked item in the radio group
406 else // extend the current radio group
409 // We need to update its end item
411 pItem
->SetRadioGroupStart(m_nStartRadioGroup
);
413 wxMenuItemList::Node
* pNode
= GetMenuItems().Item(m_nStartRadioGroup
);
417 pNode
->GetData()->SetRadioGroupEnd(nCount
);
421 wxFAIL_MSG( _T("where is the radio group start item?") );
425 else // not a radio item
430 if (!wxMenuBase::DoAppend(pItem
) || !DoInsertOrAppend(pItem
))
437 // Check the item initially
442 } // end of wxMenu::DoAppend
444 wxMenuItem
* wxMenu::DoInsert(
449 if ( wxMenuBase::DoInsert( nPos
451 DoInsertOrAppend( pItem
457 } // end of wxMenu::DoInsert
459 wxMenuItem
* wxMenu::DoRemove(
464 // We need to find the items position in the child list
467 wxMenuItemList::Node
* pNode
= GetMenuItems().GetFirst();
469 for (nPos
= 0; pNode
; nPos
++)
471 if (pNode
->GetData() == pItem
)
473 pNode
= pNode
->GetNext();
477 // DoRemove() (unlike Remove) can only be called for existing item!
479 wxCHECK_MSG(pNode
, NULL
, wxT("bug in wxMenu::Remove logic"));
483 // Remove the corresponding accel from the accel table
485 int n
= FindAccel(pItem
->GetId());
487 if (n
!= wxNOT_FOUND
)
490 m_vAccels
.RemoveAt(n
);
493 #endif // wxUSE_ACCEL
495 // Remove the item from the menu
497 ::WinSendMsg( GetHmenu()
499 ,MPFROM2SHORT(pItem
->GetId(), TRUE
)
502 if (IsAttached() && m_menuBar
->IsAttached())
505 // Otherwise, the chane won't be visible
507 m_menuBar
->Refresh();
511 // And from internal data structures
513 return wxMenuBase::DoRemove(pItem
);
514 } // end of wxMenu::DoRemove
516 // ---------------------------------------------------------------------------
517 // accelerator helpers
518 // ---------------------------------------------------------------------------
523 // Create the wxAcceleratorEntries for our accels and put them into provided
524 // array - return the number of accels we have
526 size_t wxMenu::CopyAccels(
527 wxAcceleratorEntry
* pAccels
530 size_t nCount
= GetAccelCount();
532 for (size_t n
= 0; n
< nCount
; n
++)
534 *pAccels
++ = *m_vAccels
[n
];
537 } // end of wxMenu::CopyAccels
539 #endif // wxUSE_ACCEL
541 // ---------------------------------------------------------------------------
543 // ---------------------------------------------------------------------------
545 void wxMenu::SetTitle(
546 const wxString
& rLabel
549 bool bHasNoTitle
= m_title
.IsEmpty();
550 HWND hMenu
= GetHmenu();
555 if (!rLabel
.IsEmpty())
557 if (!::WinSetWindowText(hMenu
, rLabel
.c_str()))
559 wxLogLastError("SetMenuTitle");
565 if (rLabel
.IsEmpty() )
567 ::WinSendMsg( GetHmenu()
569 ,MPFROM2SHORT(hMenu
, TRUE
)
578 if (!::WinSetWindowText(hMenu
, rLabel
.c_str()))
580 wxLogLastError("SetMenuTitle");
584 } // end of wxMenu::SetTitle
586 // ---------------------------------------------------------------------------
588 // ---------------------------------------------------------------------------
590 bool wxMenu::OS2Command(
591 WXUINT
WXUNUSED(uParam
)
596 // Ignore commands from the menu title
599 if (vId
!= (WXWORD
)idMenuTitle
)
602 ,(int)::WinSendMsg( GetHmenu()
610 } // end of wxMenu::OS2Command
612 // ---------------------------------------------------------------------------
614 // ---------------------------------------------------------------------------
616 wxWindow
* wxMenu::GetWindow() const
618 if (m_invokingWindow
!= NULL
)
619 return m_invokingWindow
;
620 else if ( m_menuBar
!= NULL
)
621 return m_menuBar
->GetFrame();
624 } // end of wxMenu::GetWindow
626 // recursive search for item by id
627 wxMenuItem
* wxMenu::FindItem(
630 , wxMenu
** ppItemMenu
636 wxMenuItem
* pItem
= NULL
;
638 for ( wxMenuItemList::Node
*node
= m_items
.GetFirst();
640 node
= node
->GetNext() )
642 pItem
= node
->GetData();
644 if ( pItem
->GetId() == nItemId
&& pItem
->m_vMenuData
.hItem
== hItem
)
647 *ppItemMenu
= (wxMenu
*)this;
649 else if ( pItem
->IsSubMenu() )
651 pItem
= pItem
->GetSubMenu()->FindItem( nItemId
660 // don't exit the loop
665 } // end of wxMenu::FindItem
667 // ---------------------------------------------------------------------------
669 // ---------------------------------------------------------------------------
671 void wxMenuBar::Init()
673 m_eventHandler
= this;
674 m_menuBarFrame
= NULL
;
676 } // end of wxMenuBar::Init
678 wxMenuBar::wxMenuBar()
681 } // end of wxMenuBar::wxMenuBar
683 wxMenuBar::wxMenuBar(
684 long WXUNUSED(lStyle
)
688 } // end of wxMenuBar::wxMenuBar
690 wxMenuBar::wxMenuBar(
693 , const wxString sTitles
[]
698 m_titles
.Alloc(nCount
);
699 for ( int i
= 0; i
< nCount
; i
++ )
701 m_menus
.Append(vMenus
[i
]);
702 m_titles
.Add(sTitles
[i
]);
703 vMenus
[i
]->Attach(this);
705 } // end of wxMenuBar::wxMenuBar
707 wxMenuBar::~wxMenuBar()
710 // We should free PM's resources only if PM doesn't do it for us
711 // which happens if we're attached to a frame
713 if (m_hMenu
&& !IsAttached())
715 ::WinDestroyWindow((HMENU
)m_hMenu
);
716 m_hMenu
= (WXHMENU
)NULL
;
718 } // end of wxMenuBar::~wxMenuBar
720 // ---------------------------------------------------------------------------
722 // ---------------------------------------------------------------------------
724 void wxMenuBar::Refresh()
726 wxCHECK_RET( IsAttached(), wxT("can't refresh unatteched menubar") );
728 WinSendMsg(GetWinHwnd(m_menuBarFrame
), WM_UPDATEFRAME
, (MPARAM
)FCF_MENU
, (MPARAM
)0);
729 } // end of wxMenuBar::Refresh
731 WXHMENU
wxMenuBar::Create()
739 wxCHECK_MSG(!m_hMenu
, TRUE
, wxT("menubar already created"));
742 // Menubars should be associated with a frame otherwise they are popups
744 if (m_menuBarFrame
!= NULL
)
745 hFrame
= GetWinHwnd(m_menuBarFrame
);
747 hFrame
= HWND_DESKTOP
;
749 // Create an empty menu and then fill it with insertions
751 if ((m_hMenu
= ::WinCreateWindow( hFrame
754 ,MS_ACTIONBAR
| WS_SYNCPAINT
| WS_VISIBLE
766 wxLogLastError("WinLoadMenu");
770 size_t nCount
= GetMenuCount();
772 for (size_t i
= 0; i
< nCount
; i
++)
780 // Set the parent and owner of the submenues to be the menubar, not the desktop
782 hSubMenu
= m_menus
[i
]->m_vMenuData
.hwndSubMenu
;
783 if (!::WinSetParent(m_menus
[i
]->m_vMenuData
.hwndSubMenu
, m_hMenu
, FALSE
))
785 vError
= ::WinGetLastError(vHabmain
);
786 sError
= wxPMErrorToStr(vError
);
787 wxLogError("Error setting parent for submenu. Error: %s\n", sError
.c_str());
791 if (!::WinSetOwner(m_menus
[i
]->m_vMenuData
.hwndSubMenu
, m_hMenu
))
793 vError
= ::WinGetLastError(vHabmain
);
794 sError
= wxPMErrorToStr(vError
);
795 wxLogError("Error setting parent for submenu. Error: %s\n", sError
.c_str());
799 m_menus
[i
]->m_vMenuData
.iPosition
= i
;
801 rc
= (APIRET
)::WinSendMsg(m_hMenu
, MM_INSERTITEM
, (MPARAM
)&m_menus
[i
]->m_vMenuData
, (MPARAM
)m_titles
[i
].c_str());
802 if (rc
== MIT_MEMERROR
|| rc
== MIT_ERROR
)
804 vError
= ::WinGetLastError(vHabmain
);
805 sError
= wxPMErrorToStr(vError
);
806 wxLogError("Error inserting or appending a menuitem. Error: %s\n", sError
.c_str());
812 } // end of wxMenuBar::Create
814 // ---------------------------------------------------------------------------
815 // wxMenuBar functions to work with the top level submenus
816 // ---------------------------------------------------------------------------
819 // NB: we don't support owner drawn top level items for now, if we do these
820 // functions would have to be changed to use wxMenuItem as well
822 void wxMenuBar::EnableTop(
827 wxCHECK_RET(IsAttached(), wxT("doesn't work with unattached menubars"));
832 uFlag
= MIA_DISABLED
;
834 nId
= SHORT1FROMMR(::WinSendMsg((HWND
)m_hMenu
, MM_ITEMIDFROMPOSITION
, MPFROMSHORT(nPos
), (MPARAM
)0));
835 if (nId
== MIT_ERROR
)
837 wxLogLastError("LogLastError");
840 ::WinSendMsg((HWND
)m_hMenu
, MM_SETITEMATTR
, MPFROM2SHORT(nId
, TRUE
), MPFROM2SHORT(MIA_DISABLED
, uFlag
));
842 } // end of wxMenuBar::EnableTop
844 void wxMenuBar::SetLabelTop(
846 , const wxString
& rLabel
852 wxCHECK_RET(nPos
< GetMenuCount(), wxT("invalid menu index"));
853 m_titles
[nPos
] = rLabel
;
860 nId
= SHORT1FROMMR(::WinSendMsg((HWND
)m_hMenu
, MM_ITEMIDFROMPOSITION
, MPFROMSHORT(nPos
), (MPARAM
)0));
861 if (nId
== MIT_ERROR
)
863 wxLogLastError("LogLastError");
866 if(!::WinSendMsg( (HWND
)m_hMenu
868 ,MPFROM2SHORT(nId
, TRUE
)
872 wxLogLastError("QueryItem");
876 if (::WinSendMsg(GetHmenu(), MM_SETITEMTEXT
, MPFROMSHORT(nId
), (MPARAM
)rLabel
.c_str()));
878 wxLogLastError("ModifyMenu");
881 } // end of wxMenuBar::SetLabelTop
883 wxString
wxMenuBar::GetLabelTop(
887 wxCHECK_MSG( nPos
< GetMenuCount(), wxEmptyString
,
888 wxT("invalid menu index in wxMenuBar::GetLabelTop") );
889 return m_titles
[nPos
];
890 } // end of wxMenuBar::GetLabelTop
892 // ---------------------------------------------------------------------------
893 // wxMenuBar construction
894 // ---------------------------------------------------------------------------
896 wxMenu
* wxMenuBar::Replace(
899 , const wxString
& rTitle
903 wxString sTitle
= wxPMTextToLabel(rTitle
);
904 wxMenu
* pMenuOld
= wxMenuBarBase::Replace( nPos
910 nId
= SHORT1FROMMR(::WinSendMsg((HWND
)m_hMenu
, MM_ITEMIDFROMPOSITION
, MPFROMSHORT(nPos
), (MPARAM
)0));
911 if (nId
== MIT_ERROR
)
913 wxLogLastError("LogLastError");
918 m_titles
[nPos
] = sTitle
;
921 ::WinSendMsg((HWND
)m_hMenu
, MM_REMOVEITEM
, MPFROM2SHORT(nId
, TRUE
), (MPARAM
)0);
922 ::WinSendMsg((HWND
)m_hMenu
, MM_INSERTITEM
, (MPARAM
)&pMenu
->m_vMenuData
, (MPARAM
)sTitle
.c_str());
925 if (pMenuOld
->HasAccels() || pMenu
->HasAccels())
928 // Need to rebuild accell table
932 #endif // wxUSE_ACCEL
936 } // end of wxMenuBar::Replace
938 bool wxMenuBar::Insert(
941 , const wxString
& rTitle
944 wxString sTitle
= wxPMTextToLabel(rTitle
);
946 if (!wxMenuBarBase::Insert( nPos
952 m_titles
.Insert( sTitle
958 pMenu
->m_vMenuData
.iPosition
= nPos
;
959 ::WinSendMsg( (HWND
)m_hMenu
961 ,(MPARAM
)&pMenu
->m_vMenuData
962 ,(MPARAM
)sTitle
.c_str()
965 if (pMenu
->HasAccels())
967 // need to rebuild accell table
970 #endif // wxUSE_ACCEL
974 } // end of wxMenuBar::Insert
976 bool wxMenuBar::Append(
978 , const wxString
& rsTitle
981 WXHMENU hSubmenu
= pMenu
? pMenu
->GetHMenu() : 0;
983 wxCHECK_MSG(hSubmenu
, FALSE
, wxT("can't append invalid menu to menubar"));
985 wxString sTitle
= wxPMTextToLabel(rsTitle
);
987 if (!wxMenuBarBase::Append(pMenu
, sTitle
))
990 m_titles
.Add(sTitle
);
994 pMenu
->m_vMenuData
.iPosition
= MIT_END
;
995 ::WinSendMsg((HWND
)m_hMenu
, MM_INSERTITEM
, (MPARAM
)&pMenu
->m_vMenuData
, (MPARAM
)sTitle
.c_str());
997 if (pMenu
->HasAccels())
1000 // Need to rebuild accell table
1002 RebuildAccelTable();
1004 #endif // wxUSE_ACCEL
1008 } // end of wxMenuBar::Append
1010 wxMenu
* wxMenuBar::Remove(
1014 wxMenu
* pMenu
= wxMenuBarBase::Remove(nPos
);
1020 nId
= SHORT1FROMMR(::WinSendMsg( (HWND
)GetHmenu()
1021 ,MM_ITEMIDFROMPOSITION
1025 if (nId
== MIT_ERROR
)
1027 wxLogLastError("LogLastError");
1032 ::WinSendMsg( (HWND
)GetHmenu()
1034 ,MPFROM2SHORT(nId
, TRUE
)
1039 if (pMenu
->HasAccels())
1042 // Need to rebuild accell table
1044 RebuildAccelTable();
1046 #endif // wxUSE_ACCEL
1049 m_titles
.Remove(nPos
);
1051 } // end of wxMenuBar::Remove
1055 void wxMenuBar::RebuildAccelTable()
1058 // Merge the accelerators of all menus into one accel table
1060 size_t nAccelCount
= 0;
1062 size_t nCount
= GetMenuCount();
1064 for (i
= 0; i
< nCount
; i
++)
1066 nAccelCount
+= m_menus
[i
]->GetAccelCount();
1071 wxAcceleratorEntry
* pAccelEntries
= new wxAcceleratorEntry
[nAccelCount
];
1074 for (i
= 0; i
< nCount
; i
++)
1076 nAccelCount
+= m_menus
[i
]->CopyAccels(&pAccelEntries
[nAccelCount
]);
1078 m_vAccelTable
= wxAcceleratorTable( nAccelCount
1081 delete [] pAccelEntries
;
1083 } // end of wxMenuBar::RebuildAccelTable
1085 #endif // wxUSE_ACCEL
1087 void wxMenuBar::Attach(
1091 wxMenuBarBase::Attach(pFrame
);
1094 RebuildAccelTable();
1096 // Ensure the accelerator table is set to the frame (not the client!)
1098 if (!::WinSetAccelTable( vHabmain
1099 ,m_vAccelTable
.GetHACCEL()
1100 ,(HWND
)pFrame
->GetFrame()
1102 wxLogLastError("WinSetAccelTable");
1103 #endif // wxUSE_ACCEL
1104 } // end of wxMenuBar::Attach
1106 void wxMenuBar::Detach()
1108 ::WinDestroyWindow((HWND
)m_hMenu
);
1109 m_hMenu
= (WXHMENU
)NULL
;
1110 m_menuBarFrame
= NULL
;
1111 } // end of wxMenuBar::Detach
1113 // ---------------------------------------------------------------------------
1114 // wxMenuBar searching for menu items
1115 // ---------------------------------------------------------------------------
1118 // Find the itemString in menuString, and return the item id or wxNOT_FOUND
1120 int wxMenuBar::FindMenuItem(
1121 const wxString
& rMenuString
1122 , const wxString
& rItemString
1125 wxString sMenuLabel
= wxStripMenuCodes(rMenuString
);
1126 size_t nCount
= GetMenuCount();
1128 for (size_t i
= 0; i
< nCount
; i
++)
1130 wxString sTitle
= wxStripMenuCodes(m_titles
[i
]);
1132 if (rMenuString
== sTitle
)
1133 return m_menus
[i
]->FindItem(rItemString
);
1136 } // end of wxMenuBar::FindMenuItem
1138 wxMenuItem
* wxMenuBar::FindItem(
1140 , wxMenu
** ppItemMenu
1146 wxMenuItem
* pItem
= NULL
;
1147 size_t nCount
= GetMenuCount();
1149 for (size_t i
= 0; !pItem
&& (i
< nCount
); i
++)
1151 pItem
= m_menus
[i
]->FindItem( nId
1156 } // end of wxMenuBar::FindItem
1158 wxMenuItem
* wxMenuBar::FindItem(
1161 , wxMenu
** ppItemMenu
1167 wxMenuItem
* pItem
= NULL
;
1168 size_t nCount
= GetMenuCount();
1170 for (size_t i
= 0; !pItem
&& (i
< nCount
); i
++)
1172 pItem
= m_menus
[i
]->FindItem( nId
1178 } // end of wxMenuBar::FindItem