]> git.saurik.com Git - wxWidgets.git/blame - src/osx/carbon/tglbtn.cpp
avoid setting initial position if it was not specified, broken in r70734
[wxWidgets.git] / src / osx / carbon / tglbtn.cpp
CommitLineData
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
489468fe 8// Copyright: (c) Stefan Csomor
526954c5 9// Licence: wxWindows licence
489468fe
SC
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"
524c47aa 25#include "wx/osx/private.h"
489468fe
SC
26// Button
27
03647350
VZ
28wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
29 wxWindowMac* parent,
30 wxWindowID WXUNUSED(id),
a4fec5b4 31 const wxString& WXUNUSED(label),
03647350 32 const wxPoint& pos,
524c47aa 33 const wxSize& size,
03647350 34 long WXUNUSED(style),
a4fec5b4 35 long WXUNUSED(extraStyle))
489468fe 36{
524c47aa 37 Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
03647350 38
524c47aa 39 wxMacControl* peer = new wxMacControl(wxpeer) ;
03647350 40 verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
524c47aa
SC
41 kControlBevelButtonNormalBevel , kControlBehaviorToggles , NULL , 0 , 0 , 0 , peer->GetControlRefAddr() ) );
42 return peer;
489468fe 43}
03647350
VZ
44
45wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
46 wxWindowMac* parent,
47 wxWindowID WXUNUSED(id),
524c47aa 48 const wxBitmap& label,
03647350 49 const wxPoint& pos,
524c47aa 50 const wxSize& size,
03647350 51 long WXUNUSED(style),
a4fec5b4 52 long WXUNUSED(extraStyle))
03647350 53{
524c47aa
SC
54 Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
55 wxMacControl* peer = new wxMacControl(wxpeer) ;
03647350 56
489468fe 57 ControlButtonContentInfo info;
524c47aa 58 wxMacCreateBitmapButton( &info, label );
03647350 59 verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
524c47aa 60 kControlBevelButtonNormalBevel , kControlBehaviorOffsetContents | kControlBehaviorToggles , &info , 0 , 0 , 0 , peer->GetControlRefAddr() ) );
489468fe 61
524c47aa
SC
62 wxMacReleaseBitmapButton( &info ) ;
63 return peer;
489468fe
SC
64}
65
489468fe
SC
66
67#endif // wxUSE_TOGGLEBTN
68