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