]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/gauge.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGauge class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "gauge.h"
18 #if !USE_SHARED_LIBRARY
19 IMPLEMENT_DYNAMIC_CLASS(wxGauge
, wxControl
)
22 #include "wx/mac/uma.h"
24 bool wxGauge::Create(wxWindow
*parent
, wxWindowID id
,
29 const wxValidator
& validator
,
32 m_macIsUserPane
= FALSE
;
34 if ( !wxGaugeBase::Create(parent
, id
, range
, pos
, s
, style
& 0xE0FFFFFF, validator
, name
) )
39 if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
41 size = wxSize( 200 , 16 ) ;
44 Rect bounds
= wxMacGetBoundsForControl( this , pos
, size
) ;
45 m_peer
= new wxMacControl() ;
46 verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent
->MacGetTopLevelWindowRef()) , &bounds
,
47 GetValue() , 0 , GetRange() , false /* not indeterminate */ , *m_peer
) );
50 MacPostControlCreate(pos
,size
) ;
55 void wxGauge::SetRange(int r
)
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() ) ;
64 void wxGauge::SetValue(int pos
)
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() ) ;
73 int wxGauge::GetValue() const
76 if ( m_peer && m_peer->Ok() )
77 return m_peer->GetValue() ;