[AT-SPI] Squashed implementation
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / progress-bar / progress-bar-impl.h
old mode 100755 (executable)
new mode 100644 (file)
index b59c8b3..8d33e02
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_PROGRESS_BAR_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  */
 
-
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali/public-api/animation/animation.h>
-#include <dali-toolkit/devel-api/controls/progress-bar/progress-bar.h>
+#include <dali-toolkit/public-api/controls/progress-bar/progress-bar.h>
+#include <dali-toolkit/devel-api/controls/progress-bar/progress-bar-devel.h>
 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
 
 namespace Dali
 {
@@ -46,11 +47,11 @@ class ProgressBar : public Control
 public:
 
   /**
-   * Create a new ProgressBar.
-   *
+   * Create a new ProgressBar with predefined style.
+   * @param[in] progressBarStyle A style value that determines the shape of the progress bar.
    * @return A public handle to the newly allocated ProgressBar.
    */
-  static Dali::Toolkit::ProgressBar New();
+  static Dali::Toolkit::ProgressBar New( DevelProgressBar::Style progressBarStyle = DevelProgressBar::Style::LINEAR );
 
 public:
 
@@ -171,12 +172,12 @@ protected:
   /**
    * @copydoc CustomActorImpl::OnRelayout()
    */
-  virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
+  void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
 
   /**
    * @copydoc CustomActorImpl::GetNaturalSize()
    */
-  virtual Vector3 GetNaturalSize();
+  Vector3 GetNaturalSize() override;
 
 private:
 
@@ -202,7 +203,7 @@ private:
   /**
    * @copydoc Toolkit::Control::OnInitialize()
    */
-  virtual void OnInitialize();
+  void OnInitialize() override;
 
   /**
    * Get the range of the valid values the ProgressBar handle can move between
@@ -225,7 +226,7 @@ private:
   /**
    * Update progress bar label when progress value is changed
    */
-  void CreateVisualsForComponent( Property::Index index, const Property::Value& value, const float visualDepth );
+  void CreateVisualsForComponent( Property::Index index, const Property::Value& value, const int visualDepth );
 
   /**
    * Update progress bar label when progress value is changed
@@ -233,9 +234,19 @@ private:
   bool GetPropertyMapForVisual( Property::Index visualIndex, Property::Map& retreivedMap ) const;
 
   /**
+   * Apply progress value to visual
+   */
+  void ApplyProgressToVisual( float progress, Property::Index index, int depth );
+
+  /**
+   * Apply progress value to visual transform
+   */
+  void ApplyProgressToVisualTransform( float progress, Vector2 trackSize, Property::Index index );
+
+  /**
    * Check if we should start animating
    */
-  virtual void OnStageConnection( int depth );
+  void OnSceneConnection( int depth ) override;
 
 private:
 
@@ -256,6 +267,21 @@ private:
   float mProgressValue;                                               ///< Current value of ProgressBar
   float mSecondaryProgressValue;                                      ///< Current loading value of ProgressBar
   bool mIndeterminate;                                                ///< Whether the progress state is determined or not
+  Property::Map mTrackVisualMap;                                      ///< To backup visual properties when switching determinate/indeterminate.
+  Property::Map mProgressVisualMap;                                   ///< To backup visual properties when switching determinate/indeterminate.
+  Property::Map mSecondaryProgressVisualMap;                          ///< To backup visual properties when switching determinate/indeterminate.
+
+protected:
+  struct AccessibleImpl : public Control::Impl::AccessibleImpl,
+                          public virtual Dali::Accessibility::Value
+  {
+    using Control::Impl::AccessibleImpl::AccessibleImpl;
+    double GetMinimum() override;
+    double GetCurrent() override;
+    double GetMaximum() override;
+    bool SetCurrent( double ) override;
+    double GetMinimumIncrement() override;
+  };
 };
 
 } // namespace Internal