]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/gauge.cpp
wxMovieCtrl - for playing movies - mac carbon QT 3 MSW-compatable implementation...
[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 wxUSE_GAUGE
19
20 #if !USE_SHARED_LIBRARY
21 IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
22 #endif
23
24 #include "wx/mac/uma.h"
25
26 bool wxGauge::Create(wxWindow *parent, wxWindowID id,
27 int range,
28 const wxPoint& pos,
29 const wxSize& s,
30 long style,
31 const wxValidator& validator,
32 const wxString& name)
33 {
34 m_macIsUserPane = FALSE ;
35
36 if ( !wxGaugeBase::Create(parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name) )
37 return false;
38
39 wxSize size = s ;
40 /*
41 if ( size.x == wxDefaultCoord && size.y == wxDefaultCoord)
42 {
43 size = wxSize( 200 , 16 ) ;
44 }
45 */
46 Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
47 m_peer = new wxMacControl() ;
48 verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
49 GetValue() , 0 , GetRange() , false /* not indeterminate */ , m_peer->GetControlRefAddr() ) );
50
51
52 MacPostControlCreate(pos,size) ;
53
54 return TRUE;
55 }
56
57 void wxGauge::SetRange(int r)
58 {
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() ) ;
64 }
65
66 void wxGauge::SetValue(int pos)
67 {
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() ) ;
73 }
74
75 int wxGauge::GetValue() const
76 {
77 /*
78 if ( m_peer && m_peer->Ok() )
79 return m_peer->GetValue() ;
80 */
81 return m_gaugePos ;
82 }
83
84 #endif // wxUSE_GAUGE
85