]> git.saurik.com Git - wxWidgets.git/blame - src/osx/cocoa/tglbtn.mm
Fix harmless warning about NULL in wxStyledTextCtrl code.
[wxWidgets.git] / src / osx / cocoa / tglbtn.mm
CommitLineData
f033830e
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/osx/cocoa/tglbtn.mm
3// Purpose: Definition of the wxToggleButton class, which implements a
4// toggle button under wxMac.
5// Author: Stefan Csomor
6// Modified by:
7// Created: 08.02.01
a9a4f229 8// RCS-ID: $Id$
f033830e 9// Copyright: (c) Stefan Csomor
526954c5 10// Licence: wxWindows licence
f033830e
SC
11/////////////////////////////////////////////////////////////////////////////
12
13// ============================================================================
14// declatations
15// ============================================================================
16
17// ----------------------------------------------------------------------------
18// headers
19// ----------------------------------------------------------------------------
20
21#include "wx/wxprec.h"
22
23#if wxUSE_TOGGLEBTN
24
25#include "wx/tglbtn.h"
26#include "wx/osx/private.h"
27
7f08aa6c
SC
28// from button.mm
29
04a6d8ef
VZ
30extern "C" void SetBezelStyleFromBorderFlags(NSButton *v,
31 long style,
32 wxWindowID winid = wxID_ANY,
0c2e6e8b
VZ
33 const wxString& label = wxString(),
34 const wxBitmap& bitmap = wxBitmap());
7f08aa6c 35
03647350
VZ
36wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
37 wxWindowMac* WXUNUSED(parent),
04a6d8ef
VZ
38 wxWindowID winid,
39 const wxString& label,
03647350 40 const wxPoint& pos,
f033830e 41 const wxSize& size,
7e04f44c 42 long style,
d8207702 43 long WXUNUSED(extraStyle))
f033830e 44{
dbeddfb9 45 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
f033830e 46 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
03647350 47
04a6d8ef 48 SetBezelStyleFromBorderFlags(v, style, winid, label);
7f08aa6c 49
f033830e 50 [v setButtonType:NSOnOffButton];
9e1da482 51 wxWidgetCocoaImpl* c = new wxButtonCocoaImpl( wxpeer, v );
f033830e
SC
52 return c;
53}
54
03647350
VZ
55wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
56 wxWindowMac* WXUNUSED(parent),
04a6d8ef 57 wxWindowID winid,
7f08aa6c 58 const wxBitmap& label,
03647350 59 const wxPoint& pos,
f033830e 60 const wxSize& size,
7f08aa6c 61 long style,
d8207702 62 long WXUNUSED(extraStyle))
03647350 63{
dbeddfb9 64 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
f033830e 65 wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
03647350 66
0c2e6e8b 67 SetBezelStyleFromBorderFlags(v, style, winid, wxString(), label);
9e1da482 68
a1b806b9 69 if (label.IsOk())
7f08aa6c
SC
70 [v setImage:label.GetNSImage() ];
71
f033830e 72 [v setButtonType:NSOnOffButton];
9e1da482 73 wxWidgetCocoaImpl* c = new wxButtonCocoaImpl( wxpeer, v );
f033830e
SC
74 return c;
75}
76
77#endif // wxUSE_TOGGLEBTN
78