]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/NSButton.mm
Fix wxHtmlHelpData::SetTempDir() to behave correctly without trailing slash.
[wxWidgets.git] / src / cocoa / NSButton.mm
CommitLineData
fb896a32 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/cocoa/NSButton.mm
fb896a32
DE
3// Purpose: wxCocoaNSButton
4// Author: David Elliott
5// Modified by:
6// Created: 2003/01/31
feb82768 7// Copyright: (c) 2003-2004 David Elliott
526954c5 8// Licence: wxWindows licence
fb896a32
DE
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
a24aa427 24#include "wx/cocoa/objc/objc_uniquifying.h"
fb896a32
DE
25#include "wx/cocoa/NSButton.h"
26#import <AppKit/NSButton.h>
27
28// ----------------------------------------------------------------------------
29// globals
30// ----------------------------------------------------------------------------
31WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSButton)
32
33// ============================================================================
feb82768 34// @class wxNSButtonTarget
fb896a32 35// ============================================================================
feb82768 36@interface wxNSButtonTarget : NSObject
fb896a32
DE
37{
38}
39
40- (void)wxNSButtonAction: (id)sender;
feb82768 41@end // wxNSButtonTarget
a24aa427 42WX_DECLARE_GET_OBJC_CLASS(wxNSButtonTarget,NSObject)
fb896a32 43
feb82768 44@implementation wxNSButtonTarget : NSObject
fb896a32
DE
45- (void)wxNSButtonAction: (id)sender
46{
feb82768 47 wxCocoaNSButton *button = wxCocoaNSButton::GetFromCocoa(sender);
2b030203 48 wxCHECK_RET(button,wxT("wxNSButtonAction received without associated wx object"));
fb896a32
DE
49 button->Cocoa_wxNSButtonAction();
50}
51
feb82768 52@end // implementation wxNSButtonTarget
a24aa427 53WX_IMPLEMENT_GET_OBJC_CLASS(wxNSButtonTarget,NSObject)
feb82768
DE
54
55// ============================================================================
56// class wxCocoaNSButton
57// ============================================================================
a24aa427 58const wxObjcAutoRefFromAlloc<struct objc_object*> wxCocoaNSButton::sm_cocoaTarget = [[WX_GET_OBJC_CLASS(wxNSButtonTarget) alloc] init];
fb896a32
DE
59
60void wxCocoaNSButton::AssociateNSButton(WX_NSButton cocoaNSButton)
61{
bac6f234
DE
62 if(cocoaNSButton)
63 {
64 sm_cocoaHash.insert(wxCocoaNSButtonHash::value_type(cocoaNSButton,this));
feb82768 65 [cocoaNSButton setTarget: sm_cocoaTarget];
bac6f234
DE
66 [cocoaNSButton setAction: @selector(wxNSButtonAction:)];
67 }
fb896a32
DE
68}
69