1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMenu, wxMenuBar, wxMenuItem
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 // ============================================================================
15 // ============================================================================
18 #pragma implementation "menu.h"
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
26 #include "wx/menuitem.h"
31 #include "wx/settings.h"
34 #include <Xm/LabelG.h>
35 #include <Xm/CascadeBG.h>
36 #include <Xm/CascadeB.h>
37 #include <Xm/SeparatoG.h>
38 #include <Xm/PushBG.h>
39 #include <Xm/ToggleB.h>
40 #include <Xm/ToggleBG.h>
41 #include <Xm/RowColumn.h>
43 #include "wx/motif/private.h"
45 // other standard headers
48 #if !USE_SHARED_LIBRARY
49 IMPLEMENT_DYNAMIC_CLASS(wxMenu
, wxEvtHandler
)
50 IMPLEMENT_DYNAMIC_CLASS(wxMenuBar
, wxEvtHandler
)
53 // ============================================================================
55 // ============================================================================
57 // ----------------------------------------------------------------------------
59 // ----------------------------------------------------------------------------
61 // Construct a menu with optional title (then use append)
62 void wxMenu::Init(const wxString
& title
,
64 #ifdef WXWIN_COMPATIBILITY
65 , const wxFunction func
70 m_eventHandler
= this;
73 m_pInvokingWindow
= NULL
;
76 //// Motif-specific members
78 m_menuWidget
= (WXWidget
) NULL
;
79 m_popupShell
= (WXWidget
) NULL
;
80 m_buttonWidget
= (WXWidget
) NULL
;
82 m_topLevelMenu
= (wxMenu
*) NULL
;
83 m_ownedByMenuBar
= FALSE
;
84 m_menuParent
= (wxMenu
*) NULL
;
85 m_clientData
= (void*) NULL
;
89 Append(ID_SEPARATOR
, m_title
) ;
92 m_backgroundColour
= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENU
);
93 m_foregroundColour
= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENUTEXT
);
94 m_font
= wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT
);
96 #ifdef WXWIN_COMPATIBILITY
101 // The wxWindow destructor will take care of deleting the submenus.
112 // Not sure if this is right
113 if (m_menuParent
&& m_menuBar
)
119 wxNode
*node
= m_menuItems
.First();
122 wxMenuItem
*item
= (wxMenuItem
*)node
->Data();
125 if (item->GetSubMenu())
126 item->DeleteSubMenu();
129 wxNode
*next
= node
->Next();
141 // function appends a new item or submenu to the menu
142 void wxMenu::Append(wxMenuItem
*pItem
)
144 wxCHECK_RET( pItem
!= NULL
, "can't append NULL item to the menu" );
146 m_menuItems
.Append(pItem
);
149 pItem
->CreateItem (m_menuWidget
, m_menuBar
, m_topLevelMenu
); // this is a dynamic Append
154 void wxMenu::AppendSeparator()
156 Append(new wxMenuItem(this, ID_SEPARATOR
));
160 // N.B.: difference between old and new code.
161 // Old code stores subMenu in 'children' for later deletion,
162 // as well as in m_menuItems, whereas we only store it in
163 // m_menuItems here. What implications does this have?
165 void wxMenu::Append(int id
, const wxString
& label
, wxMenu
*subMenu
,
166 const wxString
& helpString
)
168 Append(new wxMenuItem(this, id
, label
, helpString
, FALSE
, subMenu
));
170 subMenu
->m_topLevelMenu
= m_topLevelMenu
;
173 // Ordinary menu item
174 void wxMenu::Append(int id
, const wxString
& label
,
175 const wxString
& helpString
, bool checkable
)
177 // 'checkable' parameter is useless for Windows.
178 Append(new wxMenuItem(this, id
, label
, helpString
, checkable
));
181 void wxMenu::Delete(int id
)
187 for (pos
= 0, node
= m_menuItems
.First(); node
; node
= node
->Next(), pos
++)
189 item
= (wxMenuItem
*)node
->Data();
190 if (item
->GetId() == id
)
197 item
->DestroyItem(TRUE
);
199 // See also old code - don't know if this is needed (seems redundant).
201 if (item->GetSubMenu()) {
202 item->subMenu->top_level_menu = item->GetSubMenu();
203 item->subMenu->window_parent = NULL;
204 children->DeleteObject(item->GetSubMenu());
208 m_menuItems
.DeleteNode(node
);
212 void wxMenu::Enable(int id
, bool flag
)
214 wxMenuItem
*item
= FindItemForId(id
);
215 wxCHECK_RET( item
!= NULL
, "can't enable non-existing menu item" );
220 bool wxMenu::Enabled(int Id
) const
222 wxMenuItem
*item
= FindItemForId(Id
);
223 wxCHECK( item
!= NULL
, FALSE
);
225 return item
->IsEnabled();
228 void wxMenu::Check(int Id
, bool Flag
)
230 wxMenuItem
*item
= FindItemForId(Id
);
231 wxCHECK_RET( item
!= NULL
, "can't get status of non-existing menu item" );
236 bool wxMenu::Checked(int id
) const
238 wxMenuItem
*item
= FindItemForId(id
);
239 wxCHECK( item
!= NULL
, FALSE
);
241 return item
->IsChecked();
244 void wxMenu::SetTitle(const wxString
& label
)
248 wxNode
*node
= m_menuItems
.First ();
252 wxMenuItem
*item
= (wxMenuItem
*) node
->Data ();
253 Widget widget
= (Widget
) item
->GetButtonWidget();
257 XmString title_str
= XmStringCreateSimple ((char*) (const char*) label
);
258 XtVaSetValues (widget
,
259 XmNlabelString
, title_str
,
261 // TODO: should we delete title_str now?
264 const wxString
wxMenu::GetTitle() const
269 void wxMenu::SetLabel(int id
, const wxString
& label
)
271 wxMenuItem
*item
= FindItemForId(id
);
272 if (item
== (wxMenuItem
*) NULL
)
275 item
->SetText(label
);
278 wxString
wxMenu::GetLabel(int id
) const
280 wxMenuItem
*it
= NULL
;
281 WXWidget w
= FindMenuItem (id
, &it
);
286 XtVaGetValues ((Widget
) w
,
287 XmNlabelString
, &text
,
290 if (XmStringGetLtoR (text
, XmSTRING_DEFAULT_CHARSET
, &s
))
299 return wxEmptyString
;
303 return wxEmptyString
;
306 // Finds the item id matching the given string, -1 if not found.
307 int wxMenu::FindItem (const wxString
& itemString
) const
311 wxStripMenuCodes ((char *)(const char *)itemString
, buf1
);
313 for (wxNode
* node
= m_menuItems
.First (); node
; node
= node
->Next ())
315 wxMenuItem
*item
= (wxMenuItem
*) node
->Data ();
316 if (item
->GetSubMenu())
318 int ans
= item
->GetSubMenu()->FindItem(itemString
);
322 if ( !item
->IsSeparator() )
324 wxStripMenuCodes((char *)item
->GetName().c_str(), buf2
);
325 if (strcmp(buf1
, buf2
) == 0)
326 return item
->GetId();
333 wxMenuItem
*wxMenu::FindItemForId(int itemId
, wxMenu
** itemMenu
) const
337 for (wxNode
* node
= m_menuItems
.First (); node
; node
= node
->Next ())
339 wxMenuItem
*item
= (wxMenuItem
*) node
->Data ();
341 if (item
->GetId() == itemId
)
344 *itemMenu
= (wxMenu
*) this;
348 if (item
->GetSubMenu())
350 wxMenuItem
*ans
= item
->GetSubMenu()->FindItemForId (itemId
, itemMenu
);
361 void wxMenu::SetHelpString(int itemId
, const wxString
& helpString
)
363 wxMenuItem
*item
= FindItemForId (itemId
);
365 item
->SetHelp(helpString
);
368 wxString
wxMenu::GetHelpString (int itemId
) const
370 wxMenuItem
*item
= FindItemForId (itemId
);
372 return (item
== NULL
) ? str
: item
->GetHelp();
375 void wxMenu::ProcessCommand(wxCommandEvent
& event
)
377 bool processed
= FALSE
;
382 (void) (*(m_callback
)) (*this, event
);
386 // Try the menu's event handler
387 if ( !processed
&& GetEventHandler())
389 processed
= GetEventHandler()->ProcessEvent(event
);
391 // Try the window the menu was popped up from (and up
392 // through the hierarchy)
393 if ( !processed
&& GetInvokingWindow())
394 processed
= GetInvokingWindow()->ProcessEvent(event
);
397 // Update a menu and all submenus recursively.
398 // source is the object that has the update event handlers
399 // defined for it. If NULL, the menu or associated window
401 void wxMenu::UpdateUI(wxEvtHandler
* source
)
403 if (!source
&& GetInvokingWindow())
404 source
= GetInvokingWindow()->GetEventHandler();
406 source
= GetEventHandler();
410 wxNode
* node
= GetItems().First();
413 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
414 if ( !item
->IsSeparator() )
416 wxWindowID id
= item
->GetId();
417 wxUpdateUIEvent
event(id
);
418 event
.SetEventObject( source
);
420 if (source
->ProcessEvent(event
))
422 if (event
.GetSetText())
423 SetLabel(id
, event
.GetText());
424 if (event
.GetSetChecked())
425 Check(id
, event
.GetChecked());
426 if (event
.GetSetEnabled())
427 Enable(id
, event
.GetEnabled());
430 if (item
->GetSubMenu())
431 item
->GetSubMenu()->UpdateUI(source
);
437 // ----------------------------------------------------------------------------
439 // ----------------------------------------------------------------------------
441 void wxMenuBar::Init()
443 m_eventHandler
= this;
444 m_menuBarFrame
= NULL
;
445 m_mainWidget
= (WXWidget
) NULL
;
446 m_backgroundColour
= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENU
);
447 m_foregroundColour
= wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENUTEXT
);
448 m_font
= wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT
);
451 wxMenuBar::wxMenuBar(int n
, wxMenu
*menus
[], const wxString titles
[])
455 for ( int i
= 0; i
< n
; i
++ )
457 m_menus
.Append(menus
[i
]);
458 m_titles
.Add(titles
[i
]);
462 wxMenuBar::~wxMenuBar()
464 // nothing to do: wxMenuBarBase will delete the menus
467 void wxMenuBar::EnableTop(size_t WXUNUSED(pos
), bool WXUNUSED(flag
))
472 void wxMenuBar::SetLabelTop(size_t pos
, const wxString
& label
)
474 wxMenu
*menu
= GetMenu(pos
);
478 Widget w
= (Widget
)menu
->GetButtonWidget();
481 wxXmString
label_str(label
);
484 XmNlabelString
, label_str(),
489 wxString
wxMenuBar::GetLabelTop(size_t pos
) const
493 wxMenu
*menu
= GetMenu(pos
);
496 Widget w
= (Widget
)menu
->GetButtonWidget();
501 XmNlabelString
, &text
,
505 if ( XmStringGetLtoR(text
, XmSTRING_DEFAULT_CHARSET
, &s
) )
517 bool wxMenuBar::Append(wxMenu
* menu
, const wxString
& title
)
519 wxCHECK_MSG( menu
, FALSE
, wxT("invalid menu") );
520 wxCHECK_MSG( !menu
->GetParent() && !menu
->GetButtonWidget(), FALSE
,
521 wxT("menu already appended") );
523 if ( m_menuBarFrame
)
525 WXWidget w
= menu
->CreateMenu(this, GetMainWidget(), menu
, title
, TRUE
);
526 wxCHECK_MSG( w
, FALSE
, wxT("failed to create menu") );
527 menu
->SetButtonWidget(w
);
530 menu
->SetMenuBar(this);
534 return wxMenuBarBase::Append(menu
, title
);
537 bool wxMenuBar::Insert(size_t pos
, wxMenu
*menu
, const wxString
& title
)
539 if ( !wxMenuBarBase::Insert(pos
, menu
, title
) )
542 wxFAIL_MSG(wxT("TODO"));
547 wxMenu
*wxMenuBar::Replace(size_t pos
, wxMenu
*menu
, const wxString
& title
)
549 if ( !wxMenuBarBase::Replace(pos
, menu
, title
) )
552 wxFAIL_MSG(wxT("TODO"));
557 wxMenu
*wxMenuBar::Remove(size_t pos
)
559 wxMenu
*menu
= wxMenuBarBase::Remove(pos
);
563 if ( m_menuBarFrame
)
564 menu
->DestroyMenu(TRUE
);
566 menu
->SetMenuBar(NULL
);
568 m_titles
.Remove(pos
);
573 // Find the menu menuString, item itemString, and return the item id.
574 // Returns -1 if none found.
575 int wxMenuBar::FindMenuItem (const wxString
& menuString
, const wxString
& itemString
) const
579 wxStripMenuCodes ((char *)(const char *)menuString
, buf1
);
581 size_t menuCount
= GetMenuCount();
582 for (size_t i
= 0; i
< menuCount
; i
++)
584 wxStripMenuCodes ((char *)(const char *)m_titles
[i
], buf2
);
585 if (strcmp (buf1
, buf2
) == 0)
586 return m_menus
[i
]->FindItem (itemString
);
591 wxMenuItem
*wxMenuBar::FindItem(int id
, wxMenu
** itemMenu
) const
596 wxMenuItem
*item
= NULL
;
597 size_t menuCount
= GetMenuCount();
598 for (size_t i
= 0; i
< menuCount
; i
++)
599 if ((item
= m_menus
[i
]->FindItemForId (id
, itemMenu
)))
605 bool wxMenuBar::CreateMenuBar(wxFrame
* parent
)
609 XtVaSetValues((Widget
) parent
->GetMainWindowWidget(), XmNmenuBar
, (Widget
) m_mainWidget
, NULL
);
611 if (!XtIsManaged((Widget) m_mainWidget))
612 XtManageChild((Widget) m_mainWidget);
614 XtMapWidget((Widget
) m_mainWidget
);
618 Widget menuBarW
= XmCreateMenuBar ((Widget
) parent
->GetMainWindowWidget(), "MenuBar", NULL
, 0);
619 m_mainWidget
= (WXWidget
) menuBarW
;
621 size_t menuCount
= GetMenuCount();
622 for (size_t i
= 0; i
< menuCount
; i
++)
624 wxMenu
*menu
= GetMenu(i
);
625 wxString
title(m_titles
[i
]);
626 menu
->SetButtonWidget(menu
->CreateMenu (this, menuBarW
, menu
, title
, TRUE
));
628 if (strcmp (wxStripMenuCodes(title
), "Help") == 0)
629 XtVaSetValues ((Widget
) menuBarW
, XmNmenuHelpWidget
, (Widget
) menu
->GetButtonWidget(), NULL
);
631 // tear off menu support
632 #if (XmVersion >= 1002)
633 if ( menu
->IsTearOff() )
635 XtVaSetValues(GetWidget(menu
),
636 XmNtearOffModel
, XmTEAR_OFF_ENABLED
,
642 SetBackgroundColour(m_backgroundColour
);
643 SetForegroundColour(m_foregroundColour
);
646 XtVaSetValues((Widget
) parent
->GetMainWindowWidget(), XmNmenuBar
, (Widget
) m_mainWidget
, NULL
);
647 XtRealizeWidget ((Widget
) menuBarW
);
648 XtManageChild ((Widget
) menuBarW
);
649 SetMenuBarFrame(parent
);
654 // Destroy menubar, but keep data structures intact so we can recreate it.
655 bool wxMenuBar::DestroyMenuBar()
659 SetMenuBarFrame((wxFrame
*) NULL
);
663 XtUnmanageChild ((Widget
) m_mainWidget
);
664 XtUnrealizeWidget ((Widget
) m_mainWidget
);
666 size_t menuCount
= GetMenuCount();
667 for (size_t i
= 0; i
< menuCount
; i
++)
669 wxMenu
*menu
= GetMenu(i
);
670 menu
->DestroyMenu(TRUE
);
673 XtDestroyWidget((Widget
) m_mainWidget
);
674 m_mainWidget
= (WXWidget
) 0;
676 SetMenuBarFrame((wxFrame
*) NULL
);
682 static XtWorkProcId WorkProcMenuId
;
684 /* Since PopupMenu under Motif stills grab right mouse button events
685 * after it was closed, we need to delete the associated widgets to
686 * allow next PopUpMenu to appear...
689 int PostDeletionOfMenu( XtPointer
* clientData
)
691 XtRemoveWorkProc(WorkProcMenuId
);
692 wxMenu
*menu
= (wxMenu
*)clientData
;
694 if (menu
->GetMainWidget()) {
695 if (menu
->GetParent())
697 wxList
& list
= menu
->GetParent()->GetItems();
698 list
.DeleteObject(menu
);
700 menu
->DestroyMenu(TRUE
);
702 /* Mark as no longer popped up */
708 wxMenuPopdownCallback(Widget
WXUNUSED(w
), XtPointer clientData
,
709 XtPointer
WXUNUSED(ptr
))
711 wxMenu
*menu
= (wxMenu
*)clientData
;
713 // Added by JOREL Jean-Charles <jjorel@silr.ireste.fr>
714 /* Since Callbacks of MenuItems are not yet processed, we put a
715 * background job which will be done when system will be idle.
716 * What awful hack!! :(
719 WorkProcMenuId
= XtAppAddWorkProc(
720 (XtAppContext
) wxTheApp
->GetAppContext(),
721 (XtWorkProc
) PostDeletionOfMenu
,
723 // Apparently not found in Motif headers
724 // XtVaSetValues( w, XmNpopupEnabled, XmPOPUP_DISABLED, NULL );
728 * Create a popup or pulldown menu.
729 * Submenus of a popup will be pulldown.
733 WXWidget
wxMenu::CreateMenu (wxMenuBar
* menuBar
, WXWidget parent
, wxMenu
* topMenu
, const wxString
& title
, bool pullDown
)
735 Widget menu
= (Widget
) 0;
736 Widget buttonWidget
= (Widget
) 0;
738 XtSetArg (args
[0], XmNnumColumns
, m_numColumns
);
739 XtSetArg (args
[1], XmNpacking
, XmPACK_COLUMN
);
743 menu
= XmCreatePopupMenu ((Widget
) parent
, "popup", args
, 2);
746 (XtCallbackProc
)wxMenuPopdownCallback
,
751 char mnem
= wxFindMnemonic (title
);
752 wxStripMenuCodes ((char*) (const char*) title
, wxBuffer
);
754 menu
= XmCreatePulldownMenu ((Widget
) parent
, "pulldown", args
, 2);
756 wxString
title2(wxStripMenuCodes(title
));
757 wxXmString
label_str(title2
);
758 buttonWidget
= XtVaCreateManagedWidget(title2
,
760 xmCascadeButtonGadgetClass
, (Widget
) parent
,
762 xmCascadeButtonWidgetClass
, (Widget
) parent
,
764 XmNlabelString
, label_str(),
769 XtVaSetValues (buttonWidget
, XmNmnemonic
, mnem
, NULL
);
772 m_menuWidget
= (WXWidget
) menu
;
775 m_topLevelMenu
= topMenu
;
777 for (wxNode
* node
= m_menuItems
.First (); node
; node
= node
->Next ())
779 wxMenuItem
*item
= (wxMenuItem
*) node
->Data ();
780 item
->CreateItem (menu
, menuBar
, topMenu
);
783 SetBackgroundColour(m_backgroundColour
);
784 SetForegroundColour(m_foregroundColour
);
790 // Destroys the Motif implementation of the menu,
791 // but maintains the wxWindows data structures so we can
792 // do a CreateMenu again.
793 void wxMenu::DestroyMenu (bool full
)
795 for (wxNode
* node
= m_menuItems
.First (); node
; node
= node
->Next ())
797 wxMenuItem
*item
= (wxMenuItem
*) node
->Data ();
798 item
->SetMenuBar((wxMenuBar
*) NULL
);
800 item
->DestroyItem(full
);
807 XtVaSetValues((Widget
) m_buttonWidget
, XmNsubMenuId
, NULL
, NULL
);
808 XtDestroyWidget ((Widget
) m_buttonWidget
);
809 m_buttonWidget
= (WXWidget
) 0;
812 if (m_menuWidget
&& full
)
814 XtDestroyWidget((Widget
) m_menuWidget
);
815 m_menuWidget
= (WXWidget
) NULL
;
819 WXWidget
wxMenu::FindMenuItem (int id
, wxMenuItem
** it
) const
824 *it
= (wxMenuItem
*) NULL
;
825 return m_buttonWidget
;
828 for (wxNode
* node
= m_menuItems
.First (); node
; node
= node
->Next ())
830 wxMenuItem
*item
= (wxMenuItem
*) node
->Data ();
831 if (item
->GetId() == id
)
835 return item
->GetButtonWidget();
838 if (item
->GetSubMenu())
840 WXWidget w
= item
->GetSubMenu()->FindMenuItem (id
, it
);
849 *it
= (wxMenuItem
*) NULL
;
850 return (WXWidget
) NULL
;
853 void wxMenu::SetBackgroundColour(const wxColour
& col
)
855 m_backgroundColour
= col
;
857 wxDoChangeBackgroundColour(m_menuWidget
, (wxColour
&) col
);
859 wxDoChangeBackgroundColour(m_buttonWidget
, (wxColour
&) col
, TRUE
);
861 wxNode
* node
= m_menuItems
.First();
864 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
865 if (item
->GetButtonWidget())
867 // This crashes because it uses gadgets
868 // wxDoChangeBackgroundColour(item->GetButtonWidget(), (wxColour&) col, TRUE);
870 if (item
->GetSubMenu())
871 item
->GetSubMenu()->SetBackgroundColour((wxColour
&) col
);
876 void wxMenu::SetForegroundColour(const wxColour
& col
)
878 m_foregroundColour
= col
;
880 wxDoChangeForegroundColour(m_menuWidget
, (wxColour
&) col
);
882 wxDoChangeForegroundColour(m_buttonWidget
, (wxColour
&) col
);
884 wxNode
* node
= m_menuItems
.First();
887 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
888 if (item
->GetButtonWidget())
890 // This crashes because it uses gadgets
891 // wxDoChangeForegroundColour(item->GetButtonWidget(), (wxColour&) col);
893 if (item
->GetSubMenu())
894 item
->GetSubMenu()->SetForegroundColour((wxColour
&) col
);
899 void wxMenu::ChangeFont(bool keepOriginalSize
)
901 // lesstif 0.87 hangs when setting XmNfontList
902 #ifndef LESSTIF_VERSION
903 if (!m_font
.Ok() || !m_menuWidget
)
906 XmFontList fontList
= (XmFontList
) m_font
.GetFontList(1.0, XtDisplay((Widget
) m_menuWidget
));
908 XtVaSetValues ((Widget
) m_menuWidget
,
909 XmNfontList
, fontList
,
913 XtVaSetValues ((Widget
) m_buttonWidget
,
914 XmNfontList
, fontList
,
917 wxNode
* node
= m_menuItems
.First();
920 wxMenuItem
* item
= (wxMenuItem
*) node
->Data();
921 if (m_menuWidget
&& item
->GetButtonWidget() && m_font
.Ok())
923 XtVaSetValues ((Widget
) item
->GetButtonWidget(),
924 XmNfontList
, fontList
,
927 if (item
->GetSubMenu())
928 item
->GetSubMenu()->ChangeFont(keepOriginalSize
);
934 void wxMenu::SetFont(const wxFont
& font
)
940 bool wxMenuBar::SetBackgroundColour(const wxColour
& col
)
942 m_backgroundColour
= col
;
944 wxDoChangeBackgroundColour(m_mainWidget
, (wxColour
&) col
);
946 size_t menuCount
= GetMenuCount();
947 for (size_t i
= 0; i
< menuCount
; i
++)
948 m_menus
[i
]->SetBackgroundColour((wxColour
&) col
);
953 bool wxMenuBar::SetForegroundColour(const wxColour
& col
)
955 m_foregroundColour
= col
;
957 wxDoChangeForegroundColour(m_mainWidget
, (wxColour
&) col
);
959 size_t menuCount
= GetMenuCount();
960 for (size_t i
= 0; i
< menuCount
; i
++)
961 m_menus
[i
]->SetForegroundColour((wxColour
&) col
);
966 void wxMenuBar::ChangeFont(bool WXUNUSED(keepOriginalSize
))
968 // Nothing to do for menubar, fonts are kept in wxMenus
971 bool wxMenuBar::SetFont(const wxFont
& font
)
976 size_t menuCount
= GetMenuCount();
977 for (size_t i
= 0; i
< menuCount
; i
++)
978 m_menus
[i
]->SetFont(font
);