Framework for Font styles
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-controls / text-label-impl.cpp
index 2de2c57..00ae80d 100644 (file)
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/rendering-backend.h>
 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
 #include <dali-toolkit/internal/text/rendering/text-backend.h>
+#include <dali-toolkit/internal/styling/style-manager-impl.h>
 
 using Dali::Toolkit::Text::LayoutEngine;
 using Dali::Toolkit::Text::Backend;
 
-namespace
-{
-
-const unsigned int DEFAULT_RENDERING_BACKEND = 0;
-
-} // namespace
-
 namespace Dali
 {
 
@@ -48,6 +43,11 @@ namespace Internal
 
 namespace
 {
+  const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
+}
+
+namespace
+{
 
 // Type registration
 BaseHandle Create()
@@ -95,11 +95,11 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr
     {
       case Toolkit::TextLabel::Property::RENDERING_BACKEND:
       {
-        unsigned int backend = value.Get< int >();
+        int backend = value.Get< int >();
 
         if( impl.mRenderingBackend != backend )
         {
-          impl.mRenderingBackend = static_cast< unsigned int >( backend );
+          impl.mRenderingBackend = backend;
           impl.mRenderer.Reset();
           impl.RequestTextRelayout();
         }
@@ -220,6 +220,11 @@ void TextLabel::OnInitialize()
   mController = Text::Controller::New( *this );
 }
 
+void TextLabel::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
+{
+  GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
+}
+
 Vector3 TextLabel::GetNaturalSize()
 {
   return mController->GetNaturalSize();
@@ -266,7 +271,7 @@ void TextLabel::RequestTextRelayout()
 }
 
 TextLabel::TextLabel()
-: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
   mRenderingBackend( DEFAULT_RENDERING_BACKEND )
 {
 }