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
9 // Copyright: (c) Stefan Csomor
10 // License: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
13 // ============================================================================
15 // ============================================================================
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
21 #include "wx/wxprec.h"
25 #include "wx/tglbtn.h"
26 #include "wx/osx/private.h"
29 wxWidgetImplType
* wxWidgetImpl::CreateToggleButton( wxWindowMac
* wxpeer
,
32 const wxString
& label
,
38 Rect bounds
= wxMacGetBoundsForControl( wxpeer
, pos
, size
) ;
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() ) );
46 wxWidgetImplType
* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac
* wxpeer
,
49 const wxBitmap
& label
,
55 Rect bounds
= wxMacGetBoundsForControl( wxpeer
, pos
, size
) ;
56 wxMacControl
* peer
= new wxMacControl(wxpeer
) ;
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() ) );
63 wxMacReleaseBitmapButton( &info
) ;
68 #endif // wxUSE_TOGGLEBTN