Provide target/action mechanism for subclasses to use
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23431 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -19,8 +19,11 @@ WX_DECLARE_OBJC_HASHMAP(NSControl);
|
|||||||
class wxCocoaNSControl
|
class wxCocoaNSControl
|
||||||
{
|
{
|
||||||
WX_DECLARE_OBJC_INTERFACE(NSControl)
|
WX_DECLARE_OBJC_INTERFACE(NSControl)
|
||||||
protected:
|
public:
|
||||||
|
virtual void CocoaTarget_action() {}
|
||||||
// virtual void Cocoa_didChangeText(void) = 0;
|
// virtual void Cocoa_didChangeText(void) = 0;
|
||||||
|
protected:
|
||||||
|
static struct objc_object *sm_cocoaTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _WX_COCOA_NSCONTROL_H_
|
#endif // _WX_COCOA_NSCONTROL_H_
|
||||||
|
@@ -19,12 +19,39 @@
|
|||||||
|
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/log.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/cocoa/NSControl.h"
|
#include "wx/cocoa/NSControl.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
#import <Foundation/NSObject.h>
|
||||||
// globals
|
|
||||||
// ----------------------------------------------------------------------------
|
// ============================================================================
|
||||||
|
// @class wxNSControlTarget
|
||||||
|
// ============================================================================
|
||||||
|
@interface wxNSControlTarget : NSObject
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)wxNSControlAction: (id)sender;
|
||||||
|
@end //interface wxNSControlTarget
|
||||||
|
|
||||||
|
@implementation wxNSControlTarget : NSObject
|
||||||
|
|
||||||
|
- (void)wxNSControlAction: (id)sender
|
||||||
|
{
|
||||||
|
wxLogDebug("wxNSControlAction");
|
||||||
|
wxCocoaNSControl *wxcontrol = wxCocoaNSControl::GetFromCocoa(sender);
|
||||||
|
wxCHECK_RET(wxcontrol,"wxNSControlAction received but no wxCocoaNSControl exists!");
|
||||||
|
wxcontrol->CocoaTarget_action();
|
||||||
|
}
|
||||||
|
|
||||||
|
@end //implementation wxNSControlTarget
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// wxNSControl
|
||||||
|
// ============================================================================
|
||||||
WX_IMPLEMENT_OBJC_INTERFACE(NSControl)
|
WX_IMPLEMENT_OBJC_INTERFACE(NSControl)
|
||||||
|
|
||||||
|
struct objc_object *wxCocoaNSControl::sm_cocoaTarget = [[wxNSControlTarget alloc] init];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user