* Added virtual GetAppMenuBar() which returns the app-wide menubar which

would be appropriate for this window, or NULL if the manager should decide
* Added Become/Resign Main handlers
* For all Become/Resign Main/Key handlers, notify the menubar manager


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23385 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott 2003-09-04 21:16:41 +00:00
parent 8fc821cccf
commit 33faea0a0d
2 changed files with 20 additions and 0 deletions

View File

@ -15,6 +15,8 @@
#include "wx/hashmap.h"
#include "wx/cocoa/NSWindow.h"
class WXDLLEXPORT wxMenuBar;
// ========================================================================
// wxTopLevelWindowCocoa
// ========================================================================
@ -63,6 +65,9 @@ public:
virtual bool CocoaDelegate_windowShouldClose(void);
virtual void CocoaDelegate_windowDidBecomeKey(void);
virtual void CocoaDelegate_windowDidResignKey(void);
virtual void CocoaDelegate_windowDidBecomeMain(void);
virtual void CocoaDelegate_windowDidResignMain(void);
virtual wxMenuBar* GetAppMenuBar() { return NULL; }
protected:
void SetNSWindow(WX_NSWindow cocoaNSWindow);
WX_NSWindow m_cocoaNSWindow;

View File

@ -29,6 +29,7 @@
#endif //WX_PRECOMP
#include "wx/cocoa/autorelease.h"
#include "wx/cocoa/mbarman.h"
#import <AppKit/NSView.h>
#import <AppKit/NSWindow.h>
@ -131,6 +132,7 @@ void wxTopLevelWindowCocoa::CocoaReplaceView(WX_NSView oldView, WX_NSView newVie
void wxTopLevelWindowCocoa::CocoaDelegate_windowDidBecomeKey(void)
{
wxLogDebug("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeKey",this);
wxMenuBarManager::GetInstance()->WindowDidBecomeKey(this);
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
@ -142,6 +144,19 @@ void wxTopLevelWindowCocoa::CocoaDelegate_windowDidResignKey(void)
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
wxMenuBarManager::GetInstance()->WindowDidResignKey(this);
}
void wxTopLevelWindowCocoa::CocoaDelegate_windowDidBecomeMain(void)
{
wxLogDebug("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeMain",this);
wxMenuBarManager::GetInstance()->WindowDidBecomeMain(this);
}
void wxTopLevelWindowCocoa::CocoaDelegate_windowDidResignMain(void)
{
wxLogDebug("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidResignMain",this);
wxMenuBarManager::GetInstance()->WindowDidResignMain(this);
}
void wxTopLevelWindowCocoa::Cocoa_close(void)