]> git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/gauge.cpp
fix warnings (double to int conversions and unused variables); removed hard TABs...
[wxWidgets.git] / src / mac / classic / gauge.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/classic/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
13 #include "wx/wxprec.h"
14
15 #if wxUSE_GAUGE
16
17 #include "wx/gauge.h"
18
19 IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
20
21 #include "wx/mac/uma.h"
22
23 bool wxGauge::Create(wxWindow *parent, 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 if ( !wxGaugeBase::Create(parent, id, range, pos, s, style, validator, name) )
32 return false;
33
34 wxSize size = s ;
35 Rect bounds ;
36 Str255 title ;
37 m_rangeMax = range ;
38 m_gaugePos = 0 ;
39
40 if ( size.x == wxDefaultCoord && size.y == wxDefaultCoord)
41 {
42 size = wxSize( 200 , 16 ) ;
43 }
44
45 MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
46
47 m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range,
48 kControlProgressBarProc , (long) this ) ;
49
50 MacPostControlCreate() ;
51
52 return true;
53 }
54
55 void wxGauge::SetShadowWidth(int w)
56 {
57 }
58
59 void wxGauge::SetBezelFace(int w)
60 {
61 }
62
63 void wxGauge::SetRange(int r)
64 {
65 m_rangeMax = r;
66 ::SetControl32BitMaximum( (ControlHandle) m_macControl , m_rangeMax ) ;
67 }
68
69 void wxGauge::SetValue(int pos)
70 {
71 m_gaugePos = pos;
72 ::SetControl32BitValue( (ControlHandle) m_macControl , m_gaugePos ) ;
73 }
74
75 void wxGauge::Pulse()
76 {
77 // need to use the animate() method of NSProgressIndicator Class here
78 }
79
80 int wxGauge::GetShadowWidth() const
81 {
82 return 0;
83 }
84
85 int wxGauge::GetBezelFace() const
86 {
87 return 0;
88 }
89
90 int wxGauge::GetRange() const
91 {
92 return m_rangeMax;
93 }
94
95 int wxGauge::GetValue() const
96 {
97 return m_gaugePos;
98 }
99
100 #endif // wxUSE_GAUGE