wxASSERT_MSG( pSubMenu->m_hMenu != NULL , wxT("invalid submenu added"));
pSubMenu->m_menuParent = this ;
- if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar)
+ if (wxMenuBar::MacGetInstalledMenuBar() == GetMenuBar())
{
pSubMenu->MacBeforeDisplay( true ) ;
}
// if we're already attached to the menubar, we must update it
if ( IsAttached() )
{
- m_menuBar->Refresh();
+ GetMenuBar()->Refresh();
}
return TRUE ;
}
if ( IsAttached() )
{
// otherwise, the change won't be visible
- m_menuBar->Refresh();
+ GetMenuBar()->Refresh();
}
// and from internal data structures
{
if ( m_invokingWindow != NULL )
return m_invokingWindow;
- else if ( m_menuBar != NULL)
- return (wxWindow *) m_menuBar->GetFrame();
+ else if ( GetMenuBar() != NULL)
+ return (wxWindow *) GetMenuBar()->GetFrame();
return NULL;
}
wxStAppResource resload ;
- Handle menubar = ::GetNewMBar( kwxMacMenuBarResource ) ;
- wxString message ;
- wxCHECK_RET( menubar != NULL, wxT("can't read MBAR resource") );
+ MenuBarHandle menubar = NewHandleClear( sizeof( MenuBarHeader ) ) ;
::SetMenuBar( menubar ) ;
-#if TARGET_API_MAC_CARBON
- ::DisposeMenuBar( menubar ) ;
-#else
- ::DisposeHandle( menubar ) ;
-#endif
-
-#if TARGET_API_MAC_OS8
- MenuHandle menu = ::GetMenuHandle( kwxMacAppleMenuId ) ;
- if ( CountMenuItems( menu ) == 2 )
- {
- ::AppendResMenu(menu, 'DRVR');
- }
-#endif
-
+ DisposeMenuBar( menubar ) ;
+
// clean-up the help menu before adding new items
MenuHandle mh = NULL ;
if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
Refresh();
}
+bool wxMenuBar::Enable( bool enable)
+{
+ wxCHECK_MSG( IsAttached(), false, wxT("doesn't work with unattached menubars") );
+ size_t i;
+ for (i = 0; i < GetMenuCount(); i++)
+ {
+ EnableTop(i, enable);
+ }
+ return true;
+}
+
void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
{
wxCHECK_RET( pos < GetMenuCount(), wxT("invalid menu index") );
for ( size_t i = 0; i < count; i++ )
{
wxString title = wxStripMenuCodes(m_titles[i]);
- if ( menuString == title )
+ if ( menuLabel == title )
return m_menus[i]->FindItem(itemString);
}