Property system fixes 73/36373/10
authorPaul Wisbey <p.wisbey@samsung.com>
Thu, 5 Mar 2015 12:57:05 +0000 (12:57 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Fri, 6 Mar 2015 13:30:51 +0000 (13:30 +0000)
Change-Id: I18cb303acbe1e96b60c987336c0aa9ed857a3ea3

dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/public-api/controls/text-controls/text-field.cpp
dali-toolkit/public-api/controls/text-controls/text-field.h
dali-toolkit/public-api/controls/text-controls/text-label.cpp
dali-toolkit/public-api/controls/text-controls/text-label.h

index 55d1823..224530b 100644 (file)
@@ -44,18 +44,6 @@ namespace Dali
 namespace Toolkit
 {
 
 namespace Toolkit
 {
 
-const Property::Index TextField::PROPERTY_RENDERING_BACKEND(       Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX );
-const Property::Index TextField::PROPERTY_PLACEHOLDER_TEXT(        Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 1 );
-const Property::Index TextField::PROPERTY_TEXT(                    Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 2 );
-const Property::Index TextField::PROPERTY_CURSOR_IMAGE(            Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 3 );
-const Property::Index TextField::PROPERTY_PRIMARY_CURSOR_COLOR(    Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 4 );
-const Property::Index TextField::PROPERTY_SECONDARY_CURSOR_COLOR(  Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 5 );
-const Property::Index TextField::PROPERTY_ENABLE_CURSOR_BLINK(     Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 6 );
-const Property::Index TextField::PROPERTY_CURSOR_BLINK_INTERVAL(   Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 7 );
-const Property::Index TextField::PROPERTY_CURSOR_BLINK_DURATION(   Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 8 );
-const Property::Index TextField::PROPERTY_GRAB_HANDLE_IMAGE(       Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 9 );
-const Property::Index TextField::PROPERTY_DECORATION_BOUNDING_BOX( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 10 );
-
 namespace Internal
 {
 
 namespace Internal
 {
 
@@ -70,17 +58,26 @@ BaseHandle Create()
 
 TypeRegistration mType( typeid(Toolkit::TextField), typeid(Toolkit::Control), Create );
 
 
 TypeRegistration mType( typeid(Toolkit::TextField), typeid(Toolkit::Control), Create );
 
-PropertyRegistration property01( mType, "rendering-backend",       Toolkit::TextField::PROPERTY_RENDERING_BACKEND,       Property::INTEGER,          &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property02( mType, "placeholder-text",        Toolkit::TextField::PROPERTY_PLACEHOLDER_TEXT,        Property::STRING,           &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property03( mType, "text",                    Toolkit::TextField::PROPERTY_TEXT,                    Property::STRING,           &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property04( mType, "cursor-image",            Toolkit::TextField::PROPERTY_CURSOR_IMAGE,            Property::STRING,           &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property05( mType, "primary-cursor-color",    Toolkit::TextField::PROPERTY_PRIMARY_CURSOR_COLOR,    Property::VECTOR4,          &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property06( mType, "secondary-cursor-color",  Toolkit::TextField::PROPERTY_SECONDARY_CURSOR_COLOR,  Property::VECTOR4,          &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property07( mType, "enable-cursor-blink",     Toolkit::TextField::PROPERTY_ENABLE_CURSOR_BLINK,     Property::BOOLEAN,          &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property08( mType, "cursor-blink-interval",   Toolkit::TextField::PROPERTY_CURSOR_BLINK_INTERVAL,   Property::FLOAT,            &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property09( mType, "cursor-blink-duration",   Toolkit::TextField::PROPERTY_CURSOR_BLINK_DURATION,   Property::FLOAT,            &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property10( mType, "grab-handle-image",       Toolkit::TextField::PROPERTY_GRAB_HANDLE_IMAGE,       Property::STRING,           &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property11( mType, "decoration bounding-box", Toolkit::TextField::PROPERTY_DECORATION_BOUNDING_BOX, Property::RECTANGLE,        &TextField::SetProperty, &TextField::GetProperty );
+// Setup properties, signals and actions using the type-registry.
+DALI_TYPE_REGISTRATION_BEGIN( Toolkit::TextField, Toolkit::Control, Create );
+
+DALI_PROPERTY_REGISTRATION( TextField, "rendering-backend",       INT,       RENDERING_BACKEND       )
+DALI_PROPERTY_REGISTRATION( TextField, "placeholder-text",        STRING,    PLACEHOLDER_TEXT        )
+DALI_PROPERTY_REGISTRATION( TextField, "text",                    STRING,    TEXT                    )
+DALI_PROPERTY_REGISTRATION( TextField, "font-family",             STRING,    FONT_FAMILY             )
+DALI_PROPERTY_REGISTRATION( TextField, "font-style",              STRING,    FONT_STYLE              )
+DALI_PROPERTY_REGISTRATION( TextField, "point-size",              FLOAT,     POINT_SIZE              )
+DALI_PROPERTY_REGISTRATION( TextField, "cursor-image",            STRING,    CURSOR_IMAGE            )
+DALI_PROPERTY_REGISTRATION( TextField, "primary-cursor-color",    VECTOR4,   PRIMARY_CURSOR_COLOR    )
+DALI_PROPERTY_REGISTRATION( TextField, "secondary-cursor-color",  VECTOR4,   SECONDARY_CURSOR_COLOR  )
+DALI_PROPERTY_REGISTRATION( TextField, "enable-cursor-blink",     BOOLEAN,   ENABLE_CURSOR_BLINK     )
+DALI_PROPERTY_REGISTRATION( TextField, "cursor-blink-interval",   FLOAT,     CURSOR_BLINK_INTERVAL   )
+DALI_PROPERTY_REGISTRATION( TextField, "cursor-blink-duration",   FLOAT,     CURSOR_BLINK_DURATION   )
+DALI_PROPERTY_REGISTRATION( TextField, "grab-handle-image",       STRING,    GRAB_HANDLE_IMAGE       )
+DALI_PROPERTY_REGISTRATION( TextField, "decoration bounding-box", RECTANGLE, DECORATION_BOUNDING_BOX )
+
+DALI_TYPE_REGISTRATION_END()
+
 } // namespace
 
 Toolkit::TextField TextField::New()
 } // namespace
 
 Toolkit::TextField TextField::New()
index 2bdacc4..8b1cb70 100644 (file)
@@ -42,10 +42,6 @@ namespace Dali
 namespace Toolkit
 {
 
 namespace Toolkit
 {
 
-const Property::Index TextLabel::PROPERTY_RENDERING_BACKEND( Internal::TextLabel::TEXTLABEL_PROPERTY_START_INDEX );
-const Property::Index TextLabel::PROPERTY_TEXT(              Internal::TextLabel::TEXTLABEL_PROPERTY_START_INDEX + 1 );
-const Property::Index TextLabel::PROPERTY_MULTI_LINE(        Internal::TextLabel::TEXTLABEL_PROPERTY_START_INDEX + 2 );
-
 namespace Internal
 {
 
 namespace Internal
 {
 
@@ -58,11 +54,17 @@ BaseHandle Create()
   return Toolkit::TextLabel::New();
 }
 
   return Toolkit::TextLabel::New();
 }
 
-TypeRegistration mType( typeid(Toolkit::TextLabel), typeid(Toolkit::Control), Create );
+// Setup properties, signals and actions using the type-registry.
+DALI_TYPE_REGISTRATION_BEGIN( Toolkit::TextLabel, Toolkit::Control, Create );
+
+DALI_PROPERTY_REGISTRATION( TextLabel, "rendering-backend", INT,     RENDERING_BACKEND )
+DALI_PROPERTY_REGISTRATION( TextLabel, "text",              STRING,  TEXT              )
+DALI_PROPERTY_REGISTRATION( TextLabel, "font-family",       STRING,  FONT_FAMILY       )
+DALI_PROPERTY_REGISTRATION( TextLabel, "font-style",        STRING,  FONT_STYLE        )
+DALI_PROPERTY_REGISTRATION( TextLabel, "point-size",        FLOAT,   POINT_SIZE        )
+DALI_PROPERTY_REGISTRATION( TextLabel, "multi-line",        BOOLEAN, MULTI_LINE        )
 
 
-PropertyRegistration property1( mType, "rendering-backend", Toolkit::TextLabel::PROPERTY_RENDERING_BACKEND, Property::INTEGER,          &TextLabel::SetProperty, &TextLabel::GetProperty );
-PropertyRegistration property2( mType, "text",              Toolkit::TextLabel::PROPERTY_TEXT,              Property::STRING,           &TextLabel::SetProperty, &TextLabel::GetProperty );
-PropertyRegistration property3( mType, "multi-line",        Toolkit::TextLabel::PROPERTY_MULTI_LINE,        Property::STRING,           &TextLabel::SetProperty, &TextLabel::GetProperty );
+DALI_TYPE_REGISTRATION_END()
 
 } // namespace
 
 
 } // namespace
 
@@ -107,6 +109,49 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr
         if( impl.mController )
         {
           impl.mController->SetText( value.Get< std::string >() );
         if( impl.mController )
         {
           impl.mController->SetText( value.Get< std::string >() );
+          impl.RequestTextRelayout();
+        }
+        break;
+      }
+      case Toolkit::TextLabel::PROPERTY_FONT_FAMILY:
+      {
+        if( impl.mController )
+        {
+          std::string fontFamily = value.Get< std::string >();
+
+          if( impl.mController->GetDefaultFontFamily() != fontFamily )
+          {
+            impl.mController->SetDefaultFontFamily( fontFamily );
+            impl.RequestTextRelayout();
+          }
+        }
+        break;
+      }
+      case Toolkit::TextLabel::PROPERTY_FONT_STYLE:
+      {
+        if( impl.mController )
+        {
+          std::string fontStyle = value.Get< std::string >();
+
+          if( impl.mController->GetDefaultFontStyle() != fontStyle )
+          {
+            impl.mController->SetDefaultFontStyle( fontStyle );
+            impl.RequestTextRelayout();
+          }
+        }
+        break;
+      }
+      case Toolkit::TextLabel::PROPERTY_POINT_SIZE:
+      {
+        if( impl.mController )
+        {
+          float pointSize = value.Get< float >();
+
+          if( impl.mController->GetDefaultPointSize() != pointSize /*TODO - epsilon*/ )
+          {
+            impl.mController->SetDefaultPointSize( pointSize );
+            impl.RequestTextRelayout();
+          }
         }
         break;
       }
         }
         break;
       }
@@ -114,9 +159,14 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr
       {
         if( impl.mController )
         {
       {
         if( impl.mController )
         {
+          LayoutEngine& engine = impl.mController->GetLayoutEngine();
           LayoutEngine::Layout layout = value.Get< bool >() ? LayoutEngine::MULTI_LINE_BOX : LayoutEngine::SINGLE_LINE_BOX;
           LayoutEngine::Layout layout = value.Get< bool >() ? LayoutEngine::MULTI_LINE_BOX : LayoutEngine::SINGLE_LINE_BOX;
-          impl.mController->GetLayoutEngine().SetLayout( layout );
-          impl.RequestTextRelayout();
+
+          if( engine.GetLayout() != layout )
+          {
+            impl.mController->GetLayoutEngine().SetLayout( layout );
+            impl.RequestTextRelayout();
+          }
         }
         break;
       }
         }
         break;
       }
@@ -140,7 +190,6 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde
         value = impl.mRenderingBackend;
         break;
       }
         value = impl.mRenderingBackend;
         break;
       }
-
       case Toolkit::TextLabel::PROPERTY_TEXT:
       {
         if( impl.mController )
       case Toolkit::TextLabel::PROPERTY_TEXT:
       {
         if( impl.mController )
@@ -153,7 +202,6 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde
         DALI_LOG_WARNING( "UTF-8 text representation was discarded\n" );
         break;
       }
         DALI_LOG_WARNING( "UTF-8 text representation was discarded\n" );
         break;
       }
-
       case Toolkit::TextLabel::PROPERTY_MULTI_LINE:
       {
         if( impl.mController )
       case Toolkit::TextLabel::PROPERTY_MULTI_LINE:
       {
         if( impl.mController )
index 995354c..dba8386 100644 (file)
@@ -245,6 +245,31 @@ struct Controller::TextInput
   bool mDecoratorUpdated;
 };
 
   bool mDecoratorUpdated;
 };
 
+struct Controller::FontDefaults
+{
+  FontDefaults()
+  : mDefaultPointSize(0.0f),
+    mFontId(0u)
+  {
+  }
+
+  FontId GetFontId( TextAbstraction::FontClient& fontClient )
+  {
+    if( !mFontId )
+    {
+      Dali::TextAbstraction::PointSize26Dot6 pointSize = mDefaultPointSize*64;
+      mFontId = fontClient.GetFontId( mDefaultFontFamily, mDefaultFontStyle, pointSize );
+    }
+
+    return mFontId;
+  }
+
+  std::string mDefaultFontFamily;
+  std::string mDefaultFontStyle;
+  float mDefaultPointSize;
+  FontId mFontId;
+};
+
 struct Controller::Impl
 {
   Impl( ControlInterface& controlInterface )
 struct Controller::Impl
 {
   Impl( ControlInterface& controlInterface )
@@ -252,6 +277,7 @@ struct Controller::Impl
     mNewText(),
     mOperations( NO_OPERATION ),
     mControlSize(),
     mNewText(),
     mOperations( NO_OPERATION ),
     mControlSize(),
+    mFontDefaults( NULL ),
     mTextInput( NULL )
   {
     mLogicalModel = LogicalModel::New();
     mTextInput( NULL )
   {
     mLogicalModel = LogicalModel::New();
@@ -284,6 +310,9 @@ struct Controller::Impl
 
   Size mControlSize;
 
 
   Size mControlSize;
 
+  // Avoid allocating this when the user does not specify a font
+  FontDefaults* mFontDefaults;
+
   // Avoid allocating everything for text input until EnableTextInput()
   Controller::TextInput* mTextInput;
 };
   // Avoid allocating everything for text input until EnableTextInput()
   Controller::TextInput* mTextInput;
 };
@@ -308,7 +337,7 @@ void Controller::SetText( const std::string& text )
   }
 }
 
   }
 }
 
-void Controller::GetText( std::string& text )
+void Controller::GetText( std::string& text ) const
 {
   if( !mImpl->mNewText.empty() )
   {
 {
   if( !mImpl->mNewText.empty() )
   {
@@ -320,6 +349,72 @@ void Controller::GetText( std::string& text )
   }
 }
 
   }
 }
 
+void Controller::SetDefaultFontFamily( const std::string& defaultFontFamily )
+{
+  if( !mImpl->mFontDefaults )
+  {
+    mImpl->mFontDefaults = new Controller::FontDefaults();
+  }
+
+  mImpl->mFontDefaults->mDefaultFontFamily = defaultFontFamily;
+  mImpl->mFontDefaults->mFontId = 0u; // Remove old font ID
+  mImpl->mOperations = ALL_OPERATIONS;
+}
+
+const std::string& Controller::GetDefaultFontFamily() const
+{
+  if( mImpl->mFontDefaults )
+  {
+    return mImpl->mFontDefaults->mDefaultFontFamily;
+  }
+
+  return Dali::String::EMPTY;
+}
+
+void Controller::SetDefaultFontStyle( const std::string& defaultFontStyle )
+{
+  if( !mImpl->mFontDefaults )
+  {
+    mImpl->mFontDefaults = new Controller::FontDefaults();
+  }
+
+  mImpl->mFontDefaults->mDefaultFontStyle = defaultFontStyle;
+  mImpl->mFontDefaults->mFontId = 0u; // Remove old font ID
+  mImpl->mOperations = ALL_OPERATIONS;
+}
+
+const std::string& Controller::GetDefaultFontStyle() const
+{
+  if( mImpl->mFontDefaults )
+  {
+    return mImpl->mFontDefaults->mDefaultFontStyle;
+  }
+
+  return Dali::String::EMPTY;
+}
+
+void Controller::SetDefaultPointSize( float pointSize )
+{
+  if( !mImpl->mFontDefaults )
+  {
+    mImpl->mFontDefaults = new Controller::FontDefaults();
+  }
+
+  mImpl->mFontDefaults->mDefaultPointSize = pointSize;
+  mImpl->mFontDefaults->mFontId = 0u; // Remove old font ID
+  mImpl->mOperations = ALL_OPERATIONS;
+}
+
+float Controller::GetDefaultPointSize() const
+{
+  if( mImpl->mFontDefaults )
+  {
+    return mImpl->mFontDefaults->mDefaultPointSize;
+  }
+
+  return 0.0f;
+}
+
 void Controller::EnableTextInput( DecoratorPtr decorator )
 {
   if( !mImpl->mTextInput )
 void Controller::EnableTextInput( DecoratorPtr decorator )
 {
   if( !mImpl->mTextInput )
@@ -417,6 +512,12 @@ bool Controller::DoRelayout( const Vector2& size, OperationsMask operations )
 
   Vector<ScriptRun> scripts;
   Vector<FontRun> fonts;
 
   Vector<ScriptRun> scripts;
   Vector<FontRun> fonts;
+
+  if( mImpl->mFontDefaults )
+  {
+    // TODO - pass into ValidateFonts
+  }
+
   if( getScripts || validateFonts )
   {
     // Validates the fonts assigned by the application or assigns default ones.
   if( getScripts || validateFonts )
   {
     // Validates the fonts assigned by the application or assigns default ones.
index 3fe4439..3fa7c60 100644 (file)
@@ -103,7 +103,49 @@ public:
    *
    * @return A string of UTF-8 characters.
    */
    *
    * @return A string of UTF-8 characters.
    */
-  void GetText( std::string& text );
+  void GetText( std::string& text ) const;
+
+  /**
+   * @brief Set the default font family.
+   *
+   * @param[in] defaultFontFamily The default font family.
+   */
+  void SetDefaultFontFamily( const std::string& defaultFontFamily );
+
+  /**
+   * @brief Retrieve the default font family.
+   *
+   * @return The default font family.
+   */
+   const std::string& GetDefaultFontFamily() const;
+
+  /**
+   * @brief Set the default font style.
+   *
+   * @param[in] defaultFontStyle The default font style.
+   */
+  void SetDefaultFontStyle( const std::string& defaultFontStyle );
+
+  /**
+   * @brief Retrieve the default font style.
+   *
+   * @return The default font style.
+   */
+   const std::string& GetDefaultFontStyle() const;
+
+  /**
+   * @brief Set the default point size.
+   *
+   * @param[in] defaultFontStyle The default point size.
+   */
+  void SetDefaultPointSize( float pointSize );
+
+  /**
+   * @brief Retrieve the default point size.
+   *
+   * @return The default point size.
+   */
+   float GetDefaultPointSize() const;
 
   /**
    * @brief Called to enable text input.
 
   /**
    * @brief Called to enable text input.
@@ -209,6 +251,9 @@ private:
   struct Impl;
   Impl* mImpl;
 
   struct Impl;
   Impl* mImpl;
 
+  // Avoid allocating this when the user does not specify a font
+  struct FontDefaults;
+
   // Avoid allocating this for non-editable controls
   struct TextInput;
 };
   // Avoid allocating this for non-editable controls
   struct TextInput;
 };
index 397f6a5..7935752 100644 (file)
@@ -27,18 +27,6 @@ namespace Dali
 namespace Toolkit
 {
 
 namespace Toolkit
 {
 
-const std::string TextField::RENDERING_BACKEND_PROPERTY_NAME("rendering-backend");
-const std::string TextField::PLACEHOLDER_TEXT_PROPERTY_NAME("placeholder-text");
-const std::string TextField::TEXT_PROPERTY_NAME("text");
-const std::string TextField::CURSOR_IMAGE_PROPERTY_NAME("cursor-image");
-const std::string TextField::PRIMARY_CURSOR_COLOR_PROPERTY_NAME("primary-cursor-color");
-const std::string TextField::SECONDARY_CURSOR_COLOR_PROPERTY_NAME("secondary-cursor-color");
-const std::string TextField::ENABLE_CURSOR_BLINK_PROPERTY_NAME("enable-cursor-blink");
-const std::string TextField::CURSOR_BLINK_INTERVAL_PROPERTY_NAME("cursor-blink-interval");
-const std::string TextField::CURSOR_BLINK_DURATION_PROPERTY_NAME("cursor-blink-duration");
-const std::string TextField::GRAB_HANDLE_IMAGE_PROPERTY_NAME("grab-handle-image");
-const std::string TextField::DECORATION_BOUNDING_BOX("decoration-bounding-box");
-
 TextField TextField::New()
 {
   return Internal::TextField::New();
 TextField TextField::New()
 {
   return Internal::TextField::New();
index cc2166e..be8779b 100644 (file)
@@ -39,31 +39,38 @@ class DALI_IMPORT_API TextField : public Control
 {
 public:
 
 {
 public:
 
-  // Property indices
-  static const Dali::Property::Index PROPERTY_RENDERING_BACKEND;       ///< name "rendering-backend",       type INT
-  static const Dali::Property::Index PROPERTY_PLACEHOLDER_TEXT;        ///< name "placeholder-text",        type STRING
-  static const Dali::Property::Index PROPERTY_TEXT;                    ///< name "text",                    type STRING
-  static const Dali::Property::Index PROPERTY_CURSOR_IMAGE;            ///< name "cursor-image",            type STRING
-  static const Dali::Property::Index PROPERTY_PRIMARY_CURSOR_COLOR;    ///< name "primary-cursor-color",    type VECTOR4
-  static const Dali::Property::Index PROPERTY_SECONDARY_CURSOR_COLOR;  ///< name "secondary-cursor-color",  type VECTOR4
-  static const Dali::Property::Index PROPERTY_ENABLE_CURSOR_BLINK;     ///< name "enable-cursor-blink",     type BOOLEAN
-  static const Dali::Property::Index PROPERTY_CURSOR_BLINK_INTERVAL;   ///< name "cursor-blink-interval",   type FLOAT
-  static const Dali::Property::Index PROPERTY_CURSOR_BLINK_DURATION;   ///< name "cursor-blink-duration",   type FLOAT
-  static const Dali::Property::Index PROPERTY_GRAB_HANDLE_IMAGE;       ///< name "grab-handle-image",       type STRING
-  static const Dali::Property::Index PROPERTY_DECORATION_BOUNDING_BOX; ///< name "decoration-bounding-box", type RECTANGLE
-
-  // Property names
-  static const std::string RENDERING_BACKEND_PROPERTY_NAME;      ///< Property, name "rendering-backend",       type INT
-  static const std::string PLACEHOLDER_TEXT_PROPERTY_NAME;       ///< Property, name "placeholder-text",        type STRING
-  static const std::string TEXT_PROPERTY_NAME;                   ///< Property, name "text",                    type STRING
-  static const std::string CURSOR_IMAGE_PROPERTY_NAME;           ///< Property, name "cursor-image",            type STRING
-  static const std::string PRIMARY_CURSOR_COLOR_PROPERTY_NAME;   ///< Property, name "primary-cursor-color",    type VECTOR4
-  static const std::string SECONDARY_CURSOR_COLOR_PROPERTY_NAME; ///< Property, name "secondary-cursor-color",  type VECTOR4
-  static const std::string ENABLE_CURSOR_BLINK_PROPERTY_NAME;    ///< Property, name "enable-cursor-blink",     type BOOLEAN
-  static const std::string CURSOR_BLINK_INTERVAL_PROPERTY_NAME;  ///< Property, name "cursor-blink-interval",   type FLOAT
-  static const std::string CURSOR_BLINK_DURATION_PROPERTY_NAME;  ///< Property, name "cursor-blink-duration",   type FLOAT
-  static const std::string GRAB_HANDLE_IMAGE_PROPERTY_NAME;      ///< Property, name "grab-handle-image",       type STRING
-  static const std::string DECORATION_BOUNDING_BOX;              ///< Property, name "decoration-bounding-box", type RECTANGLE
+  /**
+   * @brief The start and end property ranges for this control.
+   */
+  enum PropertyRange
+  {
+    PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
+    PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property indices
+  };
+
+  /**
+   * @brief An enumeration of properties belonging to the TextLabel class.
+   */
+  struct Property
+  {
+    enum
+    {
+      PROPERTY_RENDERING_BACKEND = PROPERTY_START_INDEX, ///< name "rendering-backend",       The type or rendering e.g. bitmap-based,                                  type INT
+      PROPERTY_PLACEHOLDER_TEXT,                         ///< name "placeholder-text",        The text to display when the TextField is empty,                          type STRING
+      PROPERTY_TEXT,                                     ///< name "text",                    The text to display in UTF-8 format,                                      type STRING
+      PROPERTY_FONT_FAMILY,                              ///< name "font-family",             The requested font family,                                                type STRING
+      PROPERTY_FONT_STYLE,                               ///< name "font-style",              The requested font style e.g. Regular/Italic,                             type STRING
+      PROPERTY_POINT_SIZE,                               ///< name "point-size",              The size of font in points,                                               type FLOAT
+      PROPERTY_CURSOR_IMAGE,                             ///< name "cursor-image",            The image to display for cursors,                                         type STRING
+      PROPERTY_PRIMARY_CURSOR_COLOR,                     ///< name "primary-cursor-color",    The color to apply to the primary cursor,                                 type VECTOR4
+      PROPERTY_SECONDARY_CURSOR_COLOR,                   ///< name "secondary-cursor-color",  The color to apply to the secondary cursor,                               type VECTOR4
+      PROPERTY_ENABLE_CURSOR_BLINK,                      ///< name "enable-cursor-blink",     Whether the cursor should blink or not,                                   type BOOLEAN
+      PROPERTY_CURSOR_BLINK_INTERVAL,                    ///< name "cursor-blink-interval",   The time interval between cursor on/off states,                           type FLOAT
+      PROPERTY_CURSOR_BLINK_DURATION,                    ///< name "cursor-blink-duration",   The cursor will stop blinking after this duration (if non-zero),          type FLOAT
+      PROPERTY_GRAB_HANDLE_IMAGE,                        ///< name "grab-handle-image",       The image to display for grab handle,                                     type STRING
+      PROPERTY_DECORATION_BOUNDING_BOX                   ///< name "decoration-bounding-box", The decorations (handles etc) will positioned within this area on-screen, type RECTANGLE
+    };
+  };
 
   /**
    * Create the TextField control.
 
   /**
    * Create the TextField control.
index e647d8a..97e8485 100644 (file)
@@ -27,10 +27,6 @@ namespace Dali
 namespace Toolkit
 {
 
 namespace Toolkit
 {
 
-const std::string TextLabel::RENDERING_BACKEND_PROPERTY_NAME("rendering-backend");
-const std::string TextLabel::TEXT_PROPERTY_NAME("text");
-const std::string TextLabel::MULTI_LINE_PROPERTY_NAME("multi-line");
-
 TextLabel TextLabel::New()
 {
   return Internal::TextLabel::New();
 TextLabel TextLabel::New()
 {
   return Internal::TextLabel::New();
index a1c3716..cc3cf24 100644 (file)
@@ -41,15 +41,30 @@ class DALI_IMPORT_API TextLabel : public Control
 {
 public:
 
 {
 public:
 
-  // Property indices
-  static const Dali::Property::Index PROPERTY_RENDERING_BACKEND; ///< name "rendering-backend", type INT
-  static const Dali::Property::Index PROPERTY_TEXT;              ///< name "text", type STRING
-  static const Dali::Property::Index PROPERTY_MULTI_LINE;        ///< name "multi-line", type BOOLEAN
-
-  // Property names
-  static const std::string RENDERING_BACKEND_PROPERTY_NAME; ///< Property, name "rendering-backend", type INT
-  static const std::string TEXT_PROPERTY_NAME;              ///< Property, name "text", type STRING
-  static const std::string MULTI_LINE_PROPERTY_NAME;        ///< Property, name "multi-line", type BOOLEAN
+  /**
+   * @brief The start and end property ranges for this control.
+   */
+  enum PropertyRange
+  {
+    PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
+    PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property indices
+  };
+
+  /**
+   * @brief An enumeration of properties belonging to the TextLabel class.
+   */
+  struct Property
+  {
+    enum
+    {
+      PROPERTY_RENDERING_BACKEND = PROPERTY_START_INDEX, ///< name "rendering-backend", The type or rendering e.g. bitmap-based,      type INT
+      PROPERTY_TEXT,                                     ///< name "text",              The text to display in UTF-8 format,          type STRING
+      PROPERTY_FONT_FAMILY,                              ///< name "font-family",       The requested font family,                    type STRING
+      PROPERTY_FONT_STYLE,                               ///< name "font-style",        The requested font style e.g. Regular/Italic, type STRING
+      PROPERTY_POINT_SIZE,                               ///< name "point-size",        The size of font in points,                   type FLOAT
+      PROPERTY_MULTI_LINE,                               ///< name "multi-line",        The single-line or multi-line layout option,  type BOOLEAN
+    };
+  };
 
   /**
    * Create the TextLabel control.
 
   /**
    * Create the TextLabel control.