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