]>
Commit | Line | Data |
---|---|---|
524c47aa SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/osx/gauge_osx.cpp | |
3 | // Purpose: wxGauge class | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
b5b208a1 | 7 | // RCS-ID: $Id$ |
524c47aa SC |
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 | ||
524c47aa SC |
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 ) | |
d15694e8 SC |
28 | { |
29 | DontCreatePeer(); | |
30 | ||
524c47aa SC |
31 | if ( !wxGaugeBase::Create( parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name ) ) |
32 | return false; | |
33 | ||
34 | wxSize size = s; | |
35 | ||
22756322 | 36 | SetPeer(wxWidgetImpl::CreateGauge( this, parent, id, GetValue() , 0, GetRange(), pos, size, style, GetExtraStyle() )); |
524c47aa SC |
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 ) ; | |
22756322 SC |
48 | if ( GetPeer() ) |
49 | GetPeer()->SetMaximum( GetRange() ) ; | |
524c47aa SC |
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 | ||
22756322 SC |
58 | if ( GetPeer() ) |
59 | GetPeer()->SetValue( GetValue() ) ; | |
524c47aa SC |
60 | } |
61 | ||
62 | int wxGauge::GetValue() const | |
63 | { | |
64 | return m_gaugePos ; | |
65 | } | |
66 | ||
67 | void wxGauge::Pulse() | |
68 | { | |
22756322 | 69 | GetPeer()->PulseGauge(); |
524c47aa SC |
70 | } |
71 | ||
72 | #endif // wxUSE_GAUGE | |
73 |