#include <dali/integration-api/events/tap-gesture-event.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/text-controls/text-editor.h> ///< @todo to be removed when text-editor is added to the dali-toolkit.h
using namespace Dali;
using namespace Toolkit;
const char* const PROPERTY_NAME_INPUT_FONT_STYLE = "inputFontStyle";
const char* const PROPERTY_NAME_INPUT_POINT_SIZE = "inputPointSize";
+const char* const PROPERTY_NAME_LINE_SPACING = "lineSpacing";
+const char* const PROPERTY_NAME_INPUT_LINE_SPACING = "inputLineSpacing";
+const char* const PROPERTY_NAME_UNDERLINE = "underline";
+const char* const PROPERTY_NAME_INPUT_UNDERLINE = "inputUnderline";
+const char* const PROPERTY_NAME_SHADOW = "shadow";
+const char* const PROPERTY_NAME_INPUT_SHADOW = "inputShadow";
+const char* const PROPERTY_NAME_EMBOSS = "emboss";
+const char* const PROPERTY_NAME_INPUT_EMBOSS = "inputEmboss";
+const char* const PROPERTY_NAME_OUTLINE = "outline";
+const char* const PROPERTY_NAME_INPUT_OUTLINE = "inputOutline";
+
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color.
TextEditor copy( textEditor );
DALI_TEST_CHECK( copy );
- DALI_TEST_CHECK( copy.GetProperty<std::string>( TextLabel::Property::TEXT ) == textEditor.GetProperty<std::string>( TextLabel::Property::TEXT ) );
+ DALI_TEST_CHECK( copy.GetProperty<std::string>( TextEditor::Property::TEXT ) == textEditor.GetProperty<std::string>( TextEditor::Property::TEXT ) );
END_TEST;
}
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_FONT_FAMILY ) == TextEditor::Property::INPUT_FONT_FAMILY );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_FONT_STYLE ) == TextEditor::Property::INPUT_FONT_STYLE );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_POINT_SIZE ) == TextEditor::Property::INPUT_POINT_SIZE );
+
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_LINE_SPACING ) == TextEditor::Property::LINE_SPACING );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_LINE_SPACING ) == TextEditor::Property::INPUT_LINE_SPACING );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_UNDERLINE ) == TextEditor::Property::UNDERLINE );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_UNDERLINE ) == TextEditor::Property::INPUT_UNDERLINE );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SHADOW ) == TextEditor::Property::SHADOW );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_SHADOW ) == TextEditor::Property::INPUT_SHADOW );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_EMBOSS ) == TextEditor::Property::EMBOSS );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_EMBOSS ) == TextEditor::Property::INPUT_EMBOSS );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextEditor::Property::OUTLINE );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_OUTLINE ) == TextEditor::Property::INPUT_OUTLINE );
+
END_TEST;
}
editor.SetProperty( TextEditor::Property::INPUT_POINT_SIZE, 12.f );
DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Check the line spacing property
+ DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ editor.SetProperty( TextEditor::Property::LINE_SPACING, 10.f );
+ DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Check the input line spacing property
+ DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ editor.SetProperty( TextEditor::Property::INPUT_LINE_SPACING, 20.f );
+ DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_LINE_SPACING ), 20.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Check the underline property
+ editor.SetProperty( TextEditor::Property::UNDERLINE, "Underline properties" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::UNDERLINE ), std::string("Underline properties"), TEST_LOCATION );
+
+ // Check the input underline property
+ editor.SetProperty( TextEditor::Property::INPUT_UNDERLINE, "Underline input properties" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_UNDERLINE ), std::string("Underline input properties"), TEST_LOCATION );
+
+ // Check the shadow property
+ editor.SetProperty( TextEditor::Property::SHADOW, "Shadow properties" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::SHADOW ), std::string("Shadow properties"), TEST_LOCATION );
+
+ // Check the input shadow property
+ editor.SetProperty( TextEditor::Property::INPUT_SHADOW, "Shadow input properties" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_SHADOW ), std::string("Shadow input properties"), TEST_LOCATION );
+
+ // Check the emboss property
+ editor.SetProperty( TextEditor::Property::EMBOSS, "Emboss properties" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
+
+ // Check the input emboss property
+ editor.SetProperty( TextEditor::Property::INPUT_EMBOSS, "Emboss input properties" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_EMBOSS ), std::string("Emboss input properties"), TEST_LOCATION );
+
+ // Check the outline property
+ editor.SetProperty( TextEditor::Property::OUTLINE, "Outline properties" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
+
+ // Check the input outline property
+ editor.SetProperty( TextEditor::Property::INPUT_OUTLINE, "Outline input properties" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_OUTLINE ), std::string("Outline input properties"), TEST_LOCATION );
+
END_TEST;
}
const char* const PROPERTY_NAME_INPUT_FONT_STYLE = "inputFontStyle";
const char* const PROPERTY_NAME_INPUT_POINT_SIZE = "inputPointSize";
+const char* const PROPERTY_NAME_UNDERLINE = "underline";
+const char* const PROPERTY_NAME_INPUT_UNDERLINE = "inputUnderline";
+const char* const PROPERTY_NAME_SHADOW = "shadow";
+const char* const PROPERTY_NAME_INPUT_SHADOW = "inputShadow";
+const char* const PROPERTY_NAME_EMBOSS = "emboss";
+const char* const PROPERTY_NAME_INPUT_EMBOSS = "inputEmboss";
+const char* const PROPERTY_NAME_OUTLINE = "outline";
+const char* const PROPERTY_NAME_INPUT_OUTLINE = "inputOutline";
+
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
const Vector4 PLACEHOLDER_TEXT_COLOR( 0.8f, 0.8f, 0.8f, 0.8f );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_FONT_FAMILY ) == TextField::Property::INPUT_FONT_FAMILY );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_FONT_STYLE ) == TextField::Property::INPUT_FONT_STYLE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_POINT_SIZE ) == TextField::Property::INPUT_POINT_SIZE );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_UNDERLINE ) == TextField::Property::UNDERLINE );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_UNDERLINE ) == TextField::Property::INPUT_UNDERLINE );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_SHADOW ) == TextField::Property::SHADOW );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_SHADOW ) == TextField::Property::INPUT_SHADOW );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_EMBOSS ) == TextField::Property::EMBOSS );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_EMBOSS ) == TextField::Property::INPUT_EMBOSS );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextField::Property::OUTLINE );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_OUTLINE ) == TextField::Property::INPUT_OUTLINE );
+
END_TEST;
}
field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 12.f );
DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Check the underline property
+ field.SetProperty( TextField::Property::UNDERLINE, "Underline properties" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::UNDERLINE ), std::string("Underline properties"), TEST_LOCATION );
+
+ // Check the input underline property
+ field.SetProperty( TextField::Property::INPUT_UNDERLINE, "Underline input properties" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_UNDERLINE ), std::string("Underline input properties"), TEST_LOCATION );
+
+ // Check the shadow property
+ field.SetProperty( TextField::Property::SHADOW, "Shadow properties" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::SHADOW ), std::string("Shadow properties"), TEST_LOCATION );
+
+ // Check the input shadow property
+ field.SetProperty( TextField::Property::INPUT_SHADOW, "Shadow input properties" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_SHADOW ), std::string("Shadow input properties"), TEST_LOCATION );
+
+ // Check the emboss property
+ field.SetProperty( TextField::Property::EMBOSS, "Emboss properties" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
+
+ // Check the input emboss property
+ field.SetProperty( TextField::Property::INPUT_EMBOSS, "Emboss input properties" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_EMBOSS ), std::string("Emboss input properties"), TEST_LOCATION );
+
+ // Check the outline property
+ field.SetProperty( TextField::Property::OUTLINE, "Outline properties" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
+
+ // Check the input outline property
+ field.SetProperty( TextField::Property::INPUT_OUTLINE, "Outline input properties" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_OUTLINE ), std::string("Outline input properties"), TEST_LOCATION );
+
END_TEST;
}
const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS = "autoScrollLoopCount";
const char* const PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP = "autoScrollGap";
+const char* const PROPERTY_NAME_LINE_SPACING = "lineSpacing";
+const char* const PROPERTY_NAME_UNDERLINE = "underline";
+const char* const PROPERTY_NAME_SHADOW = "shadow";
+const char* const PROPERTY_NAME_EMBOSS = "emboss";
+const char* const PROPERTY_NAME_OUTLINE = "outline";
+
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
} // namespace
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_SPEED ) == TextLabel::Property::AUTO_SCROLL_SPEED );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_LOOPS ) == TextLabel::Property::AUTO_SCROLL_LOOP_COUNT );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_AUTO_SCROLL_GAP ) == TextLabel::Property::AUTO_SCROLL_GAP );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_LINE_SPACING ) == TextLabel::Property::LINE_SPACING );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_UNDERLINE ) == TextLabel::Property::UNDERLINE );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_SHADOW ) == TextLabel::Property::SHADOW );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_EMBOSS ) == TextLabel::Property::EMBOSS );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextLabel::Property::OUTLINE );
END_TEST;
}
label.SetProperty( TextLabel::Property::UNDERLINE_COLOR, Color::RED );
DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::UNDERLINE_COLOR ), Color::RED, TEST_LOCATION );
label.SetProperty( TextLabel::Property::UNDERLINE_HEIGHT, 1.0f );
- DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::UNDERLINE_HEIGHT ), 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::UNDERLINE_HEIGHT ), 1.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
TextLabel label2 = TextLabel::New( "New text" );
DALI_TEST_CHECK( label2 );
DALI_TEST_EQUALS( SCROLL_LOOPS, label.GetProperty<int>( TextLabel::Property::AUTO_SCROLL_LOOP_COUNT ), TEST_LOCATION );
label.SetProperty( TextLabel::Property::AUTO_SCROLL_GAP, SCROLL_GAP );
DALI_TEST_EQUALS( SCROLL_GAP, label.GetProperty<float>( TextLabel::Property::AUTO_SCROLL_GAP ), TEST_LOCATION );
+
+ // Check the line spacing property
+ DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f );
+ DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ // Check the underline property
+ label.SetProperty( TextLabel::Property::UNDERLINE, "Underline properties" );
+ DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::UNDERLINE ), std::string("Underline properties"), TEST_LOCATION );
+
+ // Check the shadow property
+ label.SetProperty( TextLabel::Property::SHADOW, "Shadow properties" );
+ DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::SHADOW ), std::string("Shadow properties"), TEST_LOCATION );
+
+ // Check the emboss property
+ label.SetProperty( TextLabel::Property::EMBOSS, "Emboss properties" );
+ DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::EMBOSS ), std::string("Emboss properties"), TEST_LOCATION );
+
+ // Check the outline property
+ label.SetProperty( TextLabel::Property::OUTLINE, "Outline properties" );
+ DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::OUTLINE ), std::string("Outline properties"), TEST_LOCATION );
+
END_TEST;
}
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
#include <dali-toolkit/public-api/controls/table-view/table-view.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
#include <dali-toolkit/public-api/controls/text-controls/text-field.h>
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
$(devel_api_src_dir)/controls/shadow-view/shadow-view.cpp \
$(devel_api_src_dir)/controls/slider/slider.cpp \
$(devel_api_src_dir)/controls/super-blur-view/super-blur-view.cpp \
- $(devel_api_src_dir)/controls/text-controls/text-editor.cpp \
$(devel_api_src_dir)/controls/text-controls/text-selection-popup.cpp \
$(devel_api_src_dir)/controls/text-controls/text-selection-toolbar.cpp \
$(devel_api_src_dir)/controls/tool-bar/tool-bar.cpp \
$(devel_api_src_dir)/controls/super-blur-view/super-blur-view.h
devel_api_text_controls_header_files = \
- $(devel_api_src_dir)/controls/text-controls/text-editor.h \
$(devel_api_src_dir)/controls/text-controls/text-selection-popup.h \
$(devel_api_src_dir)/controls/text-controls/text-selection-toolbar.h
#include <dali-toolkit/public-api/text/rendering-backend.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/internal/text/rendering/text-backend.h>
+#include <dali-toolkit/internal/text/text-effects-style.h>
#include <dali-toolkit/internal/text/text-font-style.h>
#include <dali-toolkit/internal/text/text-view.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputFontFamily", STRING, INPUT_FONT_FAMILY )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputFontStyle", STRING, INPUT_FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputPointSize", FLOAT, INPUT_POINT_SIZE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "lineSpacing", FLOAT, LINE_SPACING )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputLineSpacing", FLOAT, INPUT_LINE_SPACING )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "underline", STRING, UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputUnderline", STRING, INPUT_UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "shadow", STRING, SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputShadow", STRING, INPUT_SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "emboss", STRING, EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputEmboss", STRING, INPUT_EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "outline", STRING, OUTLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputOutline", STRING, INPUT_OUTLINE )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
}
break;
}
+ case Toolkit::TextEditor::Property::LINE_SPACING:
+ {
+ if( impl.mController )
+ {
+ const float lineSpacing = value.Get<float>();
+ impl.mController->SetDefaultLineSpacing( lineSpacing );
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_LINE_SPACING:
+ {
+ if( impl.mController )
+ {
+ const float lineSpacing = value.Get<float>();
+ impl.mController->SetInputLineSpacing( lineSpacing );
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::UNDERLINE:
+ {
+ const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_UNDERLINE:
+ {
+ const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::SHADOW:
+ {
+ const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_SHADOW:
+ {
+ const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::EMBOSS:
+ {
+ const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_EMBOSS:
+ {
+ const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::OUTLINE:
+ {
+ const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_OUTLINE:
+ {
+ const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
} // switch
} // texteditor
}
}
break;
}
+ case Toolkit::TextEditor::Property::LINE_SPACING:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->GetDefaultLineSpacing();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_LINE_SPACING:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->GetInputLineSpacing();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::UNDERLINE:
+ {
+ GetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_UNDERLINE:
+ {
+ GetUnderlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::SHADOW:
+ {
+ GetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_SHADOW:
+ {
+ GetShadowProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::EMBOSS:
+ {
+ GetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_EMBOSS:
+ {
+ GetEmbossProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::OUTLINE:
+ {
+ GetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_OUTLINE:
+ {
+ GetOutlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
} //switch
}
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/devel-api/controls/text-controls/text-editor.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
#include <dali-toolkit/internal/text/clipping/text-clipper.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/text-control-interface.h>
#include <dali-toolkit/public-api/text/rendering-backend.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/internal/text/rendering/text-backend.h>
+#include <dali-toolkit/internal/text/text-effects-style.h>
#include <dali-toolkit/internal/text/text-font-style.h>
#include <dali-toolkit/internal/text/text-view.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputFontFamily", STRING, INPUT_FONT_FAMILY )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputFontStyle", STRING, INPUT_FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputPointSize", FLOAT, INPUT_POINT_SIZE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "underline", STRING, UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputUnderline", STRING, INPUT_UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "shadow", STRING, SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputShadow", STRING, INPUT_SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "emboss", STRING, EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputEmboss", STRING, INPUT_EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "outline", STRING, OUTLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputOutline", STRING, INPUT_OUTLINE )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
}
break;
}
+ case Toolkit::TextField::Property::UNDERLINE:
+ {
+ const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_UNDERLINE:
+ {
+ const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::SHADOW:
+ {
+ const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_SHADOW:
+ {
+ const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::EMBOSS:
+ {
+ const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_EMBOSS:
+ {
+ const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::OUTLINE:
+ {
+ const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_OUTLINE:
+ {
+ const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
} // switch
} // textfield
}
}
break;
}
+ case Toolkit::TextField::Property::UNDERLINE:
+ {
+ GetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_UNDERLINE:
+ {
+ GetUnderlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
+ case Toolkit::TextField::Property::SHADOW:
+ {
+ GetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_SHADOW:
+ {
+ GetShadowProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
+ case Toolkit::TextField::Property::EMBOSS:
+ {
+ GetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_EMBOSS:
+ {
+ GetEmbossProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
+ case Toolkit::TextField::Property::OUTLINE:
+ {
+ GetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_OUTLINE:
+ {
+ GetOutlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
} //switch
}
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/text/rendering-backend.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
+#include <dali-toolkit/internal/text/property-string-parser.h>
#include <dali-toolkit/internal/text/rendering/text-backend.h>
+#include <dali-toolkit/internal/text/text-effects-style.h>
#include <dali-toolkit/internal/text/text-font-style.h>
#include <dali-toolkit/internal/text/text-view.h>
#include <dali-toolkit/internal/text/text-definitions.h>
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollSpeed", INTEGER, AUTO_SCROLL_SPEED )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopCount", INTEGER, AUTO_SCROLL_LOOP_COUNT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollGap", FLOAT, AUTO_SCROLL_GAP )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineSpacing", FLOAT, LINE_SPACING )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underline", STRING, UNDERLINE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadow", STRING, SHADOW )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "emboss", STRING, EMBOSS )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "outline", STRING, OUTLINE )
DALI_TYPE_REGISTRATION_END()
impl.mTextScroller->SetGap( value.Get<float>() );
break;
}
+ case Toolkit::TextLabel::Property::LINE_SPACING:
+ {
+ if( impl.mController )
+ {
+ const float lineSpacing = value.Get<float>();
+ impl.mController->SetDefaultLineSpacing( lineSpacing );
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::UNDERLINE:
+ {
+ const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::SHADOW:
+ {
+ const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::EMBOSS:
+ {
+ const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::OUTLINE:
+ {
+ const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
}
}
}
}
break;
}
+ case Toolkit::TextLabel::Property::LINE_SPACING:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->GetDefaultLineSpacing();
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::UNDERLINE:
+ {
+ GetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextLabel::Property::SHADOW:
+ {
+ GetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextLabel::Property::EMBOSS:
+ {
+ GetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextLabel::Property::OUTLINE:
+ {
+ GetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
}
}
$(toolkit_src_dir)/text/markup-processor-font.cpp \
$(toolkit_src_dir)/text/markup-processor-helper-functions.cpp \
$(toolkit_src_dir)/text/multi-language-support.cpp \
+ $(toolkit_src_dir)/text/property-string-parser.cpp \
$(toolkit_src_dir)/text/segmentation.cpp \
$(toolkit_src_dir)/text/shaper.cpp \
$(toolkit_src_dir)/text/text-control-interface.cpp \
$(toolkit_src_dir)/text/text-controller.cpp \
$(toolkit_src_dir)/text/text-controller-impl.cpp \
+ $(toolkit_src_dir)/text/text-effects-style.cpp \
$(toolkit_src_dir)/text/text-font-style.cpp \
$(toolkit_src_dir)/text/text-io.cpp \
$(toolkit_src_dir)/text/text-scroller.cpp \
width( TextAbstraction::FontWidth::NORMAL ),
slant( TextAbstraction::FontSlant::NORMAL ),
size( 0.f ),
+ lineSpacing( 0.f ),
+ underlineProperties(),
+ shadowProperties(),
+ embossProperties(),
+ outlineProperties(),
isDefaultColor( true ),
familyDefined( false ),
weightDefined( false ),
widthDefined( false ),
slantDefined( false ),
- sizeDefined( false )
+ sizeDefined( false ),
+ lineSpacingDefined( false )
{}
~InputStyle()
{};
- Vector4 textColor; ///< The text's color.
- std::string fontStyle; ///< The font's style string.
- std::string familyName; ///< The font's family name.
- FontWeight weight; ///< The font's weight.
- FontWidth width; ///< The font's width.
- FontSlant slant; ///< The font's slant.
- float size; ///< The font's size.
-
- bool isDefaultColor : 1; ///< Whether the text's color is the default.
- bool familyDefined : 1; ///< Whether the font's family is defined.
- bool weightDefined : 1; ///< Whether the font's weight is defined.
- bool widthDefined : 1; ///< Whether the font's width is defined.
- bool slantDefined : 1; ///< Whether the font's slant is defined.
- bool sizeDefined : 1; ///< Whether the font's size is defined.
+ Vector4 textColor; ///< The text's color.
+ std::string fontStyle; ///< The font's style string.
+ std::string familyName; ///< The font's family name.
+ FontWeight weight; ///< The font's weight.
+ FontWidth width; ///< The font's width.
+ FontSlant slant; ///< The font's slant.
+ float size; ///< The font's size.
+
+ float lineSpacing; ///< The line's spacing.
+ std::string underlineProperties; ///< The underline properties string.
+ std::string shadowProperties; ///< The shadow properties string.
+ std::string embossProperties; ///< The emboss properties string.
+ std::string outlineProperties; ///< The outline properties string.
+
+ bool isDefaultColor : 1; ///< Whether the text's color is the default.
+ bool familyDefined : 1; ///< Whether the font's family is defined.
+ bool weightDefined : 1; ///< Whether the font's weight is defined.
+ bool widthDefined : 1; ///< Whether the font's width is defined.
+ bool slantDefined : 1; ///< Whether the font's slant is defined.
+ bool sizeDefined : 1; ///< Whether the font's size is defined.
+
+ bool lineSpacingDefined : 1; ///< Whether the line spacing is defined.
};
} // namespace Text
const float MAX_FLOAT = std::numeric_limits<float>::max();
const bool RTL = true;
const float CURSOR_WIDTH = 1.f;
+const float LINE_SPACING= 0.f;
} //namespace
mHorizontalAlignment( LayoutEngine::HORIZONTAL_ALIGN_BEGIN ),
mVerticalAlignment( LayoutEngine::VERTICAL_ALIGN_TOP ),
mCursorWidth( CURSOR_WIDTH ),
+ mDefaultLineSpacing( LINE_SPACING ),
mEllipsisEnabled( false )
{
}
LayoutEngine::HorizontalAlignment mHorizontalAlignment;
LayoutEngine::VerticalAlignment mVerticalAlignment;
float mCursorWidth;
+ float mDefaultLineSpacing;
IntrusivePtr<Metrics> mMetrics;
lines );
}
+void LayoutEngine::SetDefaultLineSpacing( float lineSpacing )
+{
+ mImpl->mDefaultLineSpacing = lineSpacing;
+}
+
+float LayoutEngine::GetDefaultLineSpacing() const
+{
+ return mImpl->mDefaultLineSpacing;
+}
+
} // namespace Text
} // namespace Toolkit
Length numberOfCharacters,
Vector<LineRun>& lines );
+ /**
+ * @brief Sets the default line spacing.
+ *
+ * @param[in] lineSpacing The line spacing.
+ */
+ void SetDefaultLineSpacing( float lineSpacing );
+
+ /**
+ * @brief Retrieves the default line spacing.
+ *
+ * @return The line spacing.
+ */
+ float GetDefaultLineSpacing() const;
+
private:
// Undefined
--- /dev/null
+/*
+ * Copyright (c) 2016 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// FILE HEADER
+#include <dali-toolkit/internal/text/property-string-parser.h>
+
+// EXTERNAL HEADERS
+#include <sstream>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/builder/json-parser.h>
+#include <dali-toolkit/devel-api/builder/tree-node.h>
+#include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+void CreatePropertyMap( const TreeNode* const node, Property::Map& map )
+{
+ switch( node->GetType() )
+ {
+ case TreeNode::IS_NULL:
+ case TreeNode::OBJECT:
+ case TreeNode::ARRAY: // FALL THROUGH
+ {
+ break;
+ }
+ case TreeNode::STRING:
+ {
+ map.Insert( node->GetName(), Property::Value( node->GetString() ) );
+ break;
+ }
+ case TreeNode::INTEGER:
+ case TreeNode::FLOAT:
+ case TreeNode::BOOLEAN: // FALL THROUGH
+ {
+ break;
+ }
+ }
+
+ for( TreeNode::ConstIterator it = node->CBegin(), endIt = node->CEnd(); it != endIt; ++it )
+ {
+ const TreeNode::KeyNodePair& pair = *it;
+ CreatePropertyMap( &pair.second, map );
+ }
+}
+
+void ParsePropertyString( const std::string& property, Property::Map& map )
+{
+ Toolkit::JsonParser parser = Toolkit::JsonParser::New();
+
+ if( parser.Parse( property ) )
+ {
+ const TreeNode* const node = parser.GetRoot();
+
+ CreatePropertyMap( node, map );
+ }
+}
+
+void StringOffsetToVector2( const std::string& offsetStr,
+ Vector2& offset )
+{
+ offset = Vector2::ZERO;
+
+ unsigned int wsIndex = 0u;
+ for( std::string::const_iterator it = offsetStr.begin(),
+ endIt = offsetStr.end();
+ it != endIt;
+ ++it, ++wsIndex )
+ {
+ if( *it == ' ' )
+ {
+ break;
+ }
+ }
+
+ offset[0] = StringToFloat( offsetStr.c_str() );
+ offset[1] = StringToFloat( offsetStr.c_str() + wsIndex );
+}
+
+} //namespace Text
+
+} //namespace Toolkit
+
+} //namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_PROPERTY_STRING_PARSER_H__
+#define __DALI_TOOLKIT_PROPERTY_STRING_PARSER_H__
+
+/*
+ * Copyright (c) 2016 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/property-map.h>
+
+// INTERNAL INCLUDES
+
+namespace Dali
+{
+
+// Forward declaration
+struct Vector2;
+
+namespace Toolkit
+{
+
+// Forward declaration
+class TreeNode;
+
+namespace Text
+{
+
+/**
+ * @brief Creates a map with pairs 'key,value' with the property's parameters.
+ *
+ * @param[in] node Data structure with the property's parameters.
+ * @param[out] map A map with the property's parameters.
+ *
+ */
+void CreatePropertyMap( const TreeNode* const node, Property::Map& map );
+
+/**
+ * @brief Parses a property string.
+ *
+ * @param[in] property A property string.
+ * @param[out] map A map with the property's parameters.
+ *
+ */
+void ParsePropertyString( const std::string& property, Property::Map& map );
+
+/**
+ * @brief Converts an offset packed inside a string into a Vector2.
+ *
+ * @param[in] offsetStr The offset packed inside a string.
+ * @param[out] offset The offset packed in a Vector2.
+ *
+ */
+void StringOffsetToVector2( const std::string& offsetStr,
+ Vector2& offset );
+
+} //namespace Text
+
+} //namespace Toolkit
+
+} //namespace Dali
+
+#endif //__DALI_TOOLKIT_PROPERTY_STRING_PARSER_H__
vert.mPosition.y = baseLine;
vert.mTexCoords.x = ZERO;
vert.mTexCoords.y = ZERO;
+ vert.mColor = underlineColor;
newMesh.mVertices.PushBack( vert );
vert.mPosition.x = brx;
vert.mPosition.y = baseLine;
vert.mTexCoords.x = u;
+ vert.mColor = underlineColor;
newMesh.mVertices.PushBack( vert );
vert.mPosition.x = tlx;
vert.mPosition.y = baseLine + thickness;
vert.mTexCoords.x = ZERO;
vert.mTexCoords.y = v;
+ vert.mColor = underlineColor;
newMesh.mVertices.PushBack( vert );
vert.mPosition.x = brx;
vert.mPosition.y = baseLine + thickness;
vert.mTexCoords.x = u;
+ vert.mColor = underlineColor;
newMesh.mVertices.PushBack( vert );
// Six indices in counter clockwise winding
newMesh.mIndices.PushBack( faceIndex + 1u );
faceIndex += 4;
- vert.mColor = underlineColor;
-
Toolkit::Internal::AtlasMeshFactory::AppendMesh( meshRecords[ index ].mMesh, newMesh );
}
}
}
};
+struct UnderlineDefaults
+{
+ std::string properties;
+ // TODO: complete with underline parameters.
+};
+
+struct ShadowDefaults
+{
+ std::string properties;
+ // TODO: complete with shadow parameters.
+};
+
+struct EmbossDefaults
+{
+ std::string properties;
+ // TODO: complete with emboss parameters.
+};
+
+struct OutlineDefaults
+{
+ std::string properties;
+ // TODO: complete with outline parameters.
+};
+
struct Controller::Impl
{
Impl( ControlInterface& controlInterface )
mLogicalModel(),
mVisualModel(),
mFontDefaults( NULL ),
+ mUnderlineDefaults( NULL ),
+ mShadowDefaults( NULL ),
+ mEmbossDefaults( NULL ),
+ mOutlineDefaults( NULL ),
mEventData( NULL ),
mFontClient(),
mClipboard(),
~Impl()
{
delete mFontDefaults;
+ delete mUnderlineDefaults;
+ delete mShadowDefaults;
+ delete mEmbossDefaults;
+ delete mOutlineDefaults;
delete mEventData;
}
LogicalModelPtr mLogicalModel; ///< Pointer to the logical model.
VisualModelPtr mVisualModel; ///< Pointer to the visual model.
FontDefaults* mFontDefaults; ///< Avoid allocating this when the user does not specify a font.
+ UnderlineDefaults* mUnderlineDefaults; ///< Avoid allocating this when the user does not specify underline parameters.
+ ShadowDefaults* mShadowDefaults; ///< Avoid allocating this when the user does not specify shadow parameters.
+ EmbossDefaults* mEmbossDefaults; ///< Avoid allocating this when the user does not specify emboss parameters.
+ OutlineDefaults* mOutlineDefaults; ///< Avoid allocating this when the user does not specify outline parameters.
EventData* mEventData; ///< Avoid allocating everything for text input until EnableTextInput().
TextAbstraction::FontClient mFontClient; ///< Handle to the font client.
Clipboard mClipboard; ///< Handle to the system clipboard
return mImpl->mVisualModel->GetShadowColor();
}
+void Controller::SetDefaultShadowProperties( const std::string& shadowProperties )
+{
+ if( NULL == mImpl->mShadowDefaults )
+ {
+ mImpl->mShadowDefaults = new ShadowDefaults();
+ }
+
+ mImpl->mShadowDefaults->properties = shadowProperties;
+}
+
+const std::string& Controller::GetDefaultShadowProperties() const
+{
+ if( NULL != mImpl->mShadowDefaults )
+ {
+ return mImpl->mShadowDefaults->properties;
+ }
+
+ return EMPTY_STRING;
+}
+
void Controller::SetUnderlineColor( const Vector4& color )
{
mImpl->mVisualModel->SetUnderlineColor( color );
return mImpl->mVisualModel->GetUnderlineHeight();
}
+void Controller::SetDefaultUnderlineProperties( const std::string& underlineProperties )
+{
+ if( NULL == mImpl->mUnderlineDefaults )
+ {
+ mImpl->mUnderlineDefaults = new UnderlineDefaults();
+ }
+
+ mImpl->mUnderlineDefaults->properties = underlineProperties;
+}
+
+const std::string& Controller::GetDefaultUnderlineProperties() const
+{
+ if( NULL != mImpl->mUnderlineDefaults )
+ {
+ return mImpl->mUnderlineDefaults->properties;
+ }
+
+ return EMPTY_STRING;
+}
+
+void Controller::SetDefaultEmbossProperties( const std::string& embossProperties )
+{
+ if( NULL == mImpl->mEmbossDefaults )
+ {
+ mImpl->mEmbossDefaults = new EmbossDefaults();
+ }
+
+ mImpl->mEmbossDefaults->properties = embossProperties;
+}
+
+const std::string& Controller::GetDefaultEmbossProperties() const
+{
+ if( NULL != mImpl->mEmbossDefaults )
+ {
+ return mImpl->mEmbossDefaults->properties;
+ }
+
+ return EMPTY_STRING;
+}
+
+void Controller::SetDefaultOutlineProperties( const std::string& outlineProperties )
+{
+ if( NULL == mImpl->mOutlineDefaults )
+ {
+ mImpl->mOutlineDefaults = new OutlineDefaults();
+ }
+
+ mImpl->mOutlineDefaults->properties = outlineProperties;
+}
+
+const std::string& Controller::GetDefaultOutlineProperties() const
+{
+ if( NULL != mImpl->mOutlineDefaults )
+ {
+ return mImpl->mOutlineDefaults->properties;
+ }
+
+ return EMPTY_STRING;
+}
+
+void Controller::SetDefaultLineSpacing( float lineSpacing )
+{
+ //TODO finish implementation
+ mImpl->mLayoutEngine.SetDefaultLineSpacing( lineSpacing );
+}
+
+float Controller::GetDefaultLineSpacing() const
+{
+ return mImpl->mLayoutEngine.GetDefaultLineSpacing();
+}
+
void Controller::SetInputColor( const Vector4& color )
{
if( NULL != mImpl->mEventData )
return GetDefaultPointSize();
}
+void Controller::SetInputLineSpacing( float lineSpacing )
+{
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mInputStyle.lineSpacing = lineSpacing;
+ }
+}
+
+float Controller::GetInputLineSpacing() const
+{
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mInputStyle.lineSpacing;
+ }
+
+ return 0.f;
+}
+
+void Controller::SetInputShadowProperties( const std::string& shadowProperties )
+{
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mInputStyle.shadowProperties = shadowProperties;
+ }
+}
+
+const std::string& Controller::GetInputShadowProperties() const
+{
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mInputStyle.shadowProperties;
+ }
+
+ return GetDefaultShadowProperties();
+}
+
+void Controller::SetInputUnderlineProperties( const std::string& underlineProperties )
+{
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mInputStyle.underlineProperties = underlineProperties;
+ }
+}
+
+const std::string& Controller::GetInputUnderlineProperties() const
+{
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mInputStyle.underlineProperties;
+ }
+
+ return GetDefaultUnderlineProperties();
+}
+
+void Controller::SetInputEmbossProperties( const std::string& embossProperties )
+{
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mInputStyle.embossProperties = embossProperties;
+ }
+}
+
+const std::string& Controller::GetInputEmbossProperties() const
+{
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mInputStyle.embossProperties;
+ }
+
+ return GetDefaultEmbossProperties();
+}
+
+void Controller::SetInputOutlineProperties( const std::string& outlineProperties )
+{
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mInputStyle.outlineProperties = outlineProperties;
+ }
+}
+
+const std::string& Controller::GetInputOutlineProperties() const
+{
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mInputStyle.outlineProperties;
+ }
+
+ return GetDefaultOutlineProperties();
+}
+
void Controller::SetEnableCursorBlink( bool enable )
{
DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "TextInput disabled" );
const Vector4& GetShadowColor() const;
/**
+ * @brief Sets the shadow's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] shadowProperties The shadow's properties string.
+ */
+ void SetDefaultShadowProperties( const std::string& shadowProperties );
+
+ /**
+ * @brief Retrieves the shadow's properties string.
+ *
+ * @return The shadow's properties string.
+ */
+ const std::string& GetDefaultShadowProperties() const;
+
+ /**
* @brief Set the underline color.
*
* @param[in] color color of underline.
float GetUnderlineHeight() const;
/**
+ * @brief Sets the underline's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] underlineProperties The underline's properties string.
+ */
+ void SetDefaultUnderlineProperties( const std::string& underlineProperties );
+
+ /**
+ * @brief Retrieves the underline's properties string.
+ *
+ * @return The underline's properties string.
+ */
+ const std::string& GetDefaultUnderlineProperties() const;
+
+ /**
+ * @brief Sets the emboss's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] embossProperties The emboss's properties string.
+ */
+ void SetDefaultEmbossProperties( const std::string& embossProperties );
+
+ /**
+ * @brief Retrieves the emboss's properties string.
+ *
+ * @return The emboss's properties string.
+ */
+ const std::string& GetDefaultEmbossProperties() const;
+
+ /**
+ * @brief Sets the outline's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] outlineProperties The outline's properties string.
+ */
+ void SetDefaultOutlineProperties( const std::string& outlineProperties );
+
+ /**
+ * @brief Retrieves the outline's properties string.
+ *
+ * @return The outline's properties string.
+ */
+ const std::string& GetDefaultOutlineProperties() const;
+
+ /**
+ * @brief Sets the default line spacing.
+ *
+ * @param[in] lineSpacing The line spacing.
+ */
+ void SetDefaultLineSpacing( float lineSpacing );
+
+ /**
+ * @brief Retrieves the default line spacing.
+ *
+ * @return The line spacing.
+ */
+ float GetDefaultLineSpacing() const;
+
+ /**
* @brief Sets the input text's color.
*
* @param[in] color The input text's color.
float GetInputFontPointSize() const;
/**
+ * @brief Sets the input line spacing.
+ *
+ * @param[in] lineSpacing The line spacing.
+ */
+ void SetInputLineSpacing( float lineSpacing );
+
+ /**
+ * @brief Retrieves the input line spacing.
+ *
+ * @return The line spacing.
+ */
+ float GetInputLineSpacing() const;
+
+ /**
+ * @brief Sets the input shadow's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] shadowProperties The shadow's properties string.
+ */
+ void SetInputShadowProperties( const std::string& shadowProperties );
+
+ /**
+ * @brief Retrieves the input shadow's properties string.
+ *
+ * @return The shadow's properties string.
+ */
+ const std::string& GetInputShadowProperties() const;
+
+ /**
+ * @brief Sets the input underline's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] underlineProperties The underline's properties string.
+ */
+ void SetInputUnderlineProperties( const std::string& underlineProperties );
+
+ /**
+ * @brief Retrieves the input underline's properties string.
+ *
+ * @return The underline's properties string.
+ */
+ const std::string& GetInputUnderlineProperties() const;
+
+ /**
+ * @brief Sets the input emboss's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] embossProperties The emboss's properties string.
+ */
+ void SetInputEmbossProperties( const std::string& embossProperties );
+
+ /**
+ * @brief Retrieves the input emboss's properties string.
+ *
+ * @return The emboss's properties string.
+ */
+ const std::string& GetInputEmbossProperties() const;
+
+ /**
+ * @brief Sets input the outline's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] outlineProperties The outline's properties string.
+ */
+ void SetInputOutlineProperties( const std::string& outlineProperties );
+
+ /**
+ * @brief Retrieves the input outline's properties string.
+ *
+ * @return The outline's properties string.
+ */
+ const std::string& GetInputOutlineProperties() const;
+
+ /**
* @brief Called to enable/disable cursor blink.
*
* @note Only editable controls should calls this.
--- /dev/null
+/*
+ * Copyright (c) 2016 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// FILE HEADER
+#include <dali-toolkit/internal/text/text-effects-style.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+#include <dali-toolkit/internal/text/property-string-parser.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+namespace
+{
+const std::string COLOR_KEY( "color" );
+const std::string OFFSET_KEY( "offset" );
+const std::string THICKNESS_KEY( "thickness" );
+}
+
+bool SetUnderlineProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type )
+{
+ bool update = false;
+
+ if( controller )
+ {
+ const std::string properties = value.Get< std::string >();
+
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ // Stores the default underline's properties string to be recovered by the GetUnderlineProperties() function.
+ controller->SetDefaultUnderlineProperties( properties );
+ break;
+ }
+ case EffectStyle::INPUT:
+ {
+ // Stores the input underline's properties string to be recovered by the GetUnderlineProperties() function.
+ controller->SetInputUnderlineProperties( properties );
+ break;
+ }
+ }
+
+ // Parses and applies the style.
+ Property::Map map;
+ ParsePropertyString( properties, map );
+
+ if( !map.Empty() )
+ {
+ /// Color key
+ Property::Value* colorValue = map.Find( COLOR_KEY );
+
+ Vector4 color;
+ const bool colorDefined = colorValue != NULL;
+ if( colorDefined )
+ {
+ const std::string colorStr = colorValue->Get<std::string>();
+
+ ColorStringToVector4( colorStr.c_str(), colorStr.size(), color );
+ }
+
+ /// Thickness key
+ Property::Value* thicknessValue = map.Find( THICKNESS_KEY );
+
+ float thickness = 0.f;
+ const bool thicknessDefined = thicknessValue != NULL;
+ if( thicknessDefined )
+ {
+ const std::string thicknessStr = thicknessValue->Get<std::string>();
+
+ thickness = StringToFloat( thicknessStr.c_str() );
+ }
+
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ if( !controller->IsUnderlineEnabled() )
+ {
+ controller->SetUnderlineEnabled( true );
+ update = true;
+ }
+ // Sets the default underline values.
+ if( colorDefined && ( controller->GetUnderlineColor() != color ) )
+ {
+ controller->SetUnderlineColor( color );
+ update = true;
+ }
+
+ if( thicknessDefined && fabsf( controller->GetUnderlineHeight() - thickness ) > Math::MACHINE_EPSILON_1000 )
+ {
+ controller->SetUnderlineHeight( thickness );
+ update = true;
+ }
+ }
+ case EffectStyle::INPUT:
+ {
+ // Sets the input underline values.
+ // TODO: to be implemented.
+ break;
+ }
+ }
+ }
+ else
+ {
+ // Disable underline.
+ if( controller->IsUnderlineEnabled() )
+ {
+ controller->SetUnderlineEnabled( false );
+ update = true;
+ }
+ }
+ }
+
+ return update;
+}
+
+void GetUnderlineProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type )
+{
+ if( controller )
+ {
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ value = controller->GetDefaultUnderlineProperties();
+ break;
+ }
+ case EffectStyle::INPUT:
+ {
+ value = controller->GetInputUnderlineProperties();
+ break;
+ }
+ }
+ }
+}
+
+bool SetShadowProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type )
+{
+ bool update = false;
+
+ if( controller )
+ {
+ const std::string properties = value.Get< std::string >();
+
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ // Stores the default shadow's properties string to be recovered by the GetShadowProperties() function.
+ controller->SetDefaultShadowProperties( properties );
+ break;
+ }
+ case EffectStyle::INPUT:
+ {
+ // Stores the input shadow's properties string to be recovered by the GetShadowProperties() function.
+ controller->SetInputShadowProperties( properties );
+ break;
+ }
+ }
+
+ // Parses and applies the style.
+ Property::Map map;
+ ParsePropertyString( properties, map );
+
+ if( !map.Empty() )
+ {
+ /// Color key
+ Property::Value* colorValue = map.Find( COLOR_KEY );
+
+ Vector4 color;
+ const bool colorDefined = colorValue != NULL;
+ if( colorDefined )
+ {
+ const std::string colorStr = colorValue->Get<std::string>();
+
+ ColorStringToVector4( colorStr.c_str(), colorStr.size(), color );
+ }
+
+ /// Offset key
+ Property::Value* offsetValue = map.Find( OFFSET_KEY );
+
+ Vector2 offset;
+ const bool offsetDefined = offsetValue != NULL;
+ if( offsetDefined )
+ {
+ const std::string offsetStr = offsetValue->Get<std::string>();
+
+ StringOffsetToVector2( offsetStr, offset );
+ }
+
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ // Sets the default shadow values.
+ if( colorDefined && ( controller->GetShadowColor() != color ) )
+ {
+ controller->SetShadowColor( color );
+ update = true;
+ }
+
+ if( offsetDefined && ( controller->GetShadowOffset() != offset ) )
+ {
+ controller->SetShadowOffset( offset );
+ update = true;
+ }
+ }
+ case EffectStyle::INPUT:
+ {
+ // Sets the input shadow values.
+ // TODO: to be implemented.
+ break;
+ }
+ }
+ }
+ }
+
+ return update;
+}
+
+void GetShadowProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type )
+{
+ if( controller )
+ {
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ value = controller->GetDefaultShadowProperties();
+ break;
+ }
+ case EffectStyle::INPUT:
+ {
+ value = controller->GetInputShadowProperties();
+ break;
+ }
+ }
+ }
+}
+
+bool SetEmbossProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type )
+{
+ bool update = false;
+
+ if( controller )
+ {
+ const std::string properties = value.Get< std::string >();
+
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ // Stores the default emboss's properties string to be recovered by the GetEmbossProperties() function.
+ controller->SetDefaultEmbossProperties( properties );
+ break;
+ }
+ case EffectStyle::INPUT:
+ {
+ // Stores the input emboss's properties string to be recovered by the GetEmbossProperties() function.
+ controller->SetInputEmbossProperties( properties );
+ break;
+ }
+ }
+ }
+
+ return update;
+}
+
+void GetEmbossProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type )
+{
+ if( controller )
+ {
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ value = controller->GetDefaultEmbossProperties();
+ break;
+ }
+ case EffectStyle::INPUT:
+ {
+ value = controller->GetInputEmbossProperties();
+ break;
+ }
+ }
+ }
+}
+
+bool SetOutlineProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type )
+{
+ bool update = false;
+
+ if( controller )
+ {
+ const std::string properties = value.Get< std::string >();
+
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ // Stores the default outline's properties string to be recovered by the GetOutlineProperties() function.
+ controller->SetDefaultOutlineProperties( properties );
+ break;
+ }
+ case EffectStyle::INPUT:
+ {
+ // Stores the input outline's properties string to be recovered by the GetOutlineProperties() function.
+ controller->SetInputOutlineProperties( properties );
+ break;
+ }
+ }
+ }
+
+ return update;
+}
+
+void GetOutlineProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type )
+{
+ if( controller )
+ {
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ value = controller->GetDefaultOutlineProperties();
+ break;
+ }
+ case EffectStyle::INPUT:
+ {
+ value = controller->GetInputOutlineProperties();
+ break;
+ }
+ }
+ }
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_EFFECTS_STYLE_H__
+#define __DALI_TOOLKIT_INTERNAL_TEXT_EFFECTS_STYLE_H__
+
+/*
+ * Copyright (c) 2016 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/scripting/scripting.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/text-controller.h>
+#include <dali-toolkit/internal/text/text-definitions.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+namespace EffectStyle
+{
+ enum Type
+ {
+ DEFAULT, ///< The default text effect style.
+ INPUT ///< The input text effect style.
+ };
+};
+
+/**
+ * @brief Sets the underline properties.
+ *
+ * @param[in] controller The text's controller.
+ * @param[in] value The values of the underline's properties.
+ * @param[in] type Whether the property is for the default underline or the input underline.
+ *
+ * @return Whether the underline properties have been updated.
+ */
+bool SetUnderlineProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type );
+
+/**
+ * @brief Retrieves the underline's properties.
+ *
+ * @param[in] controller The text's controller.
+ * @param[out] value The value of the underline's properties.
+ * @param[in] type Whether the property is for the default underline or the input underline.
+ */
+void GetUnderlineProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type );
+
+/**
+ * @brief Sets the shadow properties.
+ *
+ * @param[in] controller The text's controller.
+ * @param[in] value The values of the shadow's style.
+ * @param[in] type Whether the property is for the default shadow's style or the input shadow's style.
+ *
+ * @return Whether the shadow properties have been updated.
+ */
+bool SetShadowProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type );
+
+/**
+ * @brief Retrieves the shadow's properties.
+ *
+ * @param[in] controller The text's controller.
+ * @param[out] value The value of the shadow's properties.
+ * @param[in] type Whether the property is for the default shadow or the input shadow.
+ */
+void GetShadowProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type );
+
+/**
+ * @brief Sets the emboss properties.
+ *
+ * @param[in] controller The text's controller.
+ * @param[in] value The values of the emboss's properties.
+ * @param[in] type Whether the property is for the default emboss or the input emboss.
+ *
+ * @return Whether the emboss properties have been updated.
+ */
+bool SetEmbossProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type );
+
+/**
+ * @brief Retrieves the emboss's properties.
+ *
+ * @param[in] controller The text's controller.
+ * @param[out] value The value of the emboss's properties.
+ * @param[in] type Whether the property is for the default emboss or the input emboss.
+ */
+void GetEmbossProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type );
+
+/**
+ * @brief Sets the outline properties.
+ *
+ * @param[in] controller The text's controller.
+ * @param[in] value The values of the outline's properties.
+ * @param[in] type Whether the property is for the default outline or the input outline.
+ *
+ * @return Whether the outline properties have been updated.
+ */
+bool SetOutlineProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type );
+
+/**
+ * @brief Retrieves the outline's properties.
+ *
+ * @param[in] controller The text's controller.
+ * @param[out] value The value of the outline's properties.
+ * @param[in] type Whether the property is for the default outline or the input outline.
+ */
+void GetOutlineProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type );
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_INTERNAL_TEXT_EFFECTS_STYLE_H__
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/builder/json-parser.h>
-#include <dali-toolkit/devel-api/builder/tree-node.h>
+#include <dali-toolkit/internal/text/property-string-parser.h>
namespace Dali
{
const std::string WEIGHT_KEY( "weight" );
const std::string WIDTH_KEY( "width" );
const std::string SLANT_KEY( "slant" );
-const std::string EMPTY_STRING( "" );
#if defined(DEBUG_ENABLED)
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS");
} // namespace
-/**
- * @brief Creates a map with pairs 'key,value' with the font's style parameters.
- *
- * @param[in] node Data structure with the font's style parameters.
- * @param[out] map A map with the font's style parameters.
- *
- */
-void CreateFontStyleMap( const TreeNode* const node, Property::Map& map )
-{
- switch( node->GetType() )
- {
- case TreeNode::IS_NULL:
- case TreeNode::OBJECT:
- case TreeNode::ARRAY: // FALL THROUGH
- {
- break;
- }
- case TreeNode::STRING:
- {
- map.Insert( node->GetName(), Property::Value( node->GetString() ) );
- break;
- }
- case TreeNode::INTEGER:
- case TreeNode::FLOAT:
- case TreeNode::BOOLEAN: // FALL THROUGH
- {
- break;
- }
- }
-
- for( TreeNode::ConstIterator it = node->CBegin(), endIt = node->CEnd(); it != endIt; ++it )
- {
- const TreeNode::KeyNodePair& pair = *it;
- CreateFontStyleMap( &pair.second, map );
- }
-}
-
-/**
- * @brief Parses the font's style string.
- *
- * @param[in] style The font's style string.
- * @param[out] map A map with the font's style parameters.
- *
- */
-void ParseFontStyleString( const std::string& style, Property::Map& map )
-{
- Toolkit::JsonParser parser = Toolkit::JsonParser::New();
-
- if( parser.Parse( style ) )
- {
- const TreeNode* const node = parser.GetRoot();
-
- if( NULL != node )
- {
- CreateFontStyleMap( node, map );
- }
- }
-}
-
void SetFontStyleProperty( ControllerPtr controller, const Property::Value& value, FontStyle::Type type )
{
if( controller )
// Parses and applies the style.
Property::Map map;
- ParseFontStyleString( style, map );
+ ParsePropertyString( style, map );
if( !map.Empty() )
{
*
* @param[in] controller The text's controller.
* @param[in] value The value of the font's style.
+ * @param[in] type Whether the property is for the default font's style or the input font's style.
*
*/
void SetFontStyleProperty( ControllerPtr controller, const Property::Value& value, FontStyle::Type type );
*
* @param[in] controller The text's controller.
* @param[out] value The value of the font's style.
+ * @param[in] type Whether the property is for the default font's style or the input font's style.
*/
void GetFontStyleProperty( ControllerPtr controller, Property::Value& value, FontStyle::Type type );
*/
// CLASS HEADER
-#include <dali-toolkit/devel-api/controls/text-controls/text-editor.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/text-controls/text-editor-impl.h>
{
enum
{
- RENDERING_BACKEND = PROPERTY_START_INDEX, ///< name "renderingBackend", The type or rendering e.g. bitmap-based, type INT
- TEXT, ///< name "text", The text to display in UTF-8 format, type STRING
- TEXT_COLOR, ///< name "textColor", The text color, type VECTOR4
- FONT_FAMILY, ///< name "fontFamily", The requested font family, type STRING
- FONT_STYLE, ///< name "fontStyle", The requested font style, type STRING
- POINT_SIZE, ///< name "pointSize", The size of font in points, type FLOAT
- HORIZONTAL_ALIGNMENT, ///< name "horizontalAlignment", The text horizontal alignment, type STRING, values "BEGIN", "CENTER", "END"
- SCROLL_THRESHOLD, ///< name "scrollThreshold" Vertical scrolling will occur if the cursor is this close to the control border, type FLOAT
- SCROLL_SPEED, ///< name "scrollSpeed" The scroll speed in pixels per second, type FLOAT
- PRIMARY_CURSOR_COLOR, ///< name "primaryCursorColor", The color to apply to the primary cursor, type VECTOR4
- SECONDARY_CURSOR_COLOR, ///< name "secondaryCursorColor", The color to apply to the secondary cursor, type VECTOR4
- ENABLE_CURSOR_BLINK, ///< name "enableCursorBlink", Whether the cursor should blink or not, type BOOLEAN
- CURSOR_BLINK_INTERVAL, ///< name "cursorBlinkInterval", The time interval in seconds between cursor on/off states, type FLOAT
- CURSOR_BLINK_DURATION, ///< name "cursorBlinkDuration", The cursor will stop blinking after this number of seconds (if non-zero), type FLOAT
- CURSOR_WIDTH, ///< name "cursorWidth", The cursor width, type INTEGER
- GRAB_HANDLE_IMAGE, ///< name "grabHandleImage", The image to display for the grab handle, type STRING
- GRAB_HANDLE_PRESSED_IMAGE, ///< name "grabHandlePressedImage", The image to display when the grab handle is pressed, type STRING
- SELECTION_HANDLE_IMAGE_LEFT, ///< name "selectionHandleImageLeft", The image to display for the left selection handle, type MAP
- SELECTION_HANDLE_IMAGE_RIGHT, ///< name "selectionHandleImageRight", The image to display for the right selection handle, type MAP
- SELECTION_HANDLE_PRESSED_IMAGE_LEFT, ///< name "selectionHandlePressedImageLeft", The image to display when the left selection handle is pressed, type MAP
- SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, ///< name "selectionHandlePressedImageRight", The image to display when the right selection handle is pressed, type MAP
- SELECTION_HANDLE_MARKER_IMAGE_LEFT, ///< name "selectionHandleMarkerImageLeft", The image to display for the left selection handle marker, type MAP
- SELECTION_HANDLE_MARKER_IMAGE_RIGHT, ///< name "selectionHandleMarkerImageRight", The image to display for the right selection handle marker, type MAP
- SELECTION_HIGHLIGHT_COLOR, ///< name "selectionHighlightColor", The color of the selection highlight, type VECTOR4
- DECORATION_BOUNDING_BOX, ///< name "decorationBoundingBox", The decorations (handles etc) will positioned within this area on-screen, type RECTANGLE
- ENABLE_MARKUP, ///< name "enableMarkup", Whether the mark-up processing is enabled. type BOOLEAN
- INPUT_COLOR, ///< name "inputColor", The color of the new input text, type VECTOR4
- INPUT_FONT_FAMILY, ///< name "inputFontFamily", The font's family of the new input text, type STRING
- INPUT_FONT_STYLE, ///< name "inputFontStyle", The font's style of the new input text, type STRING
- INPUT_POINT_SIZE ///< name "inputPointSize", The font's size of the new input text in points, type FLOAT
+ RENDERING_BACKEND = PROPERTY_START_INDEX, ///< name "renderingBackend", The type or rendering e.g. bitmap-based, type INT @SINCE_1_1.37
+ TEXT, ///< name "text", The text to display in UTF-8 format, type STRING @SINCE_1_1.37
+ TEXT_COLOR, ///< name "textColor", The text color, type VECTOR4 @SINCE_1_1.37
+ FONT_FAMILY, ///< name "fontFamily", The requested font family, type STRING @SINCE_1_1.37
+ FONT_STYLE, ///< name "fontStyle", The requested font style, type STRING @SINCE_1_1.37
+ POINT_SIZE, ///< name "pointSize", The size of font in points, type FLOAT @SINCE_1_1.37
+ HORIZONTAL_ALIGNMENT, ///< name "horizontalAlignment", The text horizontal alignment, type STRING, values "BEGIN", "CENTER", "END" @SINCE_1_1.37
+ SCROLL_THRESHOLD, ///< name "scrollThreshold" Vertical scrolling will occur if the cursor is this close to the control border, type FLOAT @SINCE_1_1.37
+ SCROLL_SPEED, ///< name "scrollSpeed" The scroll speed in pixels per second, type FLOAT @SINCE_1_1.37
+ PRIMARY_CURSOR_COLOR, ///< name "primaryCursorColor", The color to apply to the primary cursor, type VECTOR4 @SINCE_1_1.37
+ SECONDARY_CURSOR_COLOR, ///< name "secondaryCursorColor", The color to apply to the secondary cursor, type VECTOR4 @SINCE_1_1.37
+ ENABLE_CURSOR_BLINK, ///< name "enableCursorBlink", Whether the cursor should blink or not, type BOOLEAN @SINCE_1_1.37
+ CURSOR_BLINK_INTERVAL, ///< name "cursorBlinkInterval", The time interval in seconds between cursor on/off states, type FLOAT @SINCE_1_1.37
+ CURSOR_BLINK_DURATION, ///< name "cursorBlinkDuration", The cursor will stop blinking after this number of seconds (if non-zero), type FLOAT @SINCE_1_1.37
+ CURSOR_WIDTH, ///< name "cursorWidth", The cursor width, type INTEGER @SINCE_1_1.37
+ GRAB_HANDLE_IMAGE, ///< name "grabHandleImage", The image to display for the grab handle, type STRING @SINCE_1_1.37
+ GRAB_HANDLE_PRESSED_IMAGE, ///< name "grabHandlePressedImage", The image to display when the grab handle is pressed, type STRING @SINCE_1_1.37
+ SELECTION_HANDLE_IMAGE_LEFT, ///< name "selectionHandleImageLeft", The image to display for the left selection handle, type MAP @SINCE_1_1.37
+ SELECTION_HANDLE_IMAGE_RIGHT, ///< name "selectionHandleImageRight", The image to display for the right selection handle, type MAP @SINCE_1_1.37
+ SELECTION_HANDLE_PRESSED_IMAGE_LEFT, ///< name "selectionHandlePressedImageLeft", The image to display when the left selection handle is pressed, type MAP @SINCE_1_1.37
+ SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, ///< name "selectionHandlePressedImageRight", The image to display when the right selection handle is pressed, type MAP @SINCE_1_1.37
+ SELECTION_HANDLE_MARKER_IMAGE_LEFT, ///< name "selectionHandleMarkerImageLeft", The image to display for the left selection handle marker, type MAP @SINCE_1_1.37
+ SELECTION_HANDLE_MARKER_IMAGE_RIGHT, ///< name "selectionHandleMarkerImageRight", The image to display for the right selection handle marker, type MAP @SINCE_1_1.37
+ SELECTION_HIGHLIGHT_COLOR, ///< name "selectionHighlightColor", The color of the selection highlight, type VECTOR4 @SINCE_1_1.37
+ DECORATION_BOUNDING_BOX, ///< name "decorationBoundingBox", The decorations (handles etc) will positioned within this area on-screen, type RECTANGLE @SINCE_1_1.37
+ ENABLE_MARKUP, ///< name "enableMarkup", Whether the mark-up processing is enabled. type BOOLEAN @SINCE_1_1.37
+ INPUT_COLOR, ///< name "inputColor", The color of the new input text, type VECTOR4 @SINCE_1_1.37
+ INPUT_FONT_FAMILY, ///< name "inputFontFamily", The font's family of the new input text, type STRING @SINCE_1_1.37
+ INPUT_FONT_STYLE, ///< name "inputFontStyle", The font's style of the new input text, type STRING @SINCE_1_1.37
+ INPUT_POINT_SIZE, ///< name "inputPointSize", The font's size of the new input text in points, type FLOAT @SINCE_1_1.37
+ LINE_SPACING, ///< name "lineSpacing", The default extra space between lines in points, type FLOAT @SINCE_1_1.37
+ INPUT_LINE_SPACING, ///< name "inputLineSpacing" The extra space between lines in points. It affects the whole paragraph where the new input text is inserted, type FLOAT @SINCE_1_1.37
+ UNDERLINE, ///< name "underline" The default underline parameters, type STRING @SINCE_1_1.37
+ INPUT_UNDERLINE, ///< name "inputUnderline" The underline parameters of the new input text, type STRING @SINCE_1_1.37
+ SHADOW, ///< name "shadow" The default shadow parameters, type STRING @SINCE_1_1.37
+ INPUT_SHADOW, ///< name "inputShadow" The shadow parameters of the new input text, type STRING @SINCE_1_1.37
+ EMBOSS, ///< name "emboss" The default emboss parameters, type STRING @SINCE_1_1.37
+ INPUT_EMBOSS, ///< name "inputEmboss" The emboss parameters of the new input text, type STRING @SINCE_1_1.37
+ OUTLINE, ///< name "outline" The default outline parameters, type STRING @SINCE_1_1.37
+ INPUT_OUTLINE, ///< name "inputOutline" The outline parameters of the new input text, type STRING @SINCE_1_1.37
};
};
VERTICAL_ALIGNMENT, ///< name "verticalAlignment", The line vertical alignment, type STRING, values "TOP", "CENTER", "BOTTOM" @SINCE_1_0.0
TEXT_COLOR, ///< name "textColor", The text color, type VECTOR4 @SINCE_1_0.0
PLACEHOLDER_TEXT_COLOR, ///< name "placeholderTextColor", The placeholder-text color, type VECTOR4 @SINCE_1_0.0
- SHADOW_OFFSET, ///< name "shadowOffset", The drop shadow offset 0 indicates no shadow, type VECTOR2 @SINCE_1_0.0
- SHADOW_COLOR, ///< name "shadowColor", The color of a drop shadow, type VECTOR4 @SINCE_1_0.0
+ SHADOW_OFFSET, ///< name "shadowOffset", The drop shadow offset 0 indicates no shadow, type VECTOR2 @DEPRECATED_1_1.37 Use SHADOW instead.
+ SHADOW_COLOR, ///< name "shadowColor", The color of a drop shadow, type VECTOR4 @DEPRECATED_1_1.37 Use SHADOW instead.
PRIMARY_CURSOR_COLOR, ///< name "primaryCursorColor", The color to apply to the primary cursor, type VECTOR4 @SINCE_1_0.0
SECONDARY_CURSOR_COLOR, ///< name "secondaryCursorColor", The color to apply to the secondary cursor, type VECTOR4 @SINCE_1_0.0
ENABLE_CURSOR_BLINK, ///< name "enableCursorBlink", Whether the cursor should blink or not, type BOOLEAN @SINCE_1_0.0
ENABLE_MARKUP, ///< name "enableMarkup", Whether the mark-up processing is enabled. type BOOLEAN @SINCE_1_0.0
INPUT_FONT_FAMILY, ///< name "inputFontFamily", The font's family of the new input text, type STRING @SINCE_1_0.0
INPUT_FONT_STYLE, ///< name "inputFontStyle", The font's style of the new input text, type STRING @SINCE_1_0.0
- INPUT_POINT_SIZE ///< name "inputPointSize", The font's size of the new input text in points, type FLOAT @SINCE_1_0.0
+ INPUT_POINT_SIZE, ///< name "inputPointSize", The font's size of the new input text in points, type FLOAT @SINCE_1_0.0
+ UNDERLINE, ///< name "underline" The default underline parameters, type STRING @SINCE_1_1.37
+ INPUT_UNDERLINE, ///< name "inputUnderline" The underline parameters of the new input text, type STRING @SINCE_1_1.37
+ SHADOW, ///< name "shadow" The default shadow parameters, type STRING @SINCE_1_1.37
+ INPUT_SHADOW, ///< name "inputShadow" The shadow parameters of the new input text, type STRING @SINCE_1_1.37
+ EMBOSS, ///< name "emboss" The default emboss parameters, type STRING @SINCE_1_1.37
+ INPUT_EMBOSS, ///< name "inputEmboss" The emboss parameters of the new input text, type STRING @SINCE_1_1.37
+ OUTLINE, ///< name "outline" The default outline parameters, type STRING @SINCE_1_1.37
+ INPUT_OUTLINE, ///< name "inputOutline" The outline parameters of the new input text, type STRING @SINCE_1_1.37
};
};
* | Property::HORIZONTAL_ALIGNMENT | horizontalAlignment | STRING | O | X |
* | Property::VERTICAL_ALIGNMENT | verticalAlignment | STRING | O | X |
* | Property::TEXT_COLOR | textColor | VECTOR4 | O | X |
- * | Property::SHADOW_OFFSET | shadowOffset | VECTOR2 | O | X |
- * | Property::SHADOW_COLOR | shadowColor | VECTOR4 | O | X |
- * | Property::UNDERLINE_ENABLED | underlineEnabled | BOOLEAN | O | X |
- * | Property::UNDERLINE_COLOR | underlineColor | VECTOR4 | O | X |
- * | Property::UNDERLINE_HEIGHT | underlineHeight | FLOAT | O | X |
* | Property::ENABLE_MARKUP | enableMarkup | BOOLEAN | O | X |
* | Property::ENABLE_AUTO_SCROLL | enableAutoScroll | BOOLEAN | O | X |
* | Property::AUTO_SCROLL_SPEED | autoScrollSpeed | INTEGER | O | X |
* | Property::AUTO_SCROLL_LOOP_COUNT | autoScrollLoopCount | INTEGER | O | X |
* | Property::AUTO_SCROLL_GAP | autoScrollGap | INTEGER | O | X |
+ * | Property::SHADOW | shadow | STRING | O | X |
+ * | Property::UNDERLINE | underline | STRING | O | X |
*
* @SINCE_1_0.0
*/
/**
* @brief The drop shadow offset 0 indicates no shadow
* @details name "shadowOffset", type VECTOR4
- * @SINCE_1_0.0
+ * @DEPRECATED_1_1.37 Use SHADOW instead
*/
SHADOW_OFFSET,
/**
* @brief The color of a drop shadow
* @details name "shadowColor", type VECTOR4
- * @SINCE_1_0.0
+ * @DEPRECATED_1_1.37 Use SHADOW instead
*/
SHADOW_COLOR,
/**
* @brief The underline enabled flag
* @details name "underlineEnabled", type BOOLEAN
- * @SINCE_1_0.0
+ * @DEPRECATED_1_1.37 Use UNDERLINE instead
*/
UNDERLINE_ENABLED,
/**
* @brief The color of the underline
* @details name "underlineColor", type VECTOR4
- * @SINCE_1_0.0
+ * @DEPRECATED_1_1.37 Use UNDERLINE instead
*/
UNDERLINE_COLOR,
/**
* @brief Overrides the underline height from font metrics
* @details name "underlineHeight", type FLOAT
- * @SINCE_1_0.0
+ * @DEPRECATED_1_1.37 Use UNDERLINE instead
*/
UNDERLINE_HEIGHT,
* @details name "autoScrollGap", type INT, default in style sheet but can be overridden to prevent same text being show at start and end.
* @SINCE_1_1.35
*/
- AUTO_SCROLL_GAP
+ AUTO_SCROLL_GAP,
+
+ /**
+ * @brief The default extra space between lines in points.
+ * @details name "lineSpacing", type FLOAT.
+ * @SINCE_1_1.37
+ */
+ LINE_SPACING,
+
+ /**
+ * @brief The default underline parameters.
+ * @details name "underline", type STRING.
+ * @SINCE_1_1.37
+ */
+ UNDERLINE,
+
+ /**
+ * @brief The default shadow parameters.
+ * @details name "shadow", type STRING.
+ * @SINCE_1_1.37
+ */
+ SHADOW,
+
+ /**
+ * @brief The default emboss parameters.
+ * @details name "emboss", type STRING.
+ * @SINCE_1_1.37
+ */
+ EMBOSS,
+
+ /**
+ * @brief The default outline parameters.
+ * @details name "outline", type STRING.
+ * @SINCE_1_1.37
+ */
+ OUTLINE,
};
};
$(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view.cpp \
$(public_api_src_dir)/controls/scrollable/scrollable.cpp \
$(public_api_src_dir)/controls/table-view/table-view.cpp \
+ $(public_api_src_dir)/controls/text-controls/text-editor.cpp \
$(public_api_src_dir)/controls/text-controls/text-label.cpp \
$(public_api_src_dir)/controls/text-controls/text-field.cpp \
$(public_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.cpp \
$(public_api_src_dir)/controls/table-view/table-view.h
public_api_text_controls_header_files = \
+ $(public_api_src_dir)/controls/text-controls/text-editor.h \
$(public_api_src_dir)/controls/text-controls/text-label.h \
$(public_api_src_dir)/controls/text-controls/text-field.h
inputFontFamily | INPUT_FONT_FAMILY | STRING | O | X
inputFontStyle | INPUT_FONT_STYLE | STRING | O | X
inputPointSize | INPUT_POINT_SIZE | FLOAT | O | X
+ lineSpacing | LINE_SPACING | FLOAT | O | X
+ inputLineSpacing | INPUT_LINE_SPACING | FLOAT | O | X
+ underline | UNDERLINE | STRING | O | X
+ inputUnderline | INPUT_UNDERLINE | STRING | O | X
+ shadow | SHADOW | STRING | O | X
+ inputShadow | INPUT_SHADOW | STRING | O | X
+ emboss | EMBOSS | STRING | O | X
+ inputEmboss | INPUT_EMBOSS | STRING | O | X
+ outline | OUTLINE | STRING | O | X
+ inputOutline | INPUT_OUTLINE | STRING | O | X
@class TextEditor
verticalAlignment | VERTICAL_ALIGNMENT | STRING | O | X
textColor | TEXT_COLOR | VECTOR4 | O | X
placeholderTextColor | PLACEHOLDER_TEXT_COLOR | VECTOR4 | O | X
- shadowOffset | SHADOW_OFFSET | VECTOR2 | O | X
- shadowColor | SHADOW_COLOR | VECTOR4 | O | X
primaryCursorColor | PRIMARY_CURSOR_COLOR | VECTOR4 | O | X
secondaryCursorColor | SECONDARY_CURSOR_COLOR | VECTOR4 | O | X
enableCursorBlink | ENABLE_CURSOR_BLINK | BOOLEAN | O | X
inputFontFamily | INPUT_FONT_FAMILY | STRING | O | X
inputFontStyle | INPUT_FONT_STYLE | STRING | O | X
inputPointSize | INPUT_POINT_SIZE | FLOAT | O | X
+ underline | UNDERLINE | STRING | O | X
+ inputUnderline | INPUT_UNDERLINE | STRING | O | X
+ shadow | SHADOW | STRING | O | X
+ inputShadow | INPUT_SHADOW | STRING | O | X
+ emboss | EMBOSS | STRING | O | X
+ inputEmboss | INPUT_EMBOSS | STRING | O | X
+ outline | OUTLINE | STRING | O | X
+ inputOutline | INPUT_OUTLINE | STRING | O | X
@class TextField
#### Drop Shadow
-To add a drop-shadow to the text, simply set the SHADOW_OFFSET property with non-zero values.
-The color can also be selected using the SHADOW_COLOR property.
+To add a drop-shadow to the text, simply set the SHADOW property. Shadow parameters can be set through a json string, see the examples below.
~~~{.cpp}
// C++
label1.SetProperty( TextLabel::Property::TEXT, "Plain Text" );
label2.SetProperty( TextLabel::Property::TEXT, "Text with Shadow" );
-label2.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) );
-label2.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
+label2.SetProperty( TextLabel::Property::SHADOW, "{\"offset\":\"1 1\",\"color\":\"black\"}" );
label3.SetProperty( TextLabel::Property::TEXT, "Text with Bigger Shadow" );
-label3.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 2.0f, 2.0f ) );
-label3.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
+label3.SetProperty( TextLabel::Property::SHADOW, "{\"offset\":\"2 2\",\"color\":\"black\"}" );
label4.SetProperty( TextLabel::Property::TEXT, "Text with Color Shadow" );
-label4.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) );
-label4.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::RED );
+label4.SetProperty( TextLabel::Property::SHADOW, "{\"offset\":\"1 1\",\"color\":\"red\"}" );
~~~
~~~{.js}
label2.text = "Text with Shadow";
-label2.shadowOffset = [1, 1];
-label2.shadowColor = dali.COLOR_BLACK;
+label2.shadow = "{\"offset\":\"1 1\",\"color\":\"black\"}";
label3.text = "Text with Bigger Shadow";
-label3.shadowOffset = [2, 2];
-label3.shadowColor = dali.COLOR_BLACK;
+label3.shadow = "{\"offset\":\"2 2\",\"color\":\"black\"}";
label4.SetProperty( TextLabel::Property::TEXT, "Text with Color Shadow" );
-label3.shadowOffset = [1, 1];
-label3.shadowColor = dali.COLOR_RED;
+label3.shadow = "{\"offset\":\"1 1\",\"color\":\"red\"}";
~~~