]> git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/gauge.cpp
a9c5f876495f77a9e624276f45ec04d9663cd48f
[wxWidgets.git] / src / mac / classic / 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 IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
19
20 #include "wx/mac/uma.h"
21
22 bool wxGauge::Create(wxWindow *parent, wxWindowID id,
23 int range,
24 const wxPoint& pos,
25 const wxSize& s,
26 long style,
27 const wxValidator& validator,
28 const wxString& name)
29 {
30 if ( !wxGaugeBase::Create(parent, id, range, pos, s, style, validator, name) )
31 return false;
32
33 wxSize size = s ;
34 Rect bounds ;
35 Str255 title ;
36 m_rangeMax = range ;
37 m_gaugePos = 0 ;
38
39 if ( size.x == wxDefaultCoord && size.y == wxDefaultCoord)
40 {
41 size = wxSize( 200 , 16 ) ;
42 }
43
44 MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
45
46 m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range,
47 kControlProgressBarProc , (long) this ) ;
48
49 MacPostControlCreate() ;
50
51 return TRUE;
52 }
53
54 void wxGauge::SetShadowWidth(int w)
55 {
56 }
57
58 void wxGauge::SetBezelFace(int w)
59 {
60 }
61
62 void wxGauge::SetRange(int r)
63 {
64 m_rangeMax = r;
65 ::SetControl32BitMaximum( (ControlHandle) m_macControl , m_rangeMax ) ;
66 }
67
68 void wxGauge::SetValue(int pos)
69 {
70 m_gaugePos = pos;
71 ::SetControl32BitValue( (ControlHandle) m_macControl , m_gaugePos ) ;
72 }
73
74 int wxGauge::GetShadowWidth() const
75 {
76 return 0;
77 }
78
79 int wxGauge::GetBezelFace() const
80 {
81 return 0;
82 }
83
84 int wxGauge::GetRange() const
85 {
86 return m_rangeMax;
87 }
88
89 int wxGauge::GetValue() const
90 {
91 return m_gaugePos;
92 }
93