]> git.saurik.com Git - wxWidgets.git/blame - src/mac/classic/gauge.cpp
Fix for always failing assert in GetValue. Save the same value that
[wxWidgets.git] / src / mac / classic / gauge.cpp
CommitLineData
2646f485 1/////////////////////////////////////////////////////////////////////////////
9d2c19f1 2// Name: src/mac/classic/gauge.cpp
2646f485
SC
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
9d2c19f1 9// Licence: wxWindows licence
2646f485
SC
10/////////////////////////////////////////////////////////////////////////////
11
9d2c19f1
WS
12
13#include "wx/wxprec.h"
14
15#if wxUSE_GAUGE
16
2646f485
SC
17#include "wx/gauge.h"
18
2646f485 19IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
2646f485
SC
20
21#include "wx/mac/uma.h"
22
23bool wxGauge::Create(wxWindow *parent, wxWindowID id,
9d2c19f1
WS
24 int range,
25 const wxPoint& pos,
26 const wxSize& s,
27 long style,
28 const wxValidator& validator,
29 const wxString& name)
2646f485
SC
30{
31 if ( !wxGaugeBase::Create(parent, id, range, pos, s, style, validator, name) )
32 return false;
33
34 wxSize size = s ;
35 Rect bounds ;
36 Str255 title ;
37 m_rangeMax = range ;
38 m_gaugePos = 0 ;
9d2c19f1 39
422d0ff0 40 if ( size.x == wxDefaultCoord && size.y == wxDefaultCoord)
2646f485
SC
41 {
42 size = wxSize( 200 , 16 ) ;
43 }
9d2c19f1 44
2646f485 45 MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
9d2c19f1
WS
46
47 m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range,
2646f485 48 kControlProgressBarProc , (long) this ) ;
9d2c19f1 49
2646f485 50 MacPostControlCreate() ;
9d2c19f1
WS
51
52 return true;
2646f485
SC
53}
54
55void wxGauge::SetShadowWidth(int w)
56{
57}
58
59void wxGauge::SetBezelFace(int w)
60{
61}
62
63void wxGauge::SetRange(int r)
64{
65 m_rangeMax = r;
66 ::SetControl32BitMaximum( (ControlHandle) m_macControl , m_rangeMax ) ;
67}
68
69void wxGauge::SetValue(int pos)
70{
71 m_gaugePos = pos;
72 ::SetControl32BitValue( (ControlHandle) m_macControl , m_gaugePos ) ;
73}
74
fe8635a7
RR
75void wxGauge::Pulse()
76{
77 // need to use the animate() method of NSProgressIndicator Class here
78}
79
2646f485
SC
80int wxGauge::GetShadowWidth() const
81{
82 return 0;
83}
84
85int wxGauge::GetBezelFace() const
86{
87 return 0;
88}
89
90int wxGauge::GetRange() const
91{
92 return m_rangeMax;
93}
94
95int wxGauge::GetValue() const
96{
97 return m_gaugePos;
98}
99
9d2c19f1 100#endif // wxUSE_GAUGE