]>
Commit | Line | Data |
---|---|---|
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: gauge.cpp 54820 2008-07-29 20:04:11Z 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 | ||
18 | IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl) | |
19 | ||
20 | #include "wx/osx/private.h" | |
21 | ||
22 | bool wxGauge::Create( wxWindow *parent, | |
23 | wxWindowID id, | |
24 | int range, | |
25 | const wxPoint& pos, | |
26 | const wxSize& s, | |
27 | long style, | |
28 | const wxValidator& validator, | |
29 | const wxString& name ) | |
30 | { | |
31 | m_macIsUserPane = false; | |
32 | ||
33 | if ( !wxGaugeBase::Create( parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name ) ) | |
34 | return false; | |
35 | ||
36 | wxSize size = s; | |
37 | ||
38 | m_peer = wxWidgetImpl::CreateGauge( this, parent, id, GetValue() , 0, GetRange(), pos, size, style, GetExtraStyle() ); | |
39 | ||
40 | MacPostControlCreate( pos, size ); | |
41 | ||
42 | return true; | |
43 | } | |
44 | ||
45 | void wxGauge::SetRange(int r) | |
46 | { | |
47 | // we are going via the base class in case there is | |
48 | // some change behind the values by it | |
49 | wxGaugeBase::SetRange( r ) ; | |
50 | if ( m_peer ) | |
51 | m_peer->SetMaximum( GetRange() ) ; | |
52 | } | |
53 | ||
54 | void wxGauge::SetValue(int pos) | |
55 | { | |
56 | // we are going via the base class in case there is | |
57 | // some change behind the values by it | |
58 | wxGaugeBase::SetValue( pos ) ; | |
59 | ||
60 | if ( m_peer ) | |
61 | m_peer->SetValue( GetValue() ) ; | |
62 | } | |
63 | ||
64 | int wxGauge::GetValue() const | |
65 | { | |
66 | return m_gaugePos ; | |
67 | } | |
68 | ||
69 | void wxGauge::Pulse() | |
70 | { | |
71 | m_peer->PulseGauge(); | |
72 | } | |
73 | ||
74 | #endif // wxUSE_GAUGE | |
75 |