]>
Commit | Line | Data |
---|---|---|
489468fe | 1 | ///////////////////////////////////////////////////////////////////////////// |
524c47aa | 2 | // Name: src/osx/carbon/tglbtn.cpp |
489468fe SC |
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" | |
524c47aa | 26 | #include "wx/osx/private.h" |
489468fe SC |
27 | // Button |
28 | ||
524c47aa SC |
29 | wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer, |
30 | wxWindowMac* parent, | |
a4fec5b4 SC |
31 | wxWindowID WXUNUSED(id), |
32 | const wxString& WXUNUSED(label), | |
524c47aa SC |
33 | const wxPoint& pos, |
34 | const wxSize& size, | |
a4fec5b4 SC |
35 | long WXUNUSED(style), |
36 | long WXUNUSED(extraStyle)) | |
489468fe | 37 | { |
524c47aa | 38 | Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; |
489468fe | 39 | |
524c47aa | 40 | wxMacControl* peer = new wxMacControl(wxpeer) ; |
489468fe | 41 | verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , |
524c47aa SC |
42 | kControlBevelButtonNormalBevel , kControlBehaviorToggles , NULL , 0 , 0 , 0 , peer->GetControlRefAddr() ) ); |
43 | return peer; | |
489468fe | 44 | } |
489468fe | 45 | |
524c47aa SC |
46 | wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer, |
47 | wxWindowMac* parent, | |
a4fec5b4 | 48 | wxWindowID WXUNUSED(id), |
524c47aa SC |
49 | const wxBitmap& label, |
50 | const wxPoint& pos, | |
51 | const wxSize& size, | |
a4fec5b4 SC |
52 | long WXUNUSED(style), |
53 | long WXUNUSED(extraStyle)) | |
524c47aa SC |
54 | { |
55 | Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; | |
56 | wxMacControl* peer = new wxMacControl(wxpeer) ; | |
489468fe SC |
57 | |
58 | ControlButtonContentInfo info; | |
524c47aa | 59 | wxMacCreateBitmapButton( &info, label ); |
489468fe | 60 | verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , |
524c47aa | 61 | kControlBevelButtonNormalBevel , kControlBehaviorOffsetContents | kControlBehaviorToggles , &info , 0 , 0 , 0 , peer->GetControlRefAddr() ) ); |
489468fe | 62 | |
524c47aa SC |
63 | wxMacReleaseBitmapButton( &info ) ; |
64 | return peer; | |
489468fe SC |
65 | } |
66 | ||
489468fe SC |
67 | |
68 | #endif // wxUSE_TOGGLEBTN | |
69 |