Fix wxComboCtrlBase::DoGetSizeFromTextSize() performance regression.
[wxWidgets.git] / src / osx / gauge_osx.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/gauge_osx.cpp
3 // Purpose: wxGauge class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #include "wx/wxprec.h"
12
13 #if wxUSE_GAUGE
14
15 #include "wx/gauge.h"
16
17 #include "wx/osx/private.h"
18
19 bool wxGauge::Create( wxWindow *parent,
20 wxWindowID id,
21 int range,
22 const wxPoint& pos,
23 const wxSize& s,
24 long style,
25 const wxValidator& validator,
26 const wxString& name )
27 {
28 DontCreatePeer();
29
30 if ( !wxGaugeBase::Create( parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name ) )
31 return false;
32
33 wxSize size = s;
34
35 SetPeer(wxWidgetImpl::CreateGauge( this, parent, id, GetValue() , 0, GetRange(), pos, size, style, GetExtraStyle() ));
36
37 MacPostControlCreate( pos, size );
38
39 return true;
40 }
41
42 void wxGauge::SetRange(int r)
43 {
44 // we are going via the base class in case there is
45 // some change behind the values by it
46 wxGaugeBase::SetRange( r ) ;
47 if ( GetPeer() )
48 GetPeer()->SetMaximum( GetRange() ) ;
49 }
50
51 void wxGauge::SetValue(int pos)
52 {
53 // we are going via the base class in case there is
54 // some change behind the values by it
55 wxGaugeBase::SetValue( pos ) ;
56
57 if ( GetPeer() )
58 GetPeer()->SetValue( GetValue() ) ;
59 }
60
61 int wxGauge::GetValue() const
62 {
63 return m_gaugePos ;
64 }
65
66 void wxGauge::Pulse()
67 {
68 GetPeer()->PulseGauge();
69 }
70
71 #endif // wxUSE_GAUGE
72