X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e3e817d4acf3c5fa067f4f561c2a6cee161f61c5..91edf16cb8823970f1ed5a2132b9a242150cf8a9:/src/mac/carbon/gauge.cpp diff --git a/src/mac/carbon/gauge.cpp b/src/mac/carbon/gauge.cpp index 6e9ed032f2..6f97b03578 100644 --- a/src/mac/carbon/gauge.cpp +++ b/src/mac/carbon/gauge.cpp @@ -47,8 +47,10 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id, m_peer = new wxMacControl() ; verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , GetValue() , 0 , GetRange() , false /* not indeterminate */ , m_peer->GetControlRefAddr() ) ); - - + + if ( GetValue() == 0 ) + m_peer->SetData( kControlEntireControl , kControlProgressBarAnimatingTag , (Boolean) false ) ; + MacPostControlCreate(pos,size) ; return TRUE; @@ -69,7 +71,19 @@ void wxGauge::SetValue(int pos) // some change behind the values by it wxGaugeBase::SetValue(pos) ; if ( m_peer && m_peer->Ok() ) + { m_peer->SetValue( GetValue() ) ; + // we turn off animation in the unnecessary situations as this is eating a lot of CPU otherwise + Boolean shouldAnimate = ( GetValue() > 0 && GetValue() < GetRange() ) ; + if ( m_peer->GetData( kControlEntireControl , kControlProgressBarAnimatingTag ) != shouldAnimate ) + { + m_peer->SetData( kControlEntireControl , kControlProgressBarAnimatingTag , shouldAnimate ) ; + if ( !shouldAnimate ) + { + Refresh() ; + } + } + } } int wxGauge::GetValue() const