]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/gauge.cpp
corrected GetPosition and extended erasing to include the entire update rgn passed
[wxWidgets.git] / src / mac / carbon / gauge.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: gauge.cpp
3// Purpose: wxGauge class
a31a5f85 4// Author: Stefan Csomor
e9576ca5 5// Modified by:
a31a5f85 6// Created: 1998-01-01
e9576ca5 7// RCS-ID: $Id$
a31a5f85 8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "gauge.h"
14#endif
15
16#include "wx/gauge.h"
17
2f1ae414 18#if !USE_SHARED_LIBRARY
e9576ca5 19IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
2f1ae414 20#endif
e9576ca5 21
d497dca4 22#include "wx/mac/uma.h"
519cb848 23
e9576ca5
SC
24bool wxGauge::Create(wxWindow *parent, wxWindowID id,
25 int range,
26 const wxPoint& pos,
519cb848 27 const wxSize& s,
e9576ca5
SC
28 long style,
29 const wxValidator& validator,
30 const wxString& name)
31{
facd6764 32 m_macIsUserPane = FALSE ;
21fd5529 33
facd6764 34 if ( !wxGaugeBase::Create(parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name) )
b45ed7a2
VZ
35 return false;
36
e40298d5 37 wxSize size = s ;
f4e8ff28 38 /*
422d0ff0 39 if ( size.x == wxDefaultCoord && size.y == wxDefaultCoord)
e40298d5
JS
40 {
41 size = wxSize( 200 , 16 ) ;
42 }
f4e8ff28 43 */
facd6764 44 Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
21fd5529 45 m_peer = new wxMacControl() ;
4c37f124 46 verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
5ca0d812 47 GetValue() , 0 , GetRange() , false /* not indeterminate */ , m_peer->GetControlRefAddr() ) );
21fd5529 48
4c37f124 49
facd6764 50 MacPostControlCreate(pos,size) ;
e40298d5
JS
51
52 return TRUE;
e9576ca5
SC
53}
54
e9576ca5
SC
55void wxGauge::SetRange(int r)
56{
21fd5529
SC
57 // we are going via the base class in case there is
58 // some change behind the values by it
59 wxGaugeBase::SetRange(r) ;
60 if ( m_peer && m_peer->Ok() )
61 m_peer->SetMaximum( GetRange() ) ;
e9576ca5
SC
62}
63
64void wxGauge::SetValue(int pos)
65{
21fd5529
SC
66 // we are going via the base class in case there is
67 // some change behind the values by it
68 wxGaugeBase::SetValue(pos) ;
69 if ( m_peer && m_peer->Ok() )
70 m_peer->SetValue( GetValue() ) ;
e9576ca5
SC
71}
72
73int wxGauge::GetValue() const
74{
21fd5529
SC
75/*
76 if ( m_peer && m_peer->Ok() )
77 return m_peer->GetValue() ;
78*/
79 return m_gaugePos ;
e9576ca5
SC
80}
81