Merge "Add GetCharacterIndexAtPosition API" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / progress-bar / progress-bar-impl.cpp
index 42d2189..68abe9b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -165,11 +165,14 @@ ProgressBar::~ProgressBar()
 
 void ProgressBar::OnInitialize()
 {
-  DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
-    return std::make_unique<ProgressBarAccessible>(actor, Dali::Accessibility::Role::PROGRESS_BAR);
-  });
-  //Enable highightability
-  Self().SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, true);
+  // Accessibility
+  Self().SetProperty(DevelControl::Property::ACCESSIBILITY_ROLE, Dali::Accessibility::Role::PROGRESS_BAR);
+  Self().SetProperty(DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, true);
+}
+
+DevelControl::ControlAccessible* ProgressBar::CreateAccessibleObject()
+{
+  return new ProgressBarAccessible(Self());
 }
 
 void ProgressBar::OnRelayout(const Vector2& size, RelayoutContainer& container)
@@ -258,7 +261,7 @@ void ProgressBar::SetProgressValue(float value)
 {
   // update the progress bar value (taking float precision errors into account)
   // TODO : it seems 0.0f cannot into this statement.
-  if((mProgressValue != value) &&
+  if((!Equals(mProgressValue, value)) &&
      ((value >= DEFAULT_LOWER_BOUND) || (Equals(value, DEFAULT_LOWER_BOUND))) &&
      ((value <= DEFAULT_UPPER_BOUND) || (Equals(value, DEFAULT_UPPER_BOUND))))
   {
@@ -270,7 +273,7 @@ void ProgressBar::SetProgressValue(float value)
     mValueChangedSignal.Emit(self, mProgressValue, mSecondaryProgressValue);
     if(Self() == Dali::Accessibility::Accessible::GetCurrentlyHighlightedActor())
     {
-      Control::Impl::GetAccessibilityObject(Self())->Emit(Dali::Accessibility::ObjectPropertyChangeEvent::VALUE);
+      GetAccessibleObject()->Emit(Dali::Accessibility::ObjectPropertyChangeEvent::VALUE);
     }
     RelayoutRequest();
   }
@@ -285,7 +288,7 @@ void ProgressBar::SetSecondaryProgressValue(float value)
 {
   // update the progress bar value (taking float precision errors into account)
   // TODO : it seems 0.0f cannot into this statement.
-  if((mSecondaryProgressValue != value) &&
+  if((!Equals(mSecondaryProgressValue, value)) &&
      ((value >= DEFAULT_LOWER_BOUND) || (Equals(value, DEFAULT_LOWER_BOUND))) &&
      ((value <= DEFAULT_UPPER_BOUND) || (Equals(value, DEFAULT_UPPER_BOUND))))
   {