]>
Commit | Line | Data |
---|---|---|
e9576ca5 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: gauge.cpp | |
3 | // Purpose: wxGauge class | |
a31a5f85 | 4 | // Author: Stefan Csomor |
e9576ca5 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
e9576ca5 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
65571936 | 9 | // Licence: wxWindows licence |
e9576ca5 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifdef __GNUG__ | |
13 | #pragma implementation "gauge.h" | |
14 | #endif | |
15 | ||
16 | #include "wx/gauge.h" | |
17 | ||
e3e817d4 RN |
18 | #if wxUSE_GAUGE |
19 | ||
2f1ae414 | 20 | #if !USE_SHARED_LIBRARY |
e9576ca5 | 21 | IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl) |
2f1ae414 | 22 | #endif |
e9576ca5 | 23 | |
d497dca4 | 24 | #include "wx/mac/uma.h" |
519cb848 | 25 | |
e9576ca5 SC |
26 | bool wxGauge::Create(wxWindow *parent, wxWindowID id, |
27 | int range, | |
28 | const wxPoint& pos, | |
519cb848 | 29 | const wxSize& s, |
e9576ca5 SC |
30 | long style, |
31 | const wxValidator& validator, | |
32 | const wxString& name) | |
33 | { | |
facd6764 | 34 | m_macIsUserPane = FALSE ; |
21fd5529 | 35 | |
facd6764 | 36 | if ( !wxGaugeBase::Create(parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name) ) |
b45ed7a2 VZ |
37 | return false; |
38 | ||
e40298d5 | 39 | wxSize size = s ; |
f4e8ff28 | 40 | /* |
422d0ff0 | 41 | if ( size.x == wxDefaultCoord && size.y == wxDefaultCoord) |
e40298d5 JS |
42 | { |
43 | size = wxSize( 200 , 16 ) ; | |
44 | } | |
f4e8ff28 | 45 | */ |
facd6764 | 46 | Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; |
21fd5529 | 47 | m_peer = new wxMacControl() ; |
4c37f124 | 48 | verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , |
5ca0d812 | 49 | GetValue() , 0 , GetRange() , false /* not indeterminate */ , m_peer->GetControlRefAddr() ) ); |
21fd5529 | 50 | |
4c37f124 | 51 | |
facd6764 | 52 | MacPostControlCreate(pos,size) ; |
e40298d5 JS |
53 | |
54 | return TRUE; | |
e9576ca5 SC |
55 | } |
56 | ||
e9576ca5 SC |
57 | void wxGauge::SetRange(int r) |
58 | { | |
21fd5529 SC |
59 | // we are going via the base class in case there is |
60 | // some change behind the values by it | |
61 | wxGaugeBase::SetRange(r) ; | |
62 | if ( m_peer && m_peer->Ok() ) | |
63 | m_peer->SetMaximum( GetRange() ) ; | |
e9576ca5 SC |
64 | } |
65 | ||
66 | void wxGauge::SetValue(int pos) | |
67 | { | |
21fd5529 SC |
68 | // we are going via the base class in case there is |
69 | // some change behind the values by it | |
70 | wxGaugeBase::SetValue(pos) ; | |
71 | if ( m_peer && m_peer->Ok() ) | |
72 | m_peer->SetValue( GetValue() ) ; | |
e9576ca5 SC |
73 | } |
74 | ||
75 | int wxGauge::GetValue() const | |
76 | { | |
21fd5529 SC |
77 | /* |
78 | if ( m_peer && m_peer->Ok() ) | |
79 | return m_peer->GetValue() ; | |
80 | */ | |
81 | return m_gaugePos ; | |
e9576ca5 SC |
82 | } |
83 | ||
e3e817d4 RN |
84 | #endif // wxUSE_GAUGE |
85 |