+ if ( m_peer && m_peer->Ok() )
+ {
+ // switch back to determinate mode if not there already
+ if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false )
+ {
+ m_peer->SetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag, (Boolean)false );
+ }
+
+ m_peer->SetValue( GetValue() ) ;
+
+ // turn off animation in the unnecessary situations as this is consuming a lot of CPU otherwise
+ Boolean shouldAnimate = ( GetValue() > 0 && GetValue() < GetRange() ) ;
+ if ( m_peer->GetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag ) != shouldAnimate )
+ {
+ m_peer->SetData<Boolean>( kControlEntireControl, kControlProgressBarAnimatingTag, shouldAnimate ) ;
+ if ( !shouldAnimate )
+ Refresh() ;
+ }
+ }