#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/public-api/text/rendering-backend.h>
+#include <dali-toolkit/internal/styling/style-manager-impl.h>
using namespace Dali::Toolkit::Text;
}
}
+void TextField::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
+{
+ GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
+}
+
Vector3 TextField::GetNaturalSize()
{
return mController->GetNaturalSize();
}
TextField::TextField()
-: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mRenderingBackend( DEFAULT_RENDERING_BACKEND ),
mExceedPolicy( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP )
{
virtual void OnInitialize();
/**
+ * @copydoc Control::OnStyleChange()
+ */
+ virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change );
+
+ /**
* @copydoc Control::GetNaturalSize()
*/
virtual Vector3 GetNaturalSize();
#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/public-api/text/rendering-backend.h>
+#include <dali-toolkit/internal/styling/style-manager-impl.h>
using Dali::Toolkit::Text::LayoutEngine;
using Dali::Toolkit::Text::Backend;
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();
}
TextLabel::TextLabel()
-: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) ),
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mRenderingBackend( DEFAULT_RENDERING_BACKEND )
{
}
virtual void OnInitialize();
/**
- * @copydoc Control::OnInitialize()
+ * @copydoc Control::OnStyleChange()
+ */
+ virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change );
+
+ /**
+ * @copydoc Control::OnRelayout()
*/
virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
// Register for style changes
- styleManager.StyleChangeSignal().Connect( this, &Control::DoStyleChange );
+ styleManager.StyleChangeSignal().Connect( this, &Control::OnStyleChange );
// SetTheme
GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
{
}
-void Control::OnThemeChange( Toolkit::StyleManager styleManager )
-{
- GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
-}
-
-void Control::OnFontChange( bool defaultFontChange, bool defaultFontSizeChange )
+void Control::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
{
+ // By default the control is only interested in theme (not font) changes
+ if( change.themeChange )
+ {
+ GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
+ }
}
void Control::OnPinch(const PinchGesture& pinch)
mImpl->SignalDisconnected( slotObserver, callback );
}
-void Control::DoStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
-{
- if( change.themeChange )
- {
- OnThemeChange( styleManager );
- }
- else if( change.defaultFontChange || change.defaultFontSizeChange )
- {
- OnFontChange( change.defaultFontChange, change.defaultFontSizeChange );
- }
-}
-
} // namespace Internal
} // namespace Toolkit
virtual void OnActivated();
/**
- * @brief This method should be overridden by deriving classes when
- * they wish to be notified when the style manager changes the theme.
+ * @brief This method should be overridden by deriving classes requiring notifications when the style changes.
*
* @param[in] styleManager The StyleManager object.
+ * @param[in] change Information denoting what has changed.
*/
- virtual void OnThemeChange( Toolkit::StyleManager styleManager );
-
- /**
- * @brief This method should be overridden by deriving classes when
- * they wish to be notified when the style changes the default font.
- *
- * @param[in] defaultFontChange Information denoting whether the default font has changed.
- * @param[in] defaultFontSizeChange Information denoting whether the default font size has changed.
- */
- virtual void OnFontChange( bool defaultFontChange, bool defaultFontSizeChange );
+ virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change );
/**
* @brief Called whenever a pinch gesture is detected on this control.
*/
virtual void SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback );
- // Style
-
- /**
- * @brief This method is the callback for the StyleChangeSignal from StyleManager
- *
- * @param[in] styleManager The StyleManager Object
- * @param[in] change Information denoting what has changed.
- */
- DALI_INTERNAL void DoStyleChange( Toolkit::StyleManager styleManager, StyleChange change );
-
private:
// Undefined
{
"styles":
{
- "textinput":
+ "textlabel":
{
- "highlight-color":"F060",
- "cut-and-paste-bg-color":"B061L41",
- "cut-and-paste-pressed-color":"B061L41P",
- "cut-and-paste-border-color":"B061L42",
- "cut-and-paste-icon-color":"T126",
- "cut-and-paste-icon-pressed-color":"T126P",
- "cut-and-paste-text-color":"T1221",
- "cut-and-paste-text-pressed-color":"T1221P",
- "cut-button-position-priority":4,
- "copy-button-position-priority":3,
- "paste-button-position-priority":5,
- "select-button-position-priority":1,
- "select-all-button-position-priority":2,
- "clipboard-button-position-priority":6,
- "cursor-color":"F052"
+ "font-family":"TizenSansFallback",
+ "font-style":"Regular",
+ "point-size":10
+ },
+ "textfield":
+ {
+ "font-family":"TizenSansFallback",
+ "font-style":"Regular",
+ "point-size":10
},
"scrollview":
{