X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/172da31f537534fd531f05abede196aefa60d6b7..1f1d2182ffe4feb82a1e674266f47d172ed3cb3c:/src/mac/carbon/gauge.cpp diff --git a/src/mac/carbon/gauge.cpp b/src/mac/carbon/gauge.cpp index 9fa85e7746..b2f36abe95 100644 --- a/src/mac/carbon/gauge.cpp +++ b/src/mac/carbon/gauge.cpp @@ -11,7 +11,7 @@ #include "wx/wxprec.h" -#if wxUSE_GAUGE +#if wxUSE_GAUGE #include "wx/gauge.h" @@ -51,27 +51,40 @@ bool wxGauge::Create( wxWindow *parent, m_peer->SetData( kControlEntireControl, kControlProgressBarAnimatingTag, (Boolean)false ); MacPostControlCreate( pos, size ); - + return true; } void wxGauge::SetRange(int r) { - // we are going via the base class in case there is + // we are going via the base class in case there is // some change behind the values by it wxGaugeBase::SetRange( r ) ; - if ( m_peer && m_peer->Ok() ) + if ( m_peer && m_peer->Ok() ){ + // switch back to determinate mode if not there already + if ( m_peer->GetData( kControlNoPart, kControlProgressBarIndeterminateTag ) != false ) + { + m_peer->SetData( kControlNoPart, kControlProgressBarIndeterminateTag, (Boolean)false ); + } + m_peer->SetMaximum( GetRange() ) ; + } } void wxGauge::SetValue(int pos) { - // we are going via the base class in case there is + // we are going via the base class in case there is // some change behind the values by it wxGaugeBase::SetValue( pos ) ; if ( m_peer && m_peer->Ok() ) { + // switch back to determinate mode if not there already + if ( m_peer->GetData( kControlNoPart, kControlProgressBarIndeterminateTag ) != false ) + { + m_peer->SetData( kControlNoPart, kControlProgressBarIndeterminateTag, (Boolean)false ); + } + m_peer->SetValue( GetValue() ) ; // turn off animation in the unnecessary situations as this is consuming a lot of CPU otherwise @@ -95,5 +108,21 @@ int wxGauge::GetValue() const return m_gaugePos ; } +void wxGauge::Pulse() +{ + if ( m_peer && m_peer->Ok() ) + { + if ( m_peer->GetData( kControlNoPart, kControlProgressBarIndeterminateTag ) != true ) + { + m_peer->SetData( kControlNoPart, kControlProgressBarIndeterminateTag, true); + } + + if ( m_peer->GetData( kControlEntireControl, kControlProgressBarAnimatingTag ) != true ) + { + m_peer->SetData( kControlEntireControl, kControlProgressBarAnimatingTag, true ) ; + } + } +} + #endif // wxUSE_GAUGE