1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cocoa/NSButton.cpp
3 // Purpose: wxCocoaNSButton
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #include "wx/wxprec.h"
25 #include "wx/cocoa/ObjcPose.h"
27 #include "wx/cocoa/NSButton.h"
28 #import <AppKit/NSButton.h>
30 // ----------------------------------------------------------------------------
32 // ----------------------------------------------------------------------------
33 WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSButton)
35 // ============================================================================
36 // @class wxPoserNSButton
37 // ============================================================================
38 @interface wxPoserNSButton : NSButton
42 - (void)wxNSButtonAction: (id)sender;
43 @end // wxPoserNSButton
45 WX_IMPLEMENT_POSER(wxPoserNSButton);
47 @implementation wxPoserNSButton : NSButton
48 - (void)wxNSButtonAction: (id)sender
50 wxASSERT_MSG(self==sender,"Received wxNSButtonAction from another object");
51 wxCocoaNSButton *button = wxCocoaNSButton::GetFromCocoa(self);
52 wxCHECK_RET(button,"wxNSButtonAction received without associated wx object");
53 button->Cocoa_wxNSButtonAction();
56 @end // implementation wxPoserNSButton
58 void wxCocoaNSButton::AssociateNSButton(WX_NSButton cocoaNSButton)
62 sm_cocoaHash.insert(wxCocoaNSButtonHash::value_type(cocoaNSButton,this));
63 [cocoaNSButton setTarget: cocoaNSButton];
64 [cocoaNSButton setAction: @selector(wxNSButtonAction:)];