Basic support for style names
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / control.h
index 01c1c75..6e88177 100644 (file)
@@ -65,16 +65,33 @@ class DALI_IMPORT_API Control : public CustomActor
 {
 public:
 
-  /// @name Properties
-  /** @{ */
-  static const Property::Index PROPERTY_BACKGROUND_COLOR;    ///< name "background-color",        @see SetBackgroundColor,        type VECTOR4
-  static const Property::Index PROPERTY_BACKGROUND;          ///< name "background",              @see SetBackground,             type MAP
-  static const Property::Index PROPERTY_WIDTH_POLICY;        ///< name "width-policy",            @see SetSizePolicy,             type STRING
-  static const Property::Index PROPERTY_HEIGHT_POLICY;       ///< name "height-policy",           @see SetSizePolicy,             type STRING
-  static const Property::Index PROPERTY_MINIMUM_SIZE;        ///< name "minimum-size",            @see SetMinimumSize,            type VECTOR3
-  static const Property::Index PROPERTY_MAXIMUM_SIZE;        ///< name "maximum-size",            @see SetMaximumSize,            type VECTOR3
-  static const Property::Index PROPERTY_KEY_INPUT_FOCUS;     ///< name "key-input-focus",         @see SetKeyInputFocus,          type BOOLEAN
-  /** @} */
+  /**
+   * @brief The start and end property ranges for control.
+   */
+  enum PropertyRange
+  {
+    PROPERTY_START_INDEX = PROPERTY_REGISTRATION_START_INDEX,        ///< Start index is used by the property registration macro.
+    CONTROL_PROPERTY_START_INDEX = PROPERTY_START_INDEX,             ///< Start index of Control properties.
+    CONTROL_PROPERTY_END_INDEX = CONTROL_PROPERTY_START_INDEX + 1000 ///< Reserving 1000 property indices.
+  };
+
+  /**
+   * @brief An enumeration of properties belonging to the Control class.
+   */
+  struct Property
+  {
+    enum
+    {
+      STYLE_NAME = PROPERTY_START_INDEX,       ///< name "style-name",       @see SetStyleName,       type std::string
+      BACKGROUND_COLOR,                        ///< name "background-color", @see SetBackgroundColor, type Vector4
+      BACKGROUND,                              ///< name "background",       @see SetBackground,      type Map
+      WIDTH_POLICY,                            ///< name "width-policy",     @see SetSizePolicy,      type std::string
+      HEIGHT_POLICY,                           ///< name "height-policy",    @see SetSizePolicy,      type std::string
+      MINIMUM_SIZE,                            ///< name "minimum-size",     @see SetMinimumSize,     type Vector3
+      MAXIMUM_SIZE,                            ///< name "maximum-size",     @see SetMaximumSize,     type Vector3
+      KEY_INPUT_FOCUS,                         ///< name "key-input-focus",  @see SetKeyInputFocus,   type bool
+    };
+  };
 
   /**
    * @brief Describes how a control could be resized.
@@ -328,6 +345,22 @@ public:
   // Background
 
   /**
+   * @brief Sets the name of the style to be applied to the control.
+   *
+   * @param[in] styleName A string matching a style described in a stylesheet.
+   */
+  void SetStyleName( const std::string& styleName );
+
+  /**
+   * @brief Retrieves the name of the style to be applied to the control (if any).
+   *
+   * @return A string matching a style or an empty string.
+   */
+  const std::string& GetStyleName() const;
+
+  // Background
+
+  /**
    * @brief Sets the background color of the control.
    *
    * @param[in] color The required background color of the control