Document domain parameter of wxTranslations::GetTranslatedString().
[wxWidgets.git] / src / cocoa / NSButton.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        src/cocoa/NSButton.mm
3 // Purpose:     wxCocoaNSButton
4 // Author:      David Elliott
5 // Modified by:
6 // Created:     2003/01/31
7 // Copyright:   (c) 2003-2004 David Elliott
8 // Licence:     wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #include "wx/wxprec.h"
20 #ifndef WX_PRECOMP
21     #include "wx/log.h"
22 #endif // WX_PRECOMP
23
24 #include "wx/cocoa/objc/objc_uniquifying.h"
25 #include "wx/cocoa/NSButton.h"
26 #import <AppKit/NSButton.h>
27
28 // ----------------------------------------------------------------------------
29 // globals
30 // ----------------------------------------------------------------------------
31 WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSButton)
32
33 // ============================================================================
34 // @class wxNSButtonTarget
35 // ============================================================================
36 @interface wxNSButtonTarget : NSObject
37 {
38 }
39
40 - (void)wxNSButtonAction: (id)sender;
41 @end // wxNSButtonTarget
42 WX_DECLARE_GET_OBJC_CLASS(wxNSButtonTarget,NSObject)
43
44 @implementation wxNSButtonTarget :  NSObject
45 - (void)wxNSButtonAction: (id)sender
46 {
47     wxCocoaNSButton *button = wxCocoaNSButton::GetFromCocoa(sender);
48     wxCHECK_RET(button,wxT("wxNSButtonAction received without associated wx object"));
49     button->Cocoa_wxNSButtonAction();
50 }
51
52 @end // implementation wxNSButtonTarget
53 WX_IMPLEMENT_GET_OBJC_CLASS(wxNSButtonTarget,NSObject)
54
55 // ============================================================================
56 // class wxCocoaNSButton
57 // ============================================================================
58 const wxObjcAutoRefFromAlloc<struct objc_object*> wxCocoaNSButton::sm_cocoaTarget = [[WX_GET_OBJC_CLASS(wxNSButtonTarget) alloc] init];
59
60 void wxCocoaNSButton::AssociateNSButton(WX_NSButton cocoaNSButton)
61 {
62     if(cocoaNSButton)
63     {
64         sm_cocoaHash.insert(wxCocoaNSButtonHash::value_type(cocoaNSButton,this));
65         [cocoaNSButton setTarget: sm_cocoaTarget];
66         [cocoaNSButton setAction: @selector(wxNSButtonAction:)];
67     }
68 }
69