STL-ification patch for wxMSW and wxGTK.
[wxWidgets.git] / src / msw / menu.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: menu.cpp
3 // Purpose: wxMenu, wxMenuBar, wxMenuItem
4 // Author: Julian Smart
5 // Modified by: Vadim Zeitlin
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ===========================================================================
13 // declarations
14 // ===========================================================================
15
16 // ---------------------------------------------------------------------------
17 // headers
18 // ---------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "menu.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 #if wxUSE_MENUS
32
33 #ifndef WX_PRECOMP
34 #include "wx/frame.h"
35 #include "wx/menu.h"
36 #include "wx/utils.h"
37 #include "wx/intl.h"
38 #include "wx/log.h"
39 #endif
40
41 #if wxUSE_OWNER_DRAWN
42 #include "wx/ownerdrw.h"
43 #endif
44
45 #include "wx/msw/private.h"
46
47 // other standard headers
48 #include <string.h>
49
50 // ----------------------------------------------------------------------------
51 // global variables
52 // ----------------------------------------------------------------------------
53
54 extern wxMenu *wxCurrentPopupMenu;
55
56 // ----------------------------------------------------------------------------
57 // constants
58 // ----------------------------------------------------------------------------
59
60 // the (popup) menu title has this special id
61 static const int idMenuTitle = -2;
62
63 // ----------------------------------------------------------------------------
64 // private functions
65 // ----------------------------------------------------------------------------
66
67 // make the given menu item default
68 static void SetDefaultMenuItem(HMENU hmenu, UINT id)
69 {
70 MENUITEMINFO mii;
71 wxZeroMemory(mii);
72 mii.cbSize = sizeof(MENUITEMINFO);
73 mii.fMask = MIIM_STATE;
74 mii.fState = MFS_DEFAULT;
75
76 if ( !::SetMenuItemInfo(hmenu, id, FALSE, &mii) )
77 {
78 wxLogLastError(wxT("SetMenuItemInfo"));
79 }
80 }
81
82 // ============================================================================
83 // implementation
84 // ============================================================================
85
86 IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
87 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
88
89 // ---------------------------------------------------------------------------
90 // wxMenu construction, adding and removing menu items
91 // ---------------------------------------------------------------------------
92
93 // Construct a menu with optional title (then use append)
94 void wxMenu::Init()
95 {
96 m_doBreak = FALSE;
97 m_startRadioGroup = -1;
98
99 // create the menu
100 m_hMenu = (WXHMENU)CreatePopupMenu();
101 if ( !m_hMenu )
102 {
103 wxLogLastError(wxT("CreatePopupMenu"));
104 }
105
106 // if we have a title, insert it in the beginning of the menu
107 if ( !!m_title )
108 {
109 Append(idMenuTitle, m_title);
110 AppendSeparator();
111 }
112 }
113
114 // The wxWindow destructor will take care of deleting the submenus.
115 wxMenu::~wxMenu()
116 {
117 // we should free Windows resources only if Windows doesn't do it for us
118 // which happens if we're attached to a menubar or a submenu of another
119 // menu
120 if ( !IsAttached() && !GetParent() )
121 {
122 if ( !::DestroyMenu(GetHmenu()) )
123 {
124 wxLogLastError(wxT("DestroyMenu"));
125 }
126 }
127
128 #if wxUSE_ACCEL
129 // delete accels
130 WX_CLEAR_ARRAY(m_accels);
131 #endif // wxUSE_ACCEL
132 }
133
134 void wxMenu::Break()
135 {
136 // this will take effect during the next call to Append()
137 m_doBreak = TRUE;
138 }
139
140 void wxMenu::Attach(wxMenuBarBase *menubar)
141 {
142 wxMenuBase::Attach(menubar);
143
144 EndRadioGroup();
145 }
146
147 #if wxUSE_ACCEL
148
149 int wxMenu::FindAccel(int id) const
150 {
151 size_t n, count = m_accels.GetCount();
152 for ( n = 0; n < count; n++ )
153 {
154 if ( m_accels[n]->m_command == id )
155 return n;
156 }
157
158 return wxNOT_FOUND;
159 }
160
161 void wxMenu::UpdateAccel(wxMenuItem *item)
162 {
163 if ( item->IsSubMenu() )
164 {
165 wxMenu *submenu = item->GetSubMenu();
166 wxMenuItemList::compatibility_iterator node = submenu->GetMenuItems().GetFirst();
167 while ( node )
168 {
169 UpdateAccel(node->GetData());
170
171 node = node->GetNext();
172 }
173 }
174 else if ( !item->IsSeparator() )
175 {
176 // find the (new) accel for this item
177 wxAcceleratorEntry *accel = wxGetAccelFromString(item->GetText());
178 if ( accel )
179 accel->m_command = item->GetId();
180
181 // find the old one
182 int n = FindAccel(item->GetId());
183 if ( n == wxNOT_FOUND )
184 {
185 // no old, add new if any
186 if ( accel )
187 m_accels.Add(accel);
188 else
189 return; // skipping RebuildAccelTable() below
190 }
191 else
192 {
193 // replace old with new or just remove the old one if no new
194 delete m_accels[n];
195 if ( accel )
196 m_accels[n] = accel;
197 else
198 m_accels.RemoveAt(n);
199 }
200
201 if ( IsAttached() )
202 {
203 m_menuBar->RebuildAccelTable();
204 }
205 }
206 //else: it is a separator, they can't have accels, nothing to do
207 }
208
209 #endif // wxUSE_ACCEL
210
211 // append a new item or submenu to the menu
212 bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
213 {
214 #if wxUSE_ACCEL
215 UpdateAccel(pItem);
216 #endif // wxUSE_ACCEL
217
218 UINT flags = 0;
219
220 // if "Break" has just been called, insert a menu break before this item
221 // (and don't forget to reset the flag)
222 if ( m_doBreak ) {
223 flags |= MF_MENUBREAK;
224 m_doBreak = FALSE;
225 }
226
227 if ( pItem->IsSeparator() ) {
228 flags |= MF_SEPARATOR;
229 }
230
231 // id is the numeric id for normal menu items and HMENU for submenus as
232 // required by ::AppendMenu() API
233 UINT id;
234 wxMenu *submenu = pItem->GetSubMenu();
235 if ( submenu != NULL ) {
236 wxASSERT_MSG( submenu->GetHMenu(), wxT("invalid submenu") );
237
238 submenu->SetParent(this);
239
240 id = (UINT)submenu->GetHMenu();
241
242 flags |= MF_POPUP;
243 }
244 else {
245 id = pItem->GetId();
246 }
247
248 LPCTSTR pData;
249
250 #if wxUSE_OWNER_DRAWN
251 if ( pItem->IsOwnerDrawn() ) { // want to get {Measure|Draw}Item messages?
252 // item draws itself, pass pointer to it in data parameter
253 flags |= MF_OWNERDRAW;
254 pData = (LPCTSTR)pItem;
255 }
256 else
257 #endif
258 {
259 // menu is just a normal string (passed in data parameter)
260 flags |= MF_STRING;
261
262 pData = (wxChar*)pItem->GetText().c_str();
263 }
264
265 BOOL ok;
266 if ( pos == (size_t)-1 )
267 {
268 ok = ::AppendMenu(GetHmenu(), flags, id, pData);
269 }
270 else
271 {
272 ok = ::InsertMenu(GetHmenu(), pos, flags | MF_BYPOSITION, id, pData);
273 }
274
275 if ( !ok )
276 {
277 wxLogLastError(wxT("Insert or AppendMenu"));
278
279 return FALSE;
280 }
281
282 // if we just appended the title, highlight it
283 #ifdef __WIN32__
284 if ( (int)id == idMenuTitle )
285 {
286 // visually select the menu title
287 SetDefaultMenuItem(GetHmenu(), id);
288 }
289 #endif // __WIN32__
290
291 // if we're already attached to the menubar, we must update it
292 if ( IsAttached() && m_menuBar->IsAttached() )
293 {
294 m_menuBar->Refresh();
295 }
296
297 return TRUE;
298 }
299
300 void wxMenu::EndRadioGroup()
301 {
302 // we're not inside a radio group any longer
303 m_startRadioGroup = -1;
304 }
305
306 bool wxMenu::DoAppend(wxMenuItem *item)
307 {
308 wxCHECK_MSG( item, FALSE, _T("NULL item in wxMenu::DoAppend") );
309
310 bool check = FALSE;
311
312 if ( item->GetKind() == wxITEM_RADIO )
313 {
314 int count = GetMenuItemCount();
315
316 if ( m_startRadioGroup == -1 )
317 {
318 // start a new radio group
319 m_startRadioGroup = count;
320
321 // for now it has just one element
322 item->SetAsRadioGroupStart();
323 item->SetRadioGroupEnd(m_startRadioGroup);
324
325 // ensure that we have a checked item in the radio group
326 check = TRUE;
327 }
328 else // extend the current radio group
329 {
330 // we need to update its end item
331 item->SetRadioGroupStart(m_startRadioGroup);
332 wxMenuItemList::compatibility_iterator node = GetMenuItems().Item(m_startRadioGroup);
333
334 if ( node )
335 {
336 node->GetData()->SetRadioGroupEnd(count);
337 }
338 else
339 {
340 wxFAIL_MSG( _T("where is the radio group start item?") );
341 }
342 }
343 }
344 else // not a radio item
345 {
346 EndRadioGroup();
347 }
348
349 if ( !wxMenuBase::DoAppend(item) || !DoInsertOrAppend(item) )
350 {
351 return FALSE;
352 }
353
354 if ( check )
355 {
356 // check the item initially
357 item->Check(TRUE);
358 }
359
360 return TRUE;
361 }
362
363 bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
364 {
365 return wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos);
366 }
367
368 wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
369 {
370 // we need to find the items position in the child list
371 size_t pos;
372 wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
373 for ( pos = 0; node; pos++ )
374 {
375 if ( node->GetData() == item )
376 break;
377
378 node = node->GetNext();
379 }
380
381 // DoRemove() (unlike Remove) can only be called for existing item!
382 wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
383
384 #if wxUSE_ACCEL
385 // remove the corresponding accel from the accel table
386 int n = FindAccel(item->GetId());
387 if ( n != wxNOT_FOUND )
388 {
389 delete m_accels[n];
390
391 m_accels.RemoveAt(n);
392 }
393 //else: this item doesn't have an accel, nothing to do
394 #endif // wxUSE_ACCEL
395
396 // remove the item from the menu
397 if ( !::RemoveMenu(GetHmenu(), (UINT)pos, MF_BYPOSITION) )
398 {
399 wxLogLastError(wxT("RemoveMenu"));
400 }
401
402 if ( IsAttached() && m_menuBar->IsAttached() )
403 {
404 // otherwise, the chane won't be visible
405 m_menuBar->Refresh();
406 }
407
408 // and from internal data structures
409 return wxMenuBase::DoRemove(item);
410 }
411
412 // ---------------------------------------------------------------------------
413 // accelerator helpers
414 // ---------------------------------------------------------------------------
415
416 #if wxUSE_ACCEL
417
418 // create the wxAcceleratorEntries for our accels and put them into provided
419 // array - return the number of accels we have
420 size_t wxMenu::CopyAccels(wxAcceleratorEntry *accels) const
421 {
422 size_t count = GetAccelCount();
423 for ( size_t n = 0; n < count; n++ )
424 {
425 *accels++ = *m_accels[n];
426 }
427
428 return count;
429 }
430
431 #endif // wxUSE_ACCEL
432
433 // ---------------------------------------------------------------------------
434 // set wxMenu title
435 // ---------------------------------------------------------------------------
436
437 void wxMenu::SetTitle(const wxString& label)
438 {
439 bool hasNoTitle = m_title.IsEmpty();
440 m_title = label;
441
442 HMENU hMenu = GetHmenu();
443
444 if ( hasNoTitle )
445 {
446 if ( !label.IsEmpty() )
447 {
448 if ( !::InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING,
449 (unsigned)idMenuTitle, m_title) ||
450 !::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
451 {
452 wxLogLastError(wxT("InsertMenu"));
453 }
454 }
455 }
456 else
457 {
458 if ( label.IsEmpty() )
459 {
460 // remove the title and the separator after it
461 if ( !RemoveMenu(hMenu, 0, MF_BYPOSITION) ||
462 !RemoveMenu(hMenu, 0, MF_BYPOSITION) )
463 {
464 wxLogLastError(wxT("RemoveMenu"));
465 }
466 }
467 else
468 {
469 // modify the title
470 if ( !ModifyMenu(hMenu, 0u,
471 MF_BYPOSITION | MF_STRING,
472 (unsigned)idMenuTitle, m_title) )
473 {
474 wxLogLastError(wxT("ModifyMenu"));
475 }
476 }
477 }
478
479 #ifdef __WIN32__
480 // put the title string in bold face
481 if ( !m_title.IsEmpty() )
482 {
483 SetDefaultMenuItem(GetHmenu(), (UINT)idMenuTitle);
484 }
485 #endif // Win32
486 }
487
488 // ---------------------------------------------------------------------------
489 // event processing
490 // ---------------------------------------------------------------------------
491
492 bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id)
493 {
494 // ignore commands from the menu title
495
496 // NB: VC++ generates wrong assembler for `if ( id != idMenuTitle )'!!
497 if ( id != (WXWORD)idMenuTitle )
498 {
499 // VZ: previosuly, the command int was set to id too which was quite
500 // useless anyhow (as it could be retrieved using GetId()) and
501 // uncompatible with wxGTK, so now we use the command int instead
502 // to pass the checked status
503 SendEvent(id, ::GetMenuState(GetHmenu(), id, MF_BYCOMMAND) & MF_CHECKED);
504 }
505
506 return TRUE;
507 }
508
509 // ---------------------------------------------------------------------------
510 // other
511 // ---------------------------------------------------------------------------
512
513 wxWindow *wxMenu::GetWindow() const
514 {
515 if ( m_invokingWindow != NULL )
516 return m_invokingWindow;
517 else if ( m_menuBar != NULL)
518 return m_menuBar->GetFrame();
519
520 return NULL;
521 }
522
523 // ---------------------------------------------------------------------------
524 // Menu Bar
525 // ---------------------------------------------------------------------------
526
527 void wxMenuBar::Init()
528 {
529 m_eventHandler = this;
530 m_hMenu = 0;
531 }
532
533 wxMenuBar::wxMenuBar()
534 {
535 Init();
536 }
537
538 wxMenuBar::wxMenuBar( long WXUNUSED(style) )
539 {
540 Init();
541 }
542
543 wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[])
544 {
545 Init();
546
547 m_titles.Alloc(count);
548
549 for ( int i = 0; i < count; i++ )
550 {
551 m_menus.Append(menus[i]);
552 m_titles.Add(titles[i]);
553
554 menus[i]->Attach(this);
555 }
556 }
557
558 wxMenuBar::~wxMenuBar()
559 {
560 // we should free Windows resources only if Windows doesn't do it for us
561 // which happens if we're attached to a frame
562 if (m_hMenu && !IsAttached())
563 {
564 ::DestroyMenu((HMENU)m_hMenu);
565 m_hMenu = (WXHMENU)NULL;
566 }
567 }
568
569 // ---------------------------------------------------------------------------
570 // wxMenuBar helpers
571 // ---------------------------------------------------------------------------
572
573 void wxMenuBar::Refresh()
574 {
575 wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") );
576
577 DrawMenuBar(GetHwndOf(GetFrame()));
578 }
579
580 WXHMENU wxMenuBar::Create()
581 {
582 if ( m_hMenu != 0 )
583 return m_hMenu;
584
585 m_hMenu = (WXHMENU)::CreateMenu();
586
587 if ( !m_hMenu )
588 {
589 wxLogLastError(wxT("CreateMenu"));
590 }
591 else
592 {
593 size_t count = GetMenuCount(), i;
594 wxMenuList::iterator it;
595 for ( i = 0, it = m_menus.begin(); i < count; i++, it++ )
596 {
597 if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING,
598 (UINT)(*it)->GetHMenu(),
599 m_titles[i]) )
600 {
601 wxLogLastError(wxT("AppendMenu"));
602 }
603 }
604 }
605
606 return m_hMenu;
607 }
608
609 // ---------------------------------------------------------------------------
610 // wxMenuBar functions to work with the top level submenus
611 // ---------------------------------------------------------------------------
612
613 // NB: we don't support owner drawn top level items for now, if we do these
614 // functions would have to be changed to use wxMenuItem as well
615
616 void wxMenuBar::EnableTop(size_t pos, bool enable)
617 {
618 wxCHECK_RET( IsAttached(), wxT("doesn't work with unattached menubars") );
619
620 int flag = enable ? MF_ENABLED : MF_GRAYED;
621
622 EnableMenuItem((HMENU)m_hMenu, pos, MF_BYPOSITION | flag);
623
624 Refresh();
625 }
626
627 void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
628 {
629 wxCHECK_RET( pos < GetMenuCount(), wxT("invalid menu index") );
630
631 m_titles[pos] = label;
632
633 if ( !IsAttached() )
634 {
635 return;
636 }
637 //else: have to modify the existing menu
638
639 UINT id;
640 UINT flagsOld = ::GetMenuState((HMENU)m_hMenu, pos, MF_BYPOSITION);
641 if ( flagsOld == 0xFFFFFFFF )
642 {
643 wxLogLastError(wxT("GetMenuState"));
644
645 return;
646 }
647
648 if ( flagsOld & MF_POPUP )
649 {
650 // HIBYTE contains the number of items in the submenu in this case
651 flagsOld &= 0xff;
652 id = (UINT)::GetSubMenu((HMENU)m_hMenu, pos);
653 }
654 else
655 {
656 id = pos;
657 }
658
659 if ( ::ModifyMenu(GetHmenu(), pos, MF_BYPOSITION | MF_STRING | flagsOld,
660 id, label) == (int)0xFFFFFFFF )
661 {
662 wxLogLastError(wxT("ModifyMenu"));
663 }
664
665 Refresh();
666 }
667
668 wxString wxMenuBar::GetLabelTop(size_t pos) const
669 {
670 wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
671 wxT("invalid menu index in wxMenuBar::GetLabelTop") );
672
673 return m_titles[pos];
674 }
675
676 // ---------------------------------------------------------------------------
677 // wxMenuBar construction
678 // ---------------------------------------------------------------------------
679
680 wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
681 {
682 wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title);
683 if ( !menuOld )
684 return NULL;
685
686 m_titles[pos] = title;
687
688 if ( IsAttached() )
689 {
690 // can't use ModifyMenu() because it deletes the submenu it replaces
691 if ( !::RemoveMenu(GetHmenu(), (UINT)pos, MF_BYPOSITION) )
692 {
693 wxLogLastError(wxT("RemoveMenu"));
694 }
695
696 if ( !::InsertMenu(GetHmenu(), (UINT)pos,
697 MF_BYPOSITION | MF_POPUP | MF_STRING,
698 (UINT)GetHmenuOf(menu), title) )
699 {
700 wxLogLastError(wxT("InsertMenu"));
701 }
702
703 #if wxUSE_ACCEL
704 if ( menuOld->HasAccels() || menu->HasAccels() )
705 {
706 // need to rebuild accell table
707 RebuildAccelTable();
708 }
709 #endif // wxUSE_ACCEL
710
711 Refresh();
712 }
713
714 return menuOld;
715 }
716
717 bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
718 {
719 if ( !wxMenuBarBase::Insert(pos, menu, title) )
720 return FALSE;
721
722 m_titles.Insert(title, pos);
723
724 if ( IsAttached() )
725 {
726 if ( !::InsertMenu(GetHmenu(), pos,
727 MF_BYPOSITION | MF_POPUP | MF_STRING,
728 (UINT)GetHmenuOf(menu), title) )
729 {
730 wxLogLastError(wxT("InsertMenu"));
731 }
732
733 #if wxUSE_ACCEL
734 if ( menu->HasAccels() )
735 {
736 // need to rebuild accell table
737 RebuildAccelTable();
738 }
739 #endif // wxUSE_ACCEL
740
741 Refresh();
742 }
743
744 return TRUE;
745 }
746
747 bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
748 {
749 WXHMENU submenu = menu ? menu->GetHMenu() : 0;
750 wxCHECK_MSG( submenu, FALSE, wxT("can't append invalid menu to menubar") );
751
752 if ( !wxMenuBarBase::Append(menu, title) )
753 return FALSE;
754
755 m_titles.Add(title);
756
757 if ( IsAttached() )
758 {
759 if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING,
760 (UINT)submenu, title) )
761 {
762 wxLogLastError(wxT("AppendMenu"));
763 }
764
765 #if wxUSE_ACCEL
766 if ( menu->HasAccels() )
767 {
768 // need to rebuild accell table
769 RebuildAccelTable();
770 }
771 #endif // wxUSE_ACCEL
772
773 Refresh();
774 }
775
776 return TRUE;
777 }
778
779 wxMenu *wxMenuBar::Remove(size_t pos)
780 {
781 wxMenu *menu = wxMenuBarBase::Remove(pos);
782 if ( !menu )
783 return NULL;
784
785 if ( IsAttached() )
786 {
787 if ( !::RemoveMenu(GetHmenu(), (UINT)pos, MF_BYPOSITION) )
788 {
789 wxLogLastError(wxT("RemoveMenu"));
790 }
791
792 #if wxUSE_ACCEL
793 if ( menu->HasAccels() )
794 {
795 // need to rebuild accell table
796 RebuildAccelTable();
797 }
798 #endif // wxUSE_ACCEL
799
800 Refresh();
801 }
802
803 m_titles.RemoveAt(pos);
804
805 return menu;
806 }
807
808 #if wxUSE_ACCEL
809
810 void wxMenuBar::RebuildAccelTable()
811 {
812 // merge the accelerators of all menus into one accel table
813 size_t nAccelCount = 0;
814 size_t i, count = GetMenuCount();
815 wxMenuList::iterator it;
816 for ( i = 0, it = m_menus.begin(); i < count; i++, it++ )
817 {
818 nAccelCount += (*it)->GetAccelCount();
819 }
820
821 if ( nAccelCount )
822 {
823 wxAcceleratorEntry *accelEntries = new wxAcceleratorEntry[nAccelCount];
824
825 nAccelCount = 0;
826 for ( i = 0, it = m_menus.begin(); i < count; i++, it++ )
827 {
828 nAccelCount += (*it)->CopyAccels(&accelEntries[nAccelCount]);
829 }
830
831 m_accelTable = wxAcceleratorTable(nAccelCount, accelEntries);
832
833 delete [] accelEntries;
834 }
835 }
836
837 #endif // wxUSE_ACCEL
838
839 void wxMenuBar::Attach(wxFrame *frame)
840 {
841 wxMenuBarBase::Attach(frame);
842
843 #if wxUSE_ACCEL
844 RebuildAccelTable();
845 #endif // wxUSE_ACCEL
846 }
847
848 void wxMenuBar::Detach()
849 {
850 wxMenuBarBase::Detach();
851 }
852
853 #endif // wxUSE_MENUS