-
- if ( !processed && targetWindow != NULL)
- {
- processed = targetWindow->HandleWindowEvent(event);
- }
-
- if ( processed )
- {
- // if anything changed, update the changed attribute
- if (event.GetSetText())
- SetLabel(id, event.GetText());
- if (event.GetSetChecked())
- Check(id, event.GetChecked());
- if (event.GetSetEnabled())
- Enable(id, event.GetEnabled());
-
- result = noErr ;
- }
- return result;
-}
-
-// Menu Bar
-
-/*
-
-Mac Implementation note :
-
-The Mac has only one global menubar, so we attempt to install the currently
-active menubar from a frame, we currently don't take into account mdi-frames
-which would ask for menu-merging
-
-Secondly there is no mac api for changing a menubar that is not the current
-menubar, so we have to wait for preparing the actual menubar until the
-wxMenubar is to be used
-
-We can in subsequent versions use MacInstallMenuBar to provide some sort of
-auto-merge for MDI in case this will be necessary
-
-*/
-
-wxMenuBar* wxMenuBar::s_macInstalledMenuBar = NULL ;
-wxMenuBar* wxMenuBar::s_macCommonMenuBar = NULL ;
-bool wxMenuBar::s_macAutoWindowMenu = true ;
-WXHMENU wxMenuBar::s_macWindowMenuHandle = NULL ;
-
-void wxMenuBar::Init()
-{
- m_eventHandler = this;
- m_menuBarFrame = NULL;
- m_invokingWindow = (wxWindow*) NULL;
-}
-
-wxMenuBar::wxMenuBar()
-{
- Init();
-}
-
-wxMenuBar::wxMenuBar( long WXUNUSED(style) )
-{
- Init();
-}
-
-wxMenuBar::wxMenuBar(size_t count, wxMenu *menus[], const wxString titles[], long WXUNUSED(style))
-{
- Init();
-
- m_titles.Alloc(count);
-
- for ( size_t i = 0; i < count; i++ )
- {
- m_menus.Append(menus[i]);
- m_titles.Add(titles[i]);
-
- menus[i]->Attach(this);
- }
-}
-
-wxMenuBar::~wxMenuBar()
-{
- if (s_macCommonMenuBar == this)
- s_macCommonMenuBar = NULL;
-
- if (s_macInstalledMenuBar == this)
- {
- ::ClearMenuBar();
- s_macInstalledMenuBar = NULL;
- }
-}
-
-void wxMenuBar::Refresh(bool WXUNUSED(eraseBackground), const wxRect *WXUNUSED(rect))
-{
- wxCHECK_RET( IsAttached(), wxT("can't refresh unatteched menubar") );
-
- DrawMenuBar();
-}
-
-void wxMenuBar::MacInstallMenuBar()
-{
- if ( s_macInstalledMenuBar == this )
- return ;
-
- MenuBarHandle menubar = NULL ;
-
- menubar = NewHandleClear( 6 /* sizeof( MenuBarHeader ) */ ) ;
-
- ::SetMenuBar( menubar ) ;
- DisposeMenuBar( menubar ) ;
- MenuHandle appleMenu = NULL ;
-
- verify_noerr( CreateNewMenu( kwxMacAppleMenuId , 0 , &appleMenu ) ) ;
- verify_noerr( SetMenuTitleWithCFString( appleMenu , CFSTR( "\x14" ) ) );
-
- // Add About/Preferences separator only on OS X
- // KH/RN: Separator is always present on 10.3 but not on 10.2
- // However, the change from 10.2 to 10.3 suggests it is preferred
- InsertMenuItemTextWithCFString( appleMenu,
- CFSTR(""), 0, kMenuItemAttrSeparator, 0);
- InsertMenuItemTextWithCFString( appleMenu,
- CFSTR("About..."), 0, 0, 0);
- MacInsertMenu( appleMenu , 0 ) ;
-
- // if we have a mac help menu, clean it up before adding new items
- MenuHandle helpMenuHandle ;
- MenuItemIndex firstUserHelpMenuItem ;
-
- if ( UMAGetHelpMenuDontCreate( &helpMenuHandle , &firstUserHelpMenuItem) == noErr )
- {
- for ( int i = CountMenuItems( helpMenuHandle ) ; i >= firstUserHelpMenuItem ; --i )
- DeleteMenuItem( helpMenuHandle , i ) ;
- }
- else