Implement wxMenuItemAction: and validateMenuItem: delegate messages

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25880 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott 2004-02-20 02:55:28 +00:00
parent e498079eb4
commit 86adc75813
4 changed files with 31 additions and 0 deletions

View File

@ -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();

View File

@ -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:

View File

@ -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
// ============================================================================

View File

@ -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
// ----------------------------------------------------------------------------