]> git.saurik.com Git - wxWidgets.git/blame - src/osx/carbon/tglbtn.cpp
Fix crash in wxDC::GetMultiLineTextExtent() after last commit.
[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
8// RCS-ID: $Id$
9// Copyright: (c) Stefan Csomor
526954c5 10// Licence: wxWindows licence
489468fe
SC
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
03647350
VZ
29wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
30 wxWindowMac* parent,
31 wxWindowID WXUNUSED(id),
a4fec5b4 32 const wxString& WXUNUSED(label),
03647350 33 const wxPoint& pos,
524c47aa 34 const wxSize& size,
03647350 35 long WXUNUSED(style),
a4fec5b4 36 long WXUNUSED(extraStyle))
489468fe 37{
524c47aa 38 Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
03647350 39
524c47aa 40 wxMacControl* peer = new wxMacControl(wxpeer) ;
03647350 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}
03647350
VZ
45
46wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
47 wxWindowMac* parent,
48 wxWindowID WXUNUSED(id),
524c47aa 49 const wxBitmap& label,
03647350 50 const wxPoint& pos,
524c47aa 51 const wxSize& size,
03647350 52 long WXUNUSED(style),
a4fec5b4 53 long WXUNUSED(extraStyle))
03647350 54{
524c47aa
SC
55 Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
56 wxMacControl* peer = new wxMacControl(wxpeer) ;
03647350 57
489468fe 58 ControlButtonContentInfo info;
524c47aa 59 wxMacCreateBitmapButton( &info, label );
03647350 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