]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/gauge.cpp
adapted to mac
[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 m_macHorizontalBorder = 2 ; // additional pixels around the real control
37 m_macVerticalBorder = 2 ;
38
39 if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
40 {
41 size = wxSize( 200 , 16 ) ;
42 }
43
44 MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
45
46 m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 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 ::SetControlMaximum( m_macControl , m_rangeMax ) ;
66 }
67
68 void wxGauge::SetValue(int pos)
69 {
70 m_gaugePos = pos;
71 ::SetControlValue( 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