]> git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/tglbtn.cpp
minor fixes; replace references to Windows95 with references to wxMSW where possible
[wxWidgets.git] / src / osx / carbon / tglbtn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/tglbtn.cpp
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
8 // RCS-ID: $Id$
9 // Copyright: (c) Stefan Csomor
10 // License: wxWindows license
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 // Button
28
29 wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
30 wxWindowMac* parent,
31 wxWindowID id,
32 const wxString& label,
33 const wxPoint& pos,
34 const wxSize& size,
35 long style,
36 long extraStyle)
37 {
38 Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
39
40 wxMacControl* peer = new wxMacControl(wxpeer) ;
41 verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
42 kControlBevelButtonNormalBevel , kControlBehaviorToggles , NULL , 0 , 0 , 0 , peer->GetControlRefAddr() ) );
43 return peer;
44 }
45
46 wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
47 wxWindowMac* parent,
48 wxWindowID id,
49 const wxBitmap& label,
50 const wxPoint& pos,
51 const wxSize& size,
52 long style,
53 long extraStyle)
54 {
55 Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
56 wxMacControl* peer = new wxMacControl(wxpeer) ;
57
58 ControlButtonContentInfo info;
59 wxMacCreateBitmapButton( &info, label );
60 verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
61 kControlBevelButtonNormalBevel , kControlBehaviorOffsetContents | kControlBehaviorToggles , &info , 0 , 0 , 0 , peer->GetControlRefAddr() ) );
62
63 wxMacReleaseBitmapButton( &info ) ;
64 return peer;
65 }
66
67
68 #endif // wxUSE_TOGGLEBTN
69