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