[dali_1.3.54] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / buttons / button-impl.h
index e5854d7..7259b98 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_BUTTON_H
 
 /*
- * Copyright (c) 2014 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/devel-api/visual-factory/visual-base.h>
-#include <dali-toolkit/public-api/controls/buttons/button.h>
+#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
 
-//#if defined(DEBUG_ENABLED)
-//  Debug::Filter* gLogButtonFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_BUTTON_CONTROL");
-//#endif
-
 namespace Dali
 {
 
@@ -153,12 +149,13 @@ public:
   std::string GetLabelText() const;
 
   /**
-   * @brief Sets the specified properties on the button label.
+   * @brief Produces a Property::Map of Text properties to create a Text Visual, merging existing properties with supplied map
    * If the label does not exist yet, it is created.
    * The derived buttons are notified if any properties are changed.
    * @param[in] properties A Property::Map of key-value pairs of properties to set.
+   * @param[out] properties A Property::Map of text visual properties to set after merging inMap with existing maps
    */
-  void SetupLabel( const Property::Map& properties );
+  void MergeWithExistingLabelProperties( const Property::Map& inMap, Property::Map& outMap );
 
   /**
    * Performs actions as requested using the action name.
@@ -220,47 +217,22 @@ public: // Deprecated API
 
   /**
    * @deprecated Sets the unselected image with an Actor.
-   * @param[in] image The Actor to use.
+   * @param[in] image The Image to use.
    */
-  void SetUnselectedImage( Actor image );
+  void SetButtonImage( Image image );
 
   /**
    * @deprecated Sets the selected image with an Actor.
-   * @param[in] image The Actor to use.
-   */
-  void SetSelectedImage( Actor image );
-
-  /**
-   * @deprecated Sets the selected background image with an Actor.
-   * @param[in] image The Actor to use.
-   */
-  void SetSelectedBackgroundImage( Actor image );
-
-  /**
-   * @deprecated Sets the disabled image with an Actor.
-   * @param[in] image The Actor to use.
-   */
-  void SetDisabledImage( Actor image );
-
-  /**
-   * @deprecated Sets the disabled selected image with an Actor.
-   * @param[in] image The Actor to use.
+   * @param[in] image The Image to use.
    */
-  void SetDisabledSelectedImage( Actor image );
-
-  /**
-   * @deprecated Sets the disabled background image with an Actor.
-   * @param[in] image The Actor to use.
-   */
-  void SetDisabledBackgroundImage( Actor image );
+  void SetSelectedImage( Image image );
 
   /**
    * @Gets url of a image visual, used by GetProperty but for deprecated Properties
    * @param[in] index Visual index of url required
    * @return filename for the corresponding visual
    */
-  std::string GetUrlForImageVisual( Property::Index index );
-
+  std::string GetUrlForImageVisual( const Property::Index index ) const;
 
   /**
    * @copydoc Dali::Toolkit::Button::GetButtonImage
@@ -547,13 +519,6 @@ private:
   bool ValidateState( State requestedState );
 
   /**
-   * Perform the given function on the visuals in the given state. Can be used to add and remove visuals.
-   * @param[in] functionPtr pointer to the function to perform an action on a visual
-   * @param[in] state Visuals in this state will be the target
-   */
-  void PerformFunctionOnVisualsInState( void(Button::*functionPtr)( Property::Index visualIndex), State state  );
-
-  /**
    * Changes the button state when an action occurs on it
    * @param[in] requestedState the state to change to
    */
@@ -616,9 +581,16 @@ protected:
    * @param[in] value the value to set on the component
    * @param[in] visualDepth the depth of the visual if overlapping another
    */
-  void CreateVisualsForComponent( Property::Index index ,const Property::Value& value, const float visualDepth );
+  void CreateVisualsForComponent( Property::Index index, const Property::Value& value, const int visualDepth );
 
   /**
+   * @brief Get the Property map for the given Visual
+   * @param[in] visualIndex visual index of the required visual
+   * @param[out] retreivedMap the property map used to construct the required visual
+   * @return bool success flag, true if visual found
+   */
+  bool GetPropertyMapForVisual( Property::Index visualIndex, Property::Map& retreivedMap ) const;
+  /**
    * Returns the animation to be used for transition, creating the animation if needed.
    * @return The initialised transition animation.
    */
@@ -688,6 +660,8 @@ private:
 
   bool             mAutoRepeating;              ///< Stores the autorepeating property.
   bool             mTogglableButton;            ///< Stores the togglable property as a flag.
+  bool             mTextStringSetFlag;          ///< Stores if text has been set. Required in relayout but don't want to calculate there.
+
   float            mInitialAutoRepeatingDelay;  ///< Stores the initial autorepeating delay in seconds.
   float            mNextAutoRepeatingDelay;     ///< Stores the next autorepeating delay in seconds.
 
@@ -699,6 +673,11 @@ private:
 
   // Actions
   bool             mClickActionPerforming;      ///< Used to manage signal emissions during action
+
+  // Deprecated API support
+  Image            mSetButtonImage;             ///< Store set image if deprecated SetButtonImage used.
+  Image            mSetSelectedImage;           ///< Store set image if deprecated SetSelectedImage used.
+
 };
 
 } // namespace Internal