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