]> git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/tglbtn.cpp
Make mouse capture checking asserts stronger and more detailed.
[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 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declatations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #include "wx/wxprec.h"
21
22 #if wxUSE_TOGGLEBTN
23
24 #include "wx/tglbtn.h"
25 #include "wx/osx/private.h"
26 // Button
27
28 wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
29 wxWindowMac* parent,
30 wxWindowID WXUNUSED(id),
31 const wxString& WXUNUSED(label),
32 const wxPoint& pos,
33 const wxSize& size,
34 long WXUNUSED(style),
35 long WXUNUSED(extraStyle))
36 {
37 Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
38
39 wxMacControl* peer = new wxMacControl(wxpeer) ;
40 verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
41 kControlBevelButtonNormalBevel , kControlBehaviorToggles , NULL , 0 , 0 , 0 , peer->GetControlRefAddr() ) );
42 return peer;
43 }
44
45 wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
46 wxWindowMac* parent,
47 wxWindowID WXUNUSED(id),
48 const wxBitmap& label,
49 const wxPoint& pos,
50 const wxSize& size,
51 long WXUNUSED(style),
52 long WXUNUSED(extraStyle))
53 {
54 Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
55 wxMacControl* peer = new wxMacControl(wxpeer) ;
56
57 ControlButtonContentInfo info;
58 wxMacCreateBitmapButton( &info, label );
59 verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
60 kControlBevelButtonNormalBevel , kControlBehaviorOffsetContents | kControlBehaviorToggles , &info , 0 , 0 , 0 , peer->GetControlRefAddr() ) );
61
62 wxMacReleaseBitmapButton( &info ) ;
63 return peer;
64 }
65
66
67 #endif // wxUSE_TOGGLEBTN
68