From 86adc75813eedc3eabf746e30c8a571d528439a3 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Fri, 20 Feb 2004 02:55:28 +0000 Subject: [PATCH] Implement wxMenuItemAction: and validateMenuItem: delegate messages git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25880 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/cocoa/NSWindow.h | 2 ++ include/wx/cocoa/toplevel.h | 2 ++ src/cocoa/NSWindow.mm | 18 ++++++++++++++++++ src/cocoa/toplevel.mm | 9 +++++++++ 4 files changed, 31 insertions(+) diff --git a/include/wx/cocoa/NSWindow.h b/include/wx/cocoa/NSWindow.h index 808656f442..0b2491e70c 100644 --- a/include/wx/cocoa/NSWindow.h +++ b/include/wx/cocoa/NSWindow.h @@ -36,6 +36,8 @@ public: virtual void CocoaDelegate_windowDidResignKey(void) { } virtual void CocoaDelegate_windowDidBecomeMain(void) { } virtual void CocoaDelegate_windowDidResignMain(void) { } + virtual void CocoaDelegate_wxMenuItemAction(struct objc_object *sender) = 0; + virtual bool CocoaDelegate_validateMenuItem(struct objc_object *sender) = 0; virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win); protected: wxCocoaNSWindow(); diff --git a/include/wx/cocoa/toplevel.h b/include/wx/cocoa/toplevel.h index 8276028e67..7cc666b111 100644 --- a/include/wx/cocoa/toplevel.h +++ b/include/wx/cocoa/toplevel.h @@ -67,6 +67,8 @@ public: virtual void CocoaDelegate_windowDidResignKey(void); virtual void CocoaDelegate_windowDidBecomeMain(void); virtual void CocoaDelegate_windowDidResignMain(void); + virtual void CocoaDelegate_wxMenuItemAction(struct objc_object *sender); + virtual bool CocoaDelegate_validateMenuItem(struct objc_object *sender); virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win); static void DeactivatePendingWindow(); protected: diff --git a/src/cocoa/NSWindow.mm b/src/cocoa/NSWindow.mm index a0c4a5f196..bde3aa64ce 100644 --- a/src/cocoa/NSWindow.mm +++ b/src/cocoa/NSWindow.mm @@ -49,6 +49,10 @@ - (void)windowDidResignMain: (NSNotification *)notification; - (BOOL)windowShouldClose: (id)sender; - (void)windowWillClose: (NSNotification *)notification; + +// Menu item handlers +- (void)wxMenuItemAction: (id)sender; +- (BOOL)validateMenuItem: (id)menuItem; @end //interface wxNSWindowDelegate @implementation wxNSWindowDelegate : NSObject @@ -69,6 +73,7 @@ return m_wxCocoaInterface; } +// Delegate message handlers - (void)windowDidBecomeKey: (NSNotification *)notification { wxCocoaNSWindow *win = wxCocoaNSWindow::GetFromCocoa([notification object]); @@ -123,6 +128,19 @@ win->CocoaDelegate_windowWillClose(); } +// Menu item handlers +- (void)wxMenuItemAction: (id)sender +{ + wxASSERT(m_wxCocoaInterface); + m_wxCocoaInterface->CocoaDelegate_wxMenuItemAction(sender); +} + +- (BOOL)validateMenuItem: (id)sender +{ + wxASSERT(m_wxCocoaInterface); + return m_wxCocoaInterface->CocoaDelegate_validateMenuItem(sender); +} + @end //implementation wxNSWindowDelegate // ============================================================================ diff --git a/src/cocoa/toplevel.mm b/src/cocoa/toplevel.mm index 9cdfa7a783..9f4518bbfb 100644 --- a/src/cocoa/toplevel.mm +++ b/src/cocoa/toplevel.mm @@ -232,6 +232,15 @@ bool wxTopLevelWindowCocoa::CocoaDelegate_windowShouldClose() return wxWindowBase::Close(false); } +void wxTopLevelWindowCocoa::CocoaDelegate_wxMenuItemAction(struct objc_object *sender) +{ +} + +bool wxTopLevelWindowCocoa::CocoaDelegate_validateMenuItem(struct objc_object *sender) +{ + return false; +} + // ---------------------------------------------------------------------------- // wxTopLevelWindowCocoa maximize/minimize // ---------------------------------------------------------------------------- -- 2.45.2