]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/menu.cpp
Rebake after recguard.h added to bakefiles
[wxWidgets.git] / src / palmos / menu.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/menu.cpp
3 // Purpose: wxMenu, wxMenuBar, wxMenuItem
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by:
6 // Created: 10/12/04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ===========================================================================
13 // declarations
14 // ===========================================================================
15
16 // ---------------------------------------------------------------------------
17 // headers
18 // ---------------------------------------------------------------------------
19
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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 <Loader.h>
46 #include <Form.h>
47 #include <Menu.h>
48
49 // ----------------------------------------------------------------------------
50 // global variables
51 // ----------------------------------------------------------------------------
52
53 extern wxMenu *wxCurrentPopupMenu;
54
55 // ----------------------------------------------------------------------------
56 // constants
57 // ----------------------------------------------------------------------------
58
59 // the (popup) menu title has this special id
60 static const int idMenuTitle = -3;
61
62 // ----------------------------------------------------------------------------
63 // private functions
64 // ----------------------------------------------------------------------------
65
66 // ============================================================================
67 // implementation
68 // ============================================================================
69
70 #include <wx/listimpl.cpp>
71
72 WX_DEFINE_LIST( wxMenuInfoList ) ;
73
74 #if wxUSE_EXTENDED_RTTI
75
76 WX_DEFINE_FLAGS( wxMenuStyle )
77
78 wxBEGIN_FLAGS( wxMenuStyle )
79 wxFLAGS_MEMBER(wxMENU_TEAROFF)
80 wxEND_FLAGS( wxMenuStyle )
81
82 IMPLEMENT_DYNAMIC_CLASS_XTI(wxMenu, wxEvtHandler,"wx/menu.h")
83
84 wxCOLLECTION_TYPE_INFO( wxMenuItem * , wxMenuItemList ) ;
85
86 template<> void wxCollectionToVariantArray( wxMenuItemList const &theList, wxxVariantArray &value)
87 {
88 wxListCollectionToVariantArray<wxMenuItemList::compatibility_iterator>( theList , value ) ;
89 }
90
91 wxBEGIN_PROPERTIES_TABLE(wxMenu)
92 wxEVENT_PROPERTY( Select , wxEVT_COMMAND_MENU_SELECTED , wxCommandEvent)
93 wxPROPERTY( Title, wxString , SetTitle, GetTitle, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
94 wxREADONLY_PROPERTY_FLAGS( MenuStyle , wxMenuStyle , long , GetStyle , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
95 wxPROPERTY_COLLECTION( MenuItems , wxMenuItemList , wxMenuItem* , Append , GetMenuItems , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
96 wxEND_PROPERTIES_TABLE()
97
98 wxBEGIN_HANDLERS_TABLE(wxMenu)
99 wxEND_HANDLERS_TABLE()
100
101 wxDIRECT_CONSTRUCTOR_2( wxMenu , wxString , Title , long , MenuStyle )
102
103 WX_DEFINE_FLAGS( wxMenuBarStyle )
104
105 wxBEGIN_FLAGS( wxMenuBarStyle )
106 wxFLAGS_MEMBER(wxMB_DOCKABLE)
107 wxEND_FLAGS( wxMenuBarStyle )
108
109 // the negative id would lead the window (its superclass !) to vetoe streaming out otherwise
110 bool wxMenuBarStreamingCallback( const wxObject *WXUNUSED(object), wxWriter * , wxPersister * , wxxVariantArray & )
111 {
112 return true ;
113 }
114
115 IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxMenuBar, wxWindow ,"wx/menu.h",wxMenuBarStreamingCallback)
116
117 IMPLEMENT_DYNAMIC_CLASS_XTI(wxMenuInfo, wxObject , "wx/menu.h" )
118
119 wxBEGIN_PROPERTIES_TABLE(wxMenuInfo)
120 wxREADONLY_PROPERTY( Menu , wxMenu* , GetMenu , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
121 wxREADONLY_PROPERTY( Title , wxString , GetTitle , wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
122 wxEND_PROPERTIES_TABLE()
123
124 wxBEGIN_HANDLERS_TABLE(wxMenuInfo)
125 wxEND_HANDLERS_TABLE()
126
127 wxCONSTRUCTOR_2( wxMenuInfo , wxMenu* , Menu , wxString , Title )
128
129 wxCOLLECTION_TYPE_INFO( wxMenuInfo * , wxMenuInfoList ) ;
130
131 template<> void wxCollectionToVariantArray( wxMenuInfoList const &theList, wxxVariantArray &value)
132 {
133 wxListCollectionToVariantArray<wxMenuInfoList::compatibility_iterator>( theList , value ) ;
134 }
135
136 wxBEGIN_PROPERTIES_TABLE(wxMenuBar)
137 wxPROPERTY_COLLECTION( MenuInfos , wxMenuInfoList , wxMenuInfo* , Append , GetMenuInfos , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
138 wxEND_PROPERTIES_TABLE()
139
140 wxBEGIN_HANDLERS_TABLE(wxMenuBar)
141 wxEND_HANDLERS_TABLE()
142
143 wxCONSTRUCTOR_DUMMY( wxMenuBar )
144
145 #else
146 IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
147 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
148 IMPLEMENT_DYNAMIC_CLASS(wxMenuInfo, wxObject)
149 #endif
150
151 const wxMenuInfoList& wxMenuBar::GetMenuInfos() const
152 {
153 wxMenuInfoList* list = const_cast< wxMenuInfoList* >( &m_menuInfos ) ;
154 WX_CLEAR_LIST( wxMenuInfoList , *list ) ;
155 for( size_t i = 0 ; i < GetMenuCount() ; ++i )
156 {
157 wxMenuInfo* info = new wxMenuInfo() ;
158 info->Create( const_cast<wxMenuBar*>(this)->GetMenu(i) , GetLabelTop(i) ) ;
159 list->Append( info ) ;
160 }
161 return m_menuInfos ;
162 }
163
164 // ---------------------------------------------------------------------------
165 // wxMenu construction, adding and removing menu items
166 // ---------------------------------------------------------------------------
167
168 // Construct a menu with optional title (then use append)
169 void wxMenu::Init()
170 {
171 }
172
173 // The wxWindow destructor will take care of deleting the submenus.
174 wxMenu::~wxMenu()
175 {
176 }
177
178 void wxMenu::Break()
179 {
180 }
181
182 void wxMenu::Attach(wxMenuBarBase *menubar)
183 {
184 wxMenuBase::Attach(menubar);
185 }
186
187 #if wxUSE_ACCEL
188
189 int wxMenu::FindAccel(int id) const
190 {
191 return wxNOT_FOUND;
192 }
193
194 void wxMenu::UpdateAccel(wxMenuItem *item)
195 {
196 }
197
198 #endif // wxUSE_ACCEL
199
200 // append a new item or submenu to the menu
201 bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
202 {
203 if ( IsAttached() && GetMenuBar()->IsAttached() )
204 {
205 // Regenerate the menu resource
206 GetMenuBar()->Refresh();
207 }
208
209 return true;
210 }
211
212 void wxMenu::EndRadioGroup()
213 {
214 }
215
216 wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
217 {
218 wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") );
219
220 if(!wxMenuBase::DoAppend(item) || !DoInsertOrAppend(item))
221 {
222 return NULL;
223 }
224 else if(IsAttached() && GetMenuBar()->IsAttached())
225 {
226 // Regenerate the menu resource
227 GetMenuBar()->Refresh();
228 }
229
230 return item;
231 }
232
233 wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
234 {
235 if (wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos))
236 return item;
237 else
238 return NULL;
239 }
240
241 wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
242 {
243 // we need to find the items position in the child list
244 size_t pos;
245 wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
246 for ( pos = 0; node; pos++ )
247 {
248 if ( node->GetData() == item )
249 break;
250
251 node = node->GetNext();
252 }
253
254 // DoRemove() (unlike Remove) can only be called for existing item!
255 wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
256
257 // remove the item from the menu
258 wxMenuItem *ret=wxMenuBase::DoRemove(item);
259
260 if ( IsAttached() && GetMenuBar()->IsAttached() )
261 {
262 // Regenerate the menu resource
263 GetMenuBar()->Refresh();
264 }
265
266 return ret;
267 }
268
269 // ---------------------------------------------------------------------------
270 // accelerator helpers
271 // ---------------------------------------------------------------------------
272
273 #if wxUSE_ACCEL
274
275 // create the wxAcceleratorEntries for our accels and put them into provided
276 // array - return the number of accels we have
277 size_t wxMenu::CopyAccels(wxAcceleratorEntry *accels) const
278 {
279 size_t count = GetAccelCount();
280 for ( size_t n = 0; n < count; n++ )
281 {
282 *accels++ = *m_accels[n];
283 }
284
285 return count;
286 }
287
288 #endif // wxUSE_ACCEL
289
290 // ---------------------------------------------------------------------------
291 // set wxMenu title
292 // ---------------------------------------------------------------------------
293
294 void wxMenu::SetTitle(const wxString& label)
295 {
296 m_title = label;
297
298 if ( IsAttached() && GetMenuBar()->IsAttached() )
299 {
300 // Regenerate the menu resource
301 GetMenuBar()->Refresh();
302 }
303 }
304
305 // ---------------------------------------------------------------------------
306 // event processing
307 // ---------------------------------------------------------------------------
308
309 bool wxMenu::PalmCommand(WXUINT WXUNUSED(param), WXWORD id)
310 {
311 return false;
312 }
313
314 // ---------------------------------------------------------------------------
315 // other
316 // ---------------------------------------------------------------------------
317
318 wxWindow *wxMenu::GetWindow() const
319 {
320 return NULL;
321 }
322
323 // ---------------------------------------------------------------------------
324 // Menu Bar
325 // ---------------------------------------------------------------------------
326
327 void wxMenuBar::Init()
328 {
329 }
330
331 wxMenuBar::wxMenuBar()
332 {
333 }
334
335 wxMenuBar::wxMenuBar( long WXUNUSED(style) )
336 {
337 }
338
339 wxMenuBar::wxMenuBar(size_t count, wxMenu *menus[], const wxString titles[], long WXUNUSED(style))
340 {
341 }
342
343 wxMenuBar::~wxMenuBar()
344 {
345 }
346
347 // ---------------------------------------------------------------------------
348 // wxMenuBar helpers
349 // ---------------------------------------------------------------------------
350
351 void wxMenuBar::Refresh()
352 {
353 wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") );
354
355 // Regenerate the menu resource
356 LoadMenu();
357 }
358
359 WXHMENU wxMenuBar::Create()
360 {
361 return NULL;
362 }
363
364 int wxMenuBar::PalmPositionForWxMenu(wxMenu *menu, int wxpos)
365 {
366 return -1;
367 }
368
369 // ---------------------------------------------------------------------------
370 // wxMenuBar functions to work with the top level submenus
371 // ---------------------------------------------------------------------------
372
373 void wxMenuBar::EnableTop(size_t pos, bool enable)
374 {
375 // Palm OS does not have support for grayed or disabled items
376 }
377
378 void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
379 {
380 wxCHECK_RET( pos < GetMenuCount(), wxT("invalid menu index") );
381
382 m_titles[pos]=wxStripMenuCodes(label);
383
384 if ( !IsAttached() )
385 {
386 return;
387 }
388
389 // Regenerate the menu resource
390 Refresh();
391 }
392
393 wxString wxMenuBar::GetLabelTop(size_t pos) const
394 {
395 wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
396 wxT("invalid menu index in wxMenuBar::GetLabelTop") );
397
398 return wxMenuItem::GetLabelFromText(m_titles[pos]);
399 }
400
401 // ---------------------------------------------------------------------------
402 // wxMenuBar construction
403 // ---------------------------------------------------------------------------
404
405 wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
406 {
407 wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title);
408 if ( !menuOld )
409 return NULL;
410
411 m_titles[pos]=wxStripMenuCodes(title);
412
413 if ( IsAttached() )
414 {
415 // Regenerate the menu resource
416 Refresh();
417 }
418
419 return menuOld;
420 }
421
422 bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
423 {
424 if ( !wxMenuBarBase::Insert(pos, menu, title) )
425 return false;
426
427 m_titles.Insert(wxStripMenuCodes(title), pos);
428
429 if ( IsAttached() )
430 {
431 // Regenerate the menu resource
432 Refresh();
433 }
434
435 return true;
436 }
437
438 bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
439 {
440 if ( !wxMenuBarBase::Append(menu, title) )
441 return false;
442
443 m_titles.Add(wxStripMenuCodes(title));
444
445 if(IsAttached())
446 {
447 // Regenerate the menu resource
448 Refresh();
449 }
450
451 return true;
452 }
453
454 wxMenu *wxMenuBar::Remove(size_t pos)
455 {
456 wxMenu *menu = wxMenuBarBase::Remove(pos);
457 if ( !menu )
458 return NULL;
459
460 m_titles.RemoveAt(pos);
461
462 if (IsAttached())
463 {
464 // Regenerate the menu resource
465 Refresh();
466 }
467
468 return menu;
469 }
470
471 #if wxUSE_ACCEL
472
473 void wxMenuBar::RebuildAccelTable()
474 {
475 }
476
477 #endif // wxUSE_ACCEL
478
479 int wxMenuBar::ProcessCommand(int ItemID)
480 {
481 if(!IsAttached())
482 return -1;
483
484 int MenuNum=(ItemID/1000)-1;
485 int ItemNum=(ItemID-(1000*(MenuNum+1)));
486
487 // Should never happen, but it doesn't hurt to check anyway.
488 if(MenuNum>GetMenuCount())
489 return -1;
490
491 // Get the menu
492 wxMenu *ActiveMenu=GetMenu(MenuNum);
493
494 // Make sure this is a valid item.
495 if(ItemNum>ActiveMenu->GetMenuItemCount())
496 return -1;
497
498 // Get the item
499 wxMenuItem *ActiveItem=ActiveMenu->FindItemByPosition(ItemNum);
500 int ActiveID=ActiveItem->GetId();
501
502 return ActiveID;
503 }
504
505 /* Palm OS does not have good dynamic menu support. About all you can do with
506 * the standard API calls is to add new items to an existing drop-down menu and
507 * hide/show items in a drop-down menu. It is impossible to add, hide, or
508 * change the label on a drop-down menu.
509 *
510 * The easiest and simplest way around this limitation is to modify the Palm OS
511 * MenuBarType structure directly. This gives limited ability to change the
512 * label on a drop-down menu. I have not been able to find a safe way to add,
513 * delete, or resize drop-down menus in OS 6.
514 *
515 * The following routine attempt to work around these limitations present in the
516 * Palm OS API to provide limited dynamic menu support. This solution is far
517 * from perfect, but the only other option is to wait for PalmSource to add full
518 * dynamic menu support, or to recreate the Palm OS menu system from scratch.
519 *
520 * This system is limited in that no more than 4 drop-down menus are allowed per
521 * menu bar, and the label for each drop-down menu is limited to 8 characters of
522 * text. However, this menu system should work for most applications.
523 *
524 * Basically the menu routines select one of four menu bars, depending on
525 * whether or not the requested menu bar has one, two, three, or four drop-down
526 * menus.
527 *
528 * These four "template" menu bars contain one, two, three, or four drop-down
529 * menus. Each menu has a dummy menu item attached to it to allow the Palm OS
530 * MenuAddItem function to add the real items.
531 *
532 * The labels on the drop-down menus are then replaced with the labels of the
533 * real menus.
534 *
535 * The menu is then attached to the active window and the MenuAddItem API
536 * function is called to add the items to each drop-down menu. Finally,
537 * MenuHideItem is called to remove the dummy items from each drop-down menu.
538 */
539 void wxMenuBar::LoadMenu()
540 {
541 int i=0;
542 int j=0;
543
544 // Handle to the currently running application database
545 DmOpenRef AppDB;
546
547 // Get app database reference - needed for some Palm OS Menu API calls.
548 SysGetModuleDatabase(SysGetRefNum(), NULL, &AppDB);
549
550 // Get the number of menus
551 int NumMenus=GetMenuCount();
552
553 // Set up the pointers and handles
554 char *PalmOSMenuBarPtr;
555 MemHandle PalmOSMenuBar;
556
557 // Load the menu template and set up the menu pointers
558 if(NumMenus==1)
559 {
560 PalmOSMenuBar=DmGetResource(AppDB,'MBAR',1000);
561 PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar);
562
563 PalmOSMenuBarPtr+=74;
564 }
565 else if(NumMenus==2)
566 {
567 PalmOSMenuBar=DmGetResource(AppDB,'MBAR',2000);
568 PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar);
569
570 PalmOSMenuBarPtr+=116;
571 }
572 else if(NumMenus==3)
573 {
574 PalmOSMenuBar=DmGetResource(AppDB,'MBAR',3000);
575 PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar);
576
577 PalmOSMenuBarPtr+=158;
578 }
579 else
580 {
581 // We support a maximum of 4 menus, so make sure that do not create
582 // more than we can handle.
583 NumMenus=4;
584
585 PalmOSMenuBar=DmGetResource(AppDB,'MBAR',4000);
586 PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar);
587
588 PalmOSMenuBarPtr+=200;
589 }
590
591 // Set the proper names for the drop-down triggers.
592 for(i=0;i<NumMenus;i++)
593 {
594 // Clear out the old label
595 char buffer[8]={' ',' ',' ',' ',' ',' ',' ',' '};
596 MemMove(PalmOSMenuBarPtr,buffer,8);
597
598 wxString MenuTitle=m_titles.Item(i);
599
600 // Make sure we don't copy more than 8 bytes for the label
601 int LengthToCopy=MenuTitle.length();
602 if(LengthToCopy>8)
603 LengthToCopy=8;
604
605 MemMove(PalmOSMenuBarPtr,MenuTitle,LengthToCopy);
606 PalmOSMenuBarPtr+=11;
607 }
608
609 // We are done with the menu pointer.
610 MemHandleUnlock(PalmOSMenuBar);
611 DmReleaseResource(PalmOSMenuBar);
612
613 // We must make the menu active before we can add items to the drop-down
614 // triggers.
615 FrmSetMenu(FrmGetActiveForm(),AppDB,NumMenus*1000);
616
617 /* Add the menu items to the drop-down triggers. This must be done after
618 * setting the triggers, because setting the names of drop-down triggers
619 * that have a variable number of items requires carefull calculation of
620 * the offsets in the MenuBarType structure. Setting the triggers first
621 * avoids this.
622 */
623 for(i=0;i<NumMenus;i++)
624 {
625 wxMenu *CurrentMenu=GetMenu(i);
626
627 for(j=0;j<CurrentMenu->GetMenuItemCount();j++)
628 {
629 wxMenuItem *CurrentItem=CurrentMenu->FindItemByPosition(j);
630 wxString ItemLabel=CurrentItem->GetLabel();
631
632 if(CurrentItem->IsSeparator()==true)
633 {
634 char Separator=MenuSeparatorChar;
635 if(j==0)
636 MenuAddItem(9000+i,((i*1000)+1000)+j,0x00,&Separator);
637 else
638 MenuAddItem(((i*1000)+1000)+j-1,((i*1000)+1000)+j,0x00,&Separator);
639 }
640 else
641 {
642 if(j==0)
643 MenuAddItem(9000+i,((i*1000)+1000)+j,0x00,ItemLabel);
644 else
645 MenuAddItem(((i*1000)+1000)+j-1,((i*1000)+1000)+j,0x00,ItemLabel);
646 }
647 }
648
649 // Hide the dummy menu item, since we don't need it anymore.
650 MenuHideItem(9000+i);
651 }
652 }
653
654 void wxMenuBar::Attach(wxFrame *frame)
655 {
656 // before attaching preprocess menus to not include wxID_EXIT item
657 // as PalmOS guidelines suggest
658
659 wxMenuItem *item;
660 wxMenu *menu;
661 int i;
662
663 while( item = FindItem(wxID_EXIT) )
664 {
665 menu = item->GetMenu();
666 if( !menu ) break; // something broken ?
667
668 size_t count = menu->GetMenuItemCount();
669 if( count == 0 ) break; // something broken ?
670
671 // if EXIT is last item in menu
672 if( menu->FindItemByPosition( count - 1 ) == item )
673 {
674 menu->Destroy( item );
675
676 // was more than one item?
677 // was previous separator ?
678 if( count > 2 )
679 {
680 item = menu->FindItemByPosition( count - 2 );
681 if(item && item->IsSeparator())
682 menu->Destroy( item );
683 }
684 }
685
686 // if EXIT is first item in menu
687 else if( menu->FindItemByPosition( 0 ) == item )
688 {
689 menu->Destroy( item );
690
691 // was more than one item?
692 // was previous separator ?
693 if( count > 2 )
694 {
695 item = menu->FindItemByPosition( 0 );
696 if(item && item->IsSeparator())
697 menu->Destroy( item );
698 }
699 }
700
701 // if EXIT is in the middle but before and after are selectors
702 else
703 {
704 i = 1; // 0 case already done
705 while ( (i < count) && (menu->FindItemByPosition( 0 ) != item) )
706 {
707 i++;
708 }
709
710 if (i >= count) break;
711 if (menu->FindItemByPosition( i ) != item) break;
712 menu->Destroy( item );
713 item = menu->FindItemByPosition( i );
714 if ( item &&
715 item->IsSeparator() &&
716 menu->FindItemByPosition( i-1 )->IsSeparator() )
717 {
718 // noe need for two neighbouring separators
719 menu->Destroy( item );
720 }
721 }
722 }
723
724 // check if we received any empty menu!
725 i = 0;
726 while(i < GetMenuCount())
727 {
728 menu = GetMenu(i);
729
730 if( menu && (menu->GetMenuItemCount()==0) )
731 {
732 menu = Remove( i );
733 delete menu;
734 }
735 else
736 i++;
737 }
738
739 wxMenuBarBase::Attach(frame);
740
741 LoadMenu();
742 }
743
744 void wxMenuBar::Detach()
745 {
746 wxMenuBarBase::Detach();
747 }
748
749 #endif // wxUSE_MENUS