-wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxString titles[])
-{
- m_eventHandler = this;
- m_menuCount = n;
- m_menus = menus;
- m_titles = new wxString[n];
- int i;
- for ( i = 0; i < n; i++ )
- m_titles[i] = titles[i];
- m_menuBarFrame = NULL;
+ Widget menuBarW = XmCreateMenuBar ((Widget) parent->GetMainWidget(),
+ wxMOTIF_STR("MenuBar"), NULL, 0);
+ m_mainWidget = (WXWidget) menuBarW;
+
+ size_t menuCount = GetMenuCount();
+ for (size_t i = 0; i < menuCount; i++)
+ {
+ wxMenu *menu = GetMenu(i);
+ wxString title(m_titles[i]);
+ menu->SetButtonWidget(menu->CreateMenu (this, menuBarW, menu, i, title, true));
+
+ if (strcmp (wxStripMenuCodes(title), "Help") == 0)
+ XtVaSetValues ((Widget) menuBarW, XmNmenuHelpWidget, (Widget) menu->GetButtonWidget(), NULL);
+
+ // tear off menu support
+#if (XmVersion >= 1002)
+ if ( menu->IsTearOff() )
+ {
+ XtVaSetValues(GetWidget(menu),
+ XmNtearOffModel, XmTEAR_OFF_ENABLED,
+ NULL);
+ Widget tearOff = XmGetTearOffControl(GetWidget(menu));
+ wxDoChangeForegroundColour((Widget) tearOff, m_foregroundColour);
+ wxDoChangeBackgroundColour((Widget) tearOff, m_backgroundColour, true);
+ }
+#endif
+ }
+
+ PostCreation();