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/NSButton.h"
26 #import <AppKit/NSButton.h>
28 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
31 WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSButton)
33 // ============================================================================
34 // @class wxPoserNSButton
35 // ============================================================================
36 @interface wxPoserNSButton : NSButton
40 - (void)wxNSButtonAction: (id)sender;
41 @end // wxPoserNSButton
43 WX_IMPLEMENT_POSER(wxPoserNSButton);
45 @implementation wxPoserNSButton : NSButton
46 - (void)wxNSButtonAction: (id)sender
48 wxASSERT_MSG(self==sender,"Received wxNSButtonAction from another object");
49 wxCocoaNSButton *button = wxCocoaNSButton::GetFromCocoa(self);
50 wxCHECK_RET(button,"wxNSButtonAction received without associated wx object");
51 button->Cocoa_wxNSButtonAction();
54 @end // implementation wxPoserNSButton
56 void wxCocoaNSButton::AssociateNSButton(WX_NSButton cocoaNSButton)
58 sm_cocoaHash.insert(wxCocoaNSButtonHash::value_type(cocoaNSButton,this));
59 [cocoaNSButton setTarget: cocoaNSButton];
60 [cocoaNSButton setAction: @selector(wxNSButtonAction:)];