merging back XTI branch part 2
[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 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #if wxUSE_GAUGE
15
16 #include "wx/gauge.h"
17
18 #include "wx/osx/private.h"
19
20 bool wxGauge::Create( wxWindow *parent,
21 wxWindowID id,
22 int range,
23 const wxPoint& pos,
24 const wxSize& s,
25 long style,
26 const wxValidator& validator,
27 const wxString& name )
28 {
29 m_macIsUserPane = false;
30
31 if ( !wxGaugeBase::Create( parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name ) )
32 return false;
33
34 wxSize size = s;
35
36 m_peer = wxWidgetImpl::CreateGauge( this, parent, id, GetValue() , 0, GetRange(), pos, size, style, GetExtraStyle() );
37
38 MacPostControlCreate( pos, size );
39
40 return true;
41 }
42
43 void wxGauge::SetRange(int r)
44 {
45 // we are going via the base class in case there is
46 // some change behind the values by it
47 wxGaugeBase::SetRange( r ) ;
48 if ( m_peer )
49 m_peer->SetMaximum( GetRange() ) ;
50 }
51
52 void wxGauge::SetValue(int pos)
53 {
54 // we are going via the base class in case there is
55 // some change behind the values by it
56 wxGaugeBase::SetValue( pos ) ;
57
58 if ( m_peer )
59 m_peer->SetValue( GetValue() ) ;
60 }
61
62 int wxGauge::GetValue() const
63 {
64 return m_gaugePos ;
65 }
66
67 void wxGauge::Pulse()
68 {
69 m_peer->PulseGauge();
70 }
71
72 #endif // wxUSE_GAUGE
73