]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/gauge.cpp
making getter const
[wxWidgets.git] / src / mac / carbon / gauge.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gauge.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 #ifdef __GNUG__
13 #pragma implementation "gauge.h"
14 #endif
15
16 #include "wx/gauge.h"
17
18 #if !USE_SHARED_LIBRARY
19 IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
20 #endif
21
22 #include "wx/mac/uma.h"
23
24 bool wxGauge::Create(wxWindow *parent, wxWindowID id,
25 int range,
26 const wxPoint& pos,
27 const wxSize& s,
28 long style,
29 const wxValidator& validator,
30 const wxString& name)
31 {
32 m_macIsUserPane = FALSE ;
33
34 if ( !wxGaugeBase::Create(parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name) )
35 return false;
36
37 wxSize size = s ;
38 /*
39 if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
40 {
41 size = wxSize( 200 , 16 ) ;
42 }
43 */
44 Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
45 m_peer = new wxMacControl() ;
46 verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
47 GetValue() , 0 , GetRange() , false /* not indeterminate */ , m_peer->GetControlRefAddr() ) );
48
49
50 MacPostControlCreate(pos,size) ;
51
52 return TRUE;
53 }
54
55 void wxGauge::SetRange(int r)
56 {
57 // we are going via the base class in case there is
58 // some change behind the values by it
59 wxGaugeBase::SetRange(r) ;
60 if ( m_peer && m_peer->Ok() )
61 m_peer->SetMaximum( GetRange() ) ;
62 }
63
64 void wxGauge::SetValue(int pos)
65 {
66 // we are going via the base class in case there is
67 // some change behind the values by it
68 wxGaugeBase::SetValue(pos) ;
69 if ( m_peer && m_peer->Ok() )
70 m_peer->SetValue( GetValue() ) ;
71 }
72
73 int wxGauge::GetValue() const
74 {
75 /*
76 if ( m_peer && m_peer->Ok() )
77 return m_peer->GetValue() ;
78 */
79 return m_gaugePos ;
80 }
81