+ mSetIndeterminateButton = Toolkit::PushButton::New();
+ mSetIndeterminateButton.SetProperty( Toolkit::Button::Property::LABEL, "Toggle Indeterminate" );
+ mSetIndeterminateButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ mSetIndeterminateButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
+ mSetIndeterminateButton.ClickedSignal().Connect( this, &ProgressBarExample::OnSetIndeterminateButtonSelected );
+
+ buttonBackground.Add( mSetIndeterminateButton );
+
+ mChangeThemeButton = Toolkit::PushButton::New();
+ mChangeThemeButton.SetProperty( Toolkit::Button::Property::LABEL, "Change Theme" );
+ mChangeThemeButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+ mChangeThemeButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
+ mChangeThemeButton.ClickedSignal().Connect( this, &ProgressBarExample::OnChangeThemeButtonSelected );
+
+ buttonBackground.Add( mChangeThemeButton );
+
+ // Create a timer to update the progress of all progress bars
+ mTimer = Timer::New( TIMER_TIMEOUT_TIME );
+ mTimer.TickSignal().Connect( this, &ProgressBarExample::OnTimerTick );
+ mTimer.Start();
+ }
+
+ bool OnTimerTick()
+ {
+ mProgressValue += PROGRESS_INCREMENT_VALUE;
+ mSecondaryProgressValue = mProgressValue + 0.1f;
+ mProgressBarDefault.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue);
+ mProgressBarDefault.SetProperty(ProgressBar::Property::SECONDARY_PROGRESS_VALUE, mSecondaryProgressValue);
+
+ return ( mProgressValue < 1.0f ); // Only call again if progress has NOT got to the end
+ }
+
+ bool OnResetProgressButtonSelected( Toolkit::Button button )
+ {
+ mProgressValue = 0.0f;
+ mSecondaryProgressValue = 0.1f;
+ mProgressBarDefault.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f);
+ mProgressBarDefault.SetProperty(ProgressBar::Property::SECONDARY_PROGRESS_VALUE, 0.1f);
+ mTimer.Start();
+ return true;
+ }
+
+ void OnValueChanged( ProgressBar progressBar, float value, float secondaryValue )
+ {
+ std::stringstream newLabel;
+ newLabel.precision( 2 );
+ newLabel << std::fixed << "current : " << value << " / loaded : " << secondaryValue;
+
+ mProgressBarDefault.SetProperty(ProgressBar::Property::LABEL_VISUAL, newLabel.str() );
+ }
+
+ bool OnSetIndeterminateButtonSelected( Toolkit::Button button )
+ {
+ if( mProgressBarDefault.GetProperty<bool>(ProgressBar::Property::INDETERMINATE))
+ {
+ mProgressBarDefault.SetProperty(ProgressBar::Property::INDETERMINATE, false);
+ }
+ else
+ {
+ mProgressBarDefault.SetProperty(ProgressBar::Property::INDETERMINATE, true);
+ }
+ return true;
+ }
+
+ bool OnChangeThemeButtonSelected( Toolkit::Button button )
+ {
+ StyleManager styleManager = StyleManager::Get();
+
+ if( isDefaultTheme )
+ {
+ styleManager.ApplyTheme( THEME_PATH );
+ isDefaultTheme = false;
+ }
+ else
+ {
+ styleManager.ApplyDefaultTheme();
+ isDefaultTheme = true;
+ }
+ return true;
+ }
+ void OnKeyEvent( const KeyEvent& event )
+ {
+ if( event.state == KeyEvent::Down )
+ {
+ if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
+ {
+ // Exit application when click back or escape.
+ mApplication.Quit();
+ }
+ }
+ }
+
+ // Data