]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/gauge.cpp
setting and restoring the graf port
[wxWidgets.git] / src / mac / carbon / gauge.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gauge.cpp
3 // Purpose: wxGauge class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
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 wxSize size = s ;
33 Rect bounds ;
34 Str255 title ;
35 m_rangeMax = range ;
36
37 if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
38 {
39 size = wxSize( 200 , 16 ) ;
40 }
41
42 MacPreControlCreate( parent , id , "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
43
44 m_macControl = ::NewControl( parent->MacGetRootWindow() , &bounds , title , false , 0 , 0 , range,
45 kControlProgressBarProc , (long) this ) ;
46
47 MacPostControlCreate() ;
48
49 return TRUE;
50 }
51
52 void wxGauge::SetShadowWidth(int w)
53 {
54 }
55
56 void wxGauge::SetBezelFace(int w)
57 {
58 }
59
60 void wxGauge::SetRange(int r)
61 {
62 m_rangeMax = r;
63 ::SetControlMaximum( m_macControl , m_rangeMax ) ;
64 }
65
66 void wxGauge::SetValue(int pos)
67 {
68 m_gaugePos = pos;
69 ::SetControlValue( m_macControl , m_gaugePos ) ;
70 }
71
72 int wxGauge::GetShadowWidth() const
73 {
74 return 0;
75 }
76
77 int wxGauge::GetBezelFace() const
78 {
79 return 0;
80 }
81
82 int wxGauge::GetRange() const
83 {
84 return m_rangeMax;
85 }
86
87 int wxGauge::GetValue() const
88 {
89 return m_gaugePos;
90 }
91