From eac074bfe3a3c144f55583135515d2c8d16eb479 Mon Sep 17 00:00:00 2001 From: Agnelo Vaz Date: Mon, 2 Oct 2017 20:08:05 +0100 Subject: [PATCH] Text Alignment Enums now public TextVisual and TextControls now share the Horizontal and Vertical alignment enumerations. The Enums are public, internal versions are replaced hence reducing internal conversion. Change-Id: I7343430d61a278d9a4eb97b7a0568a7f934cf54f --- .../dali-toolkit-test-utils/toolkit-text-utils.cpp | 4 +- .../dali-toolkit-internal/utc-Dali-Text-Layout.cpp | 62 ++++++++-------- .../utc-Dali-Text-Typesetter.cpp | 4 +- .../utc-Dali-Text-ViewModel.cpp | 12 ++-- .../src/dali-toolkit/utc-Dali-Visual.cpp | 8 +-- build/tizen/dali-toolkit/Makefile.am | 4 +- dali-toolkit/dali-toolkit.h | 1 + .../controls/text-controls/text-editor-impl.cpp | 24 ++----- .../controls/text-controls/text-field-impl.cpp | 53 ++++---------- .../controls/text-controls/text-label-impl.cpp | 60 +++++----------- dali-toolkit/internal/file.list | 1 + .../internal/text/layouts/layout-alignment.h | 70 ------------------ .../internal/text/layouts/layout-engine.cpp | 24 +++---- dali-toolkit/internal/text/layouts/layout-engine.h | 4 +- .../internal/text/layouts/layout-parameters.h | 5 +- .../internal/text/rendering/text-typesetter.cpp | 6 +- .../internal/text/rendering/view-model.cpp | 4 +- dali-toolkit/internal/text/rendering/view-model.h | 5 +- .../internal/text/text-controller-impl.cpp | 6 +- dali-toolkit/internal/text/text-controller.cpp | 14 ++-- dali-toolkit/internal/text/text-controller.h | 10 +-- .../internal/text/text-enumerations-impl.cpp | 82 +++++++++++++++++++++ .../internal/text/text-enumerations-impl.h | 73 +++++++++++++++++++ dali-toolkit/internal/text/text-model-interface.h | 6 +- dali-toolkit/internal/text/text-model.cpp | 8 +-- dali-toolkit/internal/text/text-model.h | 20 +++--- dali-toolkit/internal/text/text-scroller.cpp | 22 +++--- dali-toolkit/internal/text/text-scroller.h | 4 +- dali-toolkit/internal/visuals/text/text-visual.cpp | 71 +++--------------- .../controls/text-controls/text-editor.h | 3 +- .../public-api/controls/text-controls/text-field.h | 6 +- .../public-api/controls/text-controls/text-label.h | 6 +- dali-toolkit/public-api/file.list | 5 +- dali-toolkit/public-api/text/text-enumerations.h | 83 ++++++++++++++++++++++ .../public-api/visuals/text-visual-properties.h | 8 ++- 35 files changed, 424 insertions(+), 354 deletions(-) delete mode 100644 dali-toolkit/internal/text/layouts/layout-alignment.h create mode 100644 dali-toolkit/internal/text/text-enumerations-impl.cpp create mode 100644 dali-toolkit/internal/text/text-enumerations-impl.h create mode 100644 dali-toolkit/public-api/text/text-enumerations.h diff --git a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp index 43fc5ac..3758b47 100644 --- a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp +++ b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp @@ -281,7 +281,7 @@ void CreateTextModel( const std::string& text, charactersToGlyph.Begin(), glyphsPerCharacter.Begin(), numberOfGlyphs, - Layout::HORIZONTAL_ALIGN_BEGIN, + Text::HorizontalAlignment::BEGIN, Layout::LineWrap::WORD ); Vector& lines = visualModel->mLines; @@ -339,7 +339,7 @@ void CreateTextModel( const std::string& text, layoutEngine.Align( textArea, 0u, numberOfCharacters, - Layout::HORIZONTAL_ALIGN_BEGIN, + Text::HorizontalAlignment::BEGIN, lines, alignmentOffset ); } diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp index 3f6a9a6..50090ee 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp @@ -169,7 +169,7 @@ bool LayoutTextTest( const LayoutTextData& data ) visualModel->mCharactersToGlyph.Begin(), visualModel->mGlyphsPerCharacter.Begin(), totalNumberOfGlyphs, - Layout::HORIZONTAL_ALIGN_BEGIN, + Text::HorizontalAlignment::BEGIN, Layout::LineWrap::WORD ); layoutParameters.isLastNewParagraph = isLastNewParagraph; @@ -385,7 +385,7 @@ bool ReLayoutRightToLeftLinesTest( const ReLayoutRightToLeftLinesData& data ) visualModel->mCharactersToGlyph.Begin(), visualModel->mGlyphsPerCharacter.Begin(), visualModel->mGlyphs.Count(), - Layout::HORIZONTAL_ALIGN_BEGIN, + Text::HorizontalAlignment::BEGIN, Layout::LineWrap::WORD ); layoutParameters.numberOfBidirectionalInfoRuns = logicalModel->mBidirectionalLineInfo.Count(); @@ -428,17 +428,17 @@ bool ReLayoutRightToLeftLinesTest( const ReLayoutRightToLeftLinesData& data ) struct AlignData { - std::string description; - std::string text; - Size textArea; - unsigned int numberOfFonts; - FontDescriptionRun* fontDescriptions; - Layout::HorizontalAlignment horizontalAlignment; - Layout::VerticalAlignment verticalAlignment; - unsigned int startIndex; - unsigned int numberOfCharacters; - unsigned int numberOfLines; - float* lineOffsets; + std::string description; + std::string text; + Size textArea; + unsigned int numberOfFonts; + FontDescriptionRun* fontDescriptions; + Text::HorizontalAlignment::Type horizontalAlignment; + Text::VerticalAlignment::Type verticalAlignment; + unsigned int startIndex; + unsigned int numberOfCharacters; + unsigned int numberOfLines; + float* lineOffsets; }; bool AlignTest( const AlignData& data ) @@ -4141,8 +4141,8 @@ int UtcDaliTextAlign01(void) textArea, 6u, fontDescriptionRuns.Begin(), - Layout::HORIZONTAL_ALIGN_BEGIN, - Layout::VERTICAL_ALIGN_TOP, + Text::HorizontalAlignment::BEGIN, + Text::VerticalAlignment::TOP, 0u, 22u, 6u, @@ -4260,8 +4260,8 @@ int UtcDaliTextAlign02(void) textArea, 6u, fontDescriptionRuns.Begin(), - Layout::HORIZONTAL_ALIGN_BEGIN, - Layout::VERTICAL_ALIGN_TOP, + Text::HorizontalAlignment::BEGIN, + Text::VerticalAlignment::TOP, 22u, 26u, 6u, @@ -4379,8 +4379,8 @@ int UtcDaliTextAlign03(void) textArea, 6u, fontDescriptionRuns.Begin(), - Layout::HORIZONTAL_ALIGN_BEGIN, - Layout::VERTICAL_ALIGN_TOP, + Text::HorizontalAlignment::BEGIN, + Text::VerticalAlignment::TOP, 48u, 26u, 6u, @@ -4498,8 +4498,8 @@ int UtcDaliTextAlign04(void) textArea, 6u, fontDescriptionRuns.Begin(), - Layout::HORIZONTAL_ALIGN_CENTER, - Layout::VERTICAL_ALIGN_TOP, + Text::HorizontalAlignment::CENTER, + Text::VerticalAlignment::TOP, 0u, 22u, 6u, @@ -4617,8 +4617,8 @@ int UtcDaliTextAlign05(void) textArea, 6u, fontDescriptionRuns.Begin(), - Layout::HORIZONTAL_ALIGN_CENTER, - Layout::VERTICAL_ALIGN_TOP, + Text::HorizontalAlignment::CENTER, + Text::VerticalAlignment::TOP, 22u, 26u, 6u, @@ -4736,8 +4736,8 @@ int UtcDaliTextAlign06(void) textArea, 6u, fontDescriptionRuns.Begin(), - Layout::HORIZONTAL_ALIGN_CENTER, - Layout::VERTICAL_ALIGN_TOP, + Text::HorizontalAlignment::CENTER, + Text::VerticalAlignment::TOP, 48u, 26u, 6u, @@ -4855,8 +4855,8 @@ int UtcDaliTextAlign07(void) textArea, 6u, fontDescriptionRuns.Begin(), - Layout::HORIZONTAL_ALIGN_END, - Layout::VERTICAL_ALIGN_TOP, + Text::HorizontalAlignment::END, + Text::VerticalAlignment::TOP, 0u, 22u, 6u, @@ -4974,8 +4974,8 @@ int UtcDaliTextAlign08(void) textArea, 6u, fontDescriptionRuns.Begin(), - Layout::HORIZONTAL_ALIGN_END, - Layout::VERTICAL_ALIGN_TOP, + Text::HorizontalAlignment::END, + Text::VerticalAlignment::TOP, 22u, 26u, 6u, @@ -5093,8 +5093,8 @@ int UtcDaliTextAlign09(void) textArea, 6u, fontDescriptionRuns.Begin(), - Layout::HORIZONTAL_ALIGN_END, - Layout::VERTICAL_ALIGN_TOP, + Text::HorizontalAlignment::END, + Text::VerticalAlignment::TOP, 48u, 26u, 6u, diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp index e742a9e..50ca75d 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp @@ -116,7 +116,7 @@ int UtcDaliTextRenderingControllerRender(void) DALI_TEST_EQUALS( Pixel::RGBA8888, bitmap.GetPixelFormat(), TEST_LOCATION ); // Changes vertical alignment. - controller->SetVerticalAlignment( Layout::VERTICAL_ALIGN_CENTER ); + controller->SetVerticalAlignment( Text::VerticalAlignment::CENTER ); controller->Relayout( relayoutSize ); // Renders the text and creates the final bitmap. @@ -127,7 +127,7 @@ int UtcDaliTextRenderingControllerRender(void) DALI_TEST_EQUALS( 60u, bitmap.GetHeight(), TEST_LOCATION ); DALI_TEST_EQUALS( Pixel::RGBA8888, bitmap.GetPixelFormat(), TEST_LOCATION ); - controller->SetVerticalAlignment( Layout::VERTICAL_ALIGN_BOTTOM ); + controller->SetVerticalAlignment( Text::VerticalAlignment::BOTTOM ); controller->Relayout( relayoutSize ); // Renders the text and creates the final bitmap. diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp index 422e6ac..13595ab 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp @@ -307,14 +307,14 @@ int UtcDaliTextViewModelGetAlignment(void) ViewModel* model = typesetter->GetViewModel(); DALI_TEST_CHECK( NULL != model ); - DALI_TEST_EQUALS( Layout::HORIZONTAL_ALIGN_BEGIN, model->GetHorizontalAlignment(), TEST_LOCATION ); - DALI_TEST_EQUALS( Layout::VERTICAL_ALIGN_TOP, model->GetVerticalAlignment(), TEST_LOCATION ); + DALI_TEST_EQUALS( Text::HorizontalAlignment::BEGIN, model->GetHorizontalAlignment(), TEST_LOCATION ); + DALI_TEST_EQUALS( Text::VerticalAlignment::TOP, model->GetVerticalAlignment(), TEST_LOCATION ); - controller->SetHorizontalAlignment( Layout::HORIZONTAL_ALIGN_CENTER ); - controller->SetVerticalAlignment( Layout::VERTICAL_ALIGN_CENTER ); + controller->SetHorizontalAlignment( Text::HorizontalAlignment::CENTER ); + controller->SetVerticalAlignment( Text::VerticalAlignment::CENTER ); - DALI_TEST_EQUALS( Layout::HORIZONTAL_ALIGN_CENTER, model->GetHorizontalAlignment(), TEST_LOCATION ); - DALI_TEST_EQUALS( Layout::VERTICAL_ALIGN_CENTER, model->GetVerticalAlignment(), TEST_LOCATION ); + DALI_TEST_EQUALS( Text::HorizontalAlignment::CENTER, model->GetHorizontalAlignment(), TEST_LOCATION ); + DALI_TEST_EQUALS( Text::VerticalAlignment::CENTER, model->GetVerticalAlignment(), TEST_LOCATION ); tet_result(TET_PASS); END_TEST; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp index fbc55d2..e64a216 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp @@ -1055,13 +1055,13 @@ int UtcDaliVisualGetPropertyMap10(void) DALI_TEST_CHECK( value ); DALI_TEST_CHECK( value->Get() ); - value = resultMap.Find( TextVisual::Property::HORIZONTAL_ALIGNMENT, Property::STRING ); + value = resultMap.Find( TextVisual::Property::HORIZONTAL_ALIGNMENT, Property::INTEGER ); DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), "CENTER", TEST_LOCATION ); + DALI_TEST_EQUALS( value->Get(), (int)Text::HorizontalAlignment::CENTER, TEST_LOCATION ); - value = resultMap.Find( TextVisual::Property::VERTICAL_ALIGNMENT, Property::STRING ); + value = resultMap.Find( TextVisual::Property::VERTICAL_ALIGNMENT, Property::INTEGER ); DALI_TEST_CHECK( value ); - DALI_TEST_EQUALS( value->Get(), "CENTER", TEST_LOCATION ); + DALI_TEST_EQUALS( value->Get(), (int)Text::VerticalAlignment::CENTER, TEST_LOCATION ); value = resultMap.Find( TextVisual::Property::TEXT_COLOR, Property::VECTOR4 ); DALI_TEST_CHECK( value ); diff --git a/build/tizen/dali-toolkit/Makefile.am b/build/tizen/dali-toolkit/Makefile.am index 4fbd30a..35534a0 100644 --- a/build/tizen/dali-toolkit/Makefile.am +++ b/build/tizen/dali-toolkit/Makefile.am @@ -202,7 +202,7 @@ publicapistylingdir = $(publicapidir)/styling publicapitableviewdir = $(publicapicontrolsdir)/table-view publicapitextcontrolsdir = $(publicapicontrolsdir)/text-controls publicapifocusmanagerdir = $(publicapidir)/focus-manager -publicapirenderingbackenddir = $(publicapidir)/text +publicapitextdir = $(publicapidir)/text publicapisliderdir = $(publicapicontrolsdir)/slider publicapivisualsdir = $(publicapidir)/visuals @@ -227,7 +227,7 @@ publicapistyling_HEADERS = $(public_api_styling_header_files) publicapitableview_HEADERS = $(public_api_table_view_header_files) publicapitextcontrols_HEADERS = $(public_api_text_controls_header_files) publicapifocusmanager_HEADERS = $(public_api_focus_manager_header_files) -publicapirenderingbackend_HEADERS = $(public_api_rendering_backend_header_files) +publicapitext_HEADERS = $(public_api_text_header_files) publicapislider_HEADERS = $(public_api_slider_header_files) publicapivisuals_HEADERS = $(public_api_visuals_header_files) diff --git a/dali-toolkit/dali-toolkit.h b/dali-toolkit/dali-toolkit.h index bc1ffa2..6e8cc5e 100644 --- a/dali-toolkit/dali-toolkit.h +++ b/dali-toolkit/dali-toolkit.h @@ -61,6 +61,7 @@ #include #include +#include #include #include diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index 5cb7df1..c719798 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -32,11 +32,13 @@ // INTERNAL INCLUDES #include +#include #include #include #include #include #include +#include #include #include #include @@ -67,16 +69,6 @@ const float DEFAULT_SCROLL_SPEED = 1200.f; ///< The default scroll speed for the namespace { - -const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] = -{ - { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN }, - { "CENTER", Toolkit::Text::Layout::HORIZONTAL_ALIGN_CENTER }, - { "END", Toolkit::Text::Layout::HORIZONTAL_ALIGN_END }, -}; -const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] ); - - const Scripting::StringEnum LINE_WRAP_MODE_STRING_TABLE[] = { { "WORD", Toolkit::Text::Layout::LineWrap::WORD }, @@ -262,11 +254,9 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P const std::string& alignStr = value.Get< std::string >(); DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p HORIZONTAL_ALIGNMENT %s\n", impl.mController.Get(), alignStr.c_str() ); - Layout::HorizontalAlignment alignment( Layout::HORIZONTAL_ALIGN_BEGIN ); - if( Scripting::GetEnumeration< Layout::HorizontalAlignment >( alignStr.c_str(), - HORIZONTAL_ALIGNMENT_STRING_TABLE, - HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT, - alignment ) ) + Text::HorizontalAlignment::Type alignment( Text::HorizontalAlignment::BEGIN ); + + Text::GetHorizontalAlignmentEnum( value, alignment ); { impl.mController->SetHorizontalAlignment( alignment ); } @@ -801,9 +791,7 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind { if( impl.mController ) { - const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::HorizontalAlignment >( impl.mController->GetHorizontalAlignment(), - HORIZONTAL_ALIGNMENT_STRING_TABLE, - HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT ); + const char* name = GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() ); if( name ) { value = std::string( name ); diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index a2d6b44..73a733c 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -31,10 +31,12 @@ // INTERNAL INCLUDES #include +#include #include #include #include #include +#include #include #include #include @@ -64,23 +66,6 @@ namespace // unnamed namespace namespace { - -const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] = -{ - { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN }, - { "CENTER", Toolkit::Text::Layout::HORIZONTAL_ALIGN_CENTER }, - { "END", Toolkit::Text::Layout::HORIZONTAL_ALIGN_END }, -}; -const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] ); - -const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] = -{ - { "TOP", Toolkit::Text::Layout::VERTICAL_ALIGN_TOP }, - { "CENTER", Toolkit::Text::Layout::VERTICAL_ALIGN_CENTER }, - { "BOTTOM", Toolkit::Text::Layout::VERTICAL_ALIGN_BOTTOM }, -}; -const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] ); - // Type registration BaseHandle Create() { @@ -299,14 +284,9 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr const std::string& alignStr = value.Get< std::string >(); DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p HORIZONTAL_ALIGNMENT %s\n", impl.mController.Get(), alignStr.c_str() ); - Layout::HorizontalAlignment alignment( Layout::HORIZONTAL_ALIGN_BEGIN ); - if( Scripting::GetEnumeration< Layout::HorizontalAlignment >( alignStr.c_str(), - HORIZONTAL_ALIGNMENT_STRING_TABLE, - HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT, - alignment ) ) - { - impl.mController->SetHorizontalAlignment( alignment ); - } + Text::HorizontalAlignment::Type alignment( Text::HorizontalAlignment::BEGIN ); + GetHorizontalAlignmentEnum( value, alignment ); + impl.mController->SetHorizontalAlignment( alignment ); } break; } @@ -317,14 +297,9 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr const std::string& alignStr = value.Get< std::string >(); DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p VERTICAL_ALIGNMENT %s\n", impl.mController.Get(), alignStr.c_str() ); - Layout::VerticalAlignment alignment( Layout::VERTICAL_ALIGN_BOTTOM ); - if( Scripting::GetEnumeration< Layout::VerticalAlignment >( alignStr.c_str(), - VERTICAL_ALIGNMENT_STRING_TABLE, - VERTICAL_ALIGNMENT_STRING_TABLE_COUNT, - alignment ) ) - { - impl.mController->SetVerticalAlignment( alignment ); - } + Text::VerticalAlignment::Type alignment( Text::VerticalAlignment::BOTTOM ); + GetVerticalAlignmentEnum( value, alignment ); + impl.mController->SetVerticalAlignment( alignment ); } break; } @@ -873,10 +848,9 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde { if( impl.mController ) { - const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::HorizontalAlignment >( impl.mController->GetHorizontalAlignment(), - HORIZONTAL_ALIGNMENT_STRING_TABLE, - HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT ); - if( name ) + const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() ); + + if ( name ) { value = std::string( name ); } @@ -887,9 +861,8 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde { if( impl.mController ) { - const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::VerticalAlignment >( impl.mController->GetVerticalAlignment(), - VERTICAL_ALIGNMENT_STRING_TABLE, - VERTICAL_ALIGNMENT_STRING_TABLE_COUNT ); + const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() ); + if( name ) { value = std::string( name ); diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index c29f484..75518d1 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -25,6 +25,7 @@ // INTERNAL INCLUDES #include +#include #include #include #include @@ -35,6 +36,7 @@ #include #include +#include #include #include #include @@ -71,22 +73,6 @@ const Scripting::StringEnum AUTO_SCROLL_STOP_MODE_TABLE[] = }; const unsigned int AUTO_SCROLL_STOP_MODE_TABLE_COUNT = sizeof( AUTO_SCROLL_STOP_MODE_TABLE ) / sizeof( AUTO_SCROLL_STOP_MODE_TABLE[0] ); -const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] = -{ - { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN }, - { "CENTER", Toolkit::Text::Layout::HORIZONTAL_ALIGN_CENTER }, - { "END", Toolkit::Text::Layout::HORIZONTAL_ALIGN_END }, -}; -const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] ); - -const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] = -{ - { "TOP", Toolkit::Text::Layout::VERTICAL_ALIGN_TOP }, - { "CENTER", Toolkit::Text::Layout::VERTICAL_ALIGN_CENTER }, - { "BOTTOM", Toolkit::Text::Layout::VERTICAL_ALIGN_BOTTOM }, -}; -const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] ); - const Scripting::StringEnum LINE_WRAP_MODE_STRING_TABLE[] = { { "WRAP_MODE_WORD", Toolkit::Text::Layout::LineWrap::WORD }, @@ -241,14 +227,11 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr { if( impl.mController ) { - Layout::HorizontalAlignment alignment( Layout::HORIZONTAL_ALIGN_BEGIN ); - if( Scripting::GetEnumeration< Toolkit::Text::Layout::HorizontalAlignment >( value.Get< std::string >().c_str(), - HORIZONTAL_ALIGNMENT_STRING_TABLE, - HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT, - alignment ) ) - { - impl.mController->SetHorizontalAlignment( alignment ); - } + Toolkit::Text::HorizontalAlignment::Type alignment( Toolkit::Text::HorizontalAlignment::BEGIN ); + Text::GetHorizontalAlignmentEnum( value, alignment ); + + impl.mController->SetHorizontalAlignment( alignment ); + } break; } @@ -256,14 +239,10 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr { if( impl.mController ) { - Layout::VerticalAlignment alignment( Layout::VERTICAL_ALIGN_BOTTOM ); - if( Scripting::GetEnumeration< Toolkit::Text::Layout::VerticalAlignment >( value.Get< std::string >().c_str(), - VERTICAL_ALIGNMENT_STRING_TABLE, - VERTICAL_ALIGNMENT_STRING_TABLE_COUNT, - alignment ) ) - { - impl.mController->SetVerticalAlignment( alignment ); - } + Toolkit::Text::VerticalAlignment::Type alignment( Toolkit::Text::VerticalAlignment::BOTTOM ); + Text::GetVerticalAlignmentEnum( value, alignment ); + + impl.mController->SetVerticalAlignment( alignment ); } break; } @@ -579,13 +558,12 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde { if( impl.mController ) { - const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::HorizontalAlignment >( impl.mController->GetHorizontalAlignment(), - HORIZONTAL_ALIGNMENT_STRING_TABLE, - HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT ); - if( name ) - { - value = std::string( name ); - } + const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() ); + + if ( name ) + { + value = std::string( name ); + } } break; } @@ -593,9 +571,7 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde { if( impl.mController ) { - const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::VerticalAlignment >( impl.mController->GetVerticalAlignment(), - VERTICAL_ALIGNMENT_STRING_TABLE, - VERTICAL_ALIGNMENT_STRING_TABLE_COUNT ); + const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() ); if( name ) { value = std::string( name ); diff --git a/dali-toolkit/internal/file.list b/dali-toolkit/internal/file.list index 77df72f..6622d01 100644 --- a/dali-toolkit/internal/file.list +++ b/dali-toolkit/internal/file.list @@ -121,6 +121,7 @@ toolkit_src_files = \ $(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-enumerations-impl.cpp \ $(toolkit_src_dir)/text/text-controller.cpp \ $(toolkit_src_dir)/text/text-controller-impl.cpp \ $(toolkit_src_dir)/text/text-effects-style.cpp \ diff --git a/dali-toolkit/internal/text/layouts/layout-alignment.h b/dali-toolkit/internal/text/layouts/layout-alignment.h deleted file mode 100644 index 339b321..0000000 --- a/dali-toolkit/internal/text/layouts/layout-alignment.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef DALI_TOOLKIT_TEXT_LAYOUT_ALIGNMENT_H -#define DALI_TOOLKIT_TEXT_LAYOUT_ALIGNMENT_H - -/* - * Copyright (c) 2017 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. - * - */ - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Text -{ - -namespace Layout -{ - -/** - * @brief Speficies the horizontal alignment. - * - * BEGIN is on the left for Left To Right languages whereas is right for Right To Left. - * Similarly, END is on the right for Left To Right languages and left for Right To Left. - */ -enum HorizontalAlignment -{ - HORIZONTAL_ALIGN_BEGIN, - HORIZONTAL_ALIGN_CENTER, - HORIZONTAL_ALIGN_END -}; - -/** - * @brief Speficies the vertical alignment. - */ -enum VerticalAlignment -{ - VERTICAL_ALIGN_TOP, - VERTICAL_ALIGN_CENTER, - VERTICAL_ALIGN_BOTTOM -}; - -enum AlignmentCount -{ - HORIZONTAL_ALIGN_COUNT = HORIZONTAL_ALIGN_END + 1, - VERTICAL_ALIGN_COUNT = VERTICAL_ALIGN_BOTTOM + 1 -}; - -} // namespace Layout - -} // namespace Text - -} // namespace Toolkit - -} // namespace Dali - -#endif // DALI_TOOLKIT_TEXT_LAYOUT_ALIGNMENT_H diff --git a/dali-toolkit/internal/text/layouts/layout-engine.cpp b/dali-toolkit/internal/text/layouts/layout-engine.cpp index 12f20e4..704c9ed 100644 --- a/dali-toolkit/internal/text/layouts/layout-engine.cpp +++ b/dali-toolkit/internal/text/layouts/layout-engine.cpp @@ -1078,7 +1078,7 @@ struct Engine::Impl void Align( const Size& size, CharacterIndex startIndex, Length numberOfCharacters, - HorizontalAlignment horizontalAlignment, + Text::HorizontalAlignment::Type horizontalAlignment, Vector& lines, float& alignmentOffset ) { @@ -1116,32 +1116,32 @@ struct Engine::Impl } void CalculateHorizontalAlignment( float boxWidth, - HorizontalAlignment horizontalAlignment, + HorizontalAlignment::Type horizontalAlignment, LineRun& line ) { line.alignmentOffset = 0.f; const bool isRTL = RTL == line.direction; float lineLength = line.width; - HorizontalAlignment alignment = horizontalAlignment; + HorizontalAlignment::Type alignment = horizontalAlignment; if( isRTL ) { // Swap the alignment type if the line is right to left. switch( alignment ) { - case HORIZONTAL_ALIGN_BEGIN: + case HorizontalAlignment::BEGIN: { - alignment = HORIZONTAL_ALIGN_END; + alignment = HorizontalAlignment::END; break; } - case HORIZONTAL_ALIGN_CENTER: + case HorizontalAlignment::CENTER: { // Nothing to do. break; } - case HORIZONTAL_ALIGN_END: + case HorizontalAlignment::END: { - alignment = HORIZONTAL_ALIGN_BEGIN; + alignment = HorizontalAlignment::BEGIN; break; } } @@ -1150,7 +1150,7 @@ struct Engine::Impl // Calculate the horizontal line offset. switch( alignment ) { - case HORIZONTAL_ALIGN_BEGIN: + case HorizontalAlignment::BEGIN: { line.alignmentOffset = 0.f; @@ -1161,7 +1161,7 @@ struct Engine::Impl } break; } - case HORIZONTAL_ALIGN_CENTER: + case HorizontalAlignment::CENTER: { line.alignmentOffset = 0.5f * ( boxWidth - lineLength ); @@ -1173,7 +1173,7 @@ struct Engine::Impl line.alignmentOffset = floorf( line.alignmentOffset ); // try to avoid pixel alignment. break; } - case HORIZONTAL_ALIGN_END: + case HorizontalAlignment::END: { if( isRTL ) { @@ -1272,7 +1272,7 @@ void Engine::ReLayoutRightToLeftLines( const Parameters& layoutParameters, void Engine::Align( const Size& size, CharacterIndex startIndex, Length numberOfCharacters, - Layout::HorizontalAlignment horizontalAlignment, + Text::HorizontalAlignment::Type horizontalAlignment, Vector& lines, float& alignmentOffset ) { diff --git a/dali-toolkit/internal/text/layouts/layout-engine.h b/dali-toolkit/internal/text/layouts/layout-engine.h index 0d1f7d4..66525d1 100644 --- a/dali-toolkit/internal/text/layouts/layout-engine.h +++ b/dali-toolkit/internal/text/layouts/layout-engine.h @@ -23,7 +23,7 @@ #include // INTERNAL INCLUDE -#include +#include #include #include @@ -144,7 +144,7 @@ public: void Align( const Size& size, CharacterIndex startIndex, Length numberOfCharacters, - Layout::HorizontalAlignment horizontalAlignment, + Text::HorizontalAlignment::Type horizontalAlignment, Vector& lines, float& alignmentOffset ); diff --git a/dali-toolkit/internal/text/layouts/layout-parameters.h b/dali-toolkit/internal/text/layouts/layout-parameters.h index fa33087..5deb666 100644 --- a/dali-toolkit/internal/text/layouts/layout-parameters.h +++ b/dali-toolkit/internal/text/layouts/layout-parameters.h @@ -22,6 +22,7 @@ #include // INTERNAL INCLUDES +#include #include #include @@ -72,7 +73,7 @@ struct Parameters const GlyphIndex* const charactersToGlyphsBuffer, const Length* const glyphsPerCharacterBuffer, Length totalNumberOfGlyphs, - HorizontalAlignment horizontalAlignment, + Text::HorizontalAlignment::Type horizontalAlignment, LineWrap::Mode lineWrapMode ) : boundingBox( boundingBox ), textBuffer( textBuffer ), @@ -111,7 +112,7 @@ struct Parameters GlyphIndex startGlyphIndex; ///< Index to the first glyph to layout. Length numberOfGlyphs; ///< The number of glyphs to layout. Length totalNumberOfGlyphs; ///< The number of glyphs. - HorizontalAlignment horizontalAlignment; ///< The horizontal alignment. + HorizontalAlignment::Type horizontalAlignment; ///< The horizontal alignment. LineIndex startLineIndex; ///< The line index where to insert the new lines. Length estimatedNumberOfLines; ///< The estimated number of lines. LineWrap::Mode lineWrapMode; ///< The line wrap mode for moving to next line. diff --git a/dali-toolkit/internal/text/rendering/text-typesetter.cpp b/dali-toolkit/internal/text/rendering/text-typesetter.cpp index c7d92c2..3184d4a 100755 --- a/dali-toolkit/internal/text/rendering/text-typesetter.cpp +++ b/dali-toolkit/internal/text/rendering/text-typesetter.cpp @@ -281,17 +281,17 @@ PixelData Typesetter::Render( const Vector2& size, RenderBehaviour behaviour, bo switch( mModel->GetVerticalAlignment() ) { - case Layout::VERTICAL_ALIGN_TOP: + case VerticalAlignment::TOP: { // No offset to add. break; } - case Layout::VERTICAL_ALIGN_CENTER: + case VerticalAlignment::CENTER: { penY = static_cast( 0.5f * ( size.height - layoutSize.height ) ); break; } - case Layout::VERTICAL_ALIGN_BOTTOM: + case VerticalAlignment::BOTTOM: { penY = static_cast( size.height - layoutSize.height ); break; diff --git a/dali-toolkit/internal/text/rendering/view-model.cpp b/dali-toolkit/internal/text/rendering/view-model.cpp index fe3c451..7c2d156 100755 --- a/dali-toolkit/internal/text/rendering/view-model.cpp +++ b/dali-toolkit/internal/text/rendering/view-model.cpp @@ -61,12 +61,12 @@ const Vector2& ViewModel::GetScrollPosition() const return mModel->GetScrollPosition(); } -Layout::HorizontalAlignment ViewModel::GetHorizontalAlignment() const +HorizontalAlignment::Type ViewModel::GetHorizontalAlignment() const { return mModel->GetHorizontalAlignment(); } -Layout::VerticalAlignment ViewModel::GetVerticalAlignment() const +VerticalAlignment::Type ViewModel::GetVerticalAlignment() const { return mModel->GetVerticalAlignment(); } diff --git a/dali-toolkit/internal/text/rendering/view-model.h b/dali-toolkit/internal/text/rendering/view-model.h index 827ecf0..c4e1ec0 100755 --- a/dali-toolkit/internal/text/rendering/view-model.h +++ b/dali-toolkit/internal/text/rendering/view-model.h @@ -22,6 +22,7 @@ #include // INTERNAL INCLUDES +#include #include namespace Dali @@ -74,12 +75,12 @@ public: /** * @copydoc ModelInterface::GetHorizontalAlignment() */ - virtual Layout::HorizontalAlignment GetHorizontalAlignment() const; + virtual Text::HorizontalAlignment::Type GetHorizontalAlignment() const; /** * @copydoc ModelInterface::GetVerticalAlignment() */ - virtual Layout::VerticalAlignment GetVerticalAlignment() const; + virtual Text::VerticalAlignment::Type GetVerticalAlignment() const; /** * @copydoc ModelInterface::IsTextElideEnabled() diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index 0101616..d859b42 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -2611,17 +2611,17 @@ void Controller::Impl::GetCursorPosition( CharacterIndex logical, switch( mModel->mHorizontalAlignment ) { - case Layout::HORIZONTAL_ALIGN_BEGIN: + case Text::HorizontalAlignment::BEGIN : { cursorInfo.primaryPosition.x = 0.f; break; } - case Layout::HORIZONTAL_ALIGN_CENTER: + case Text::HorizontalAlignment::CENTER: { cursorInfo.primaryPosition.x = floorf( 0.5f * mModel->mVisualModel->mControlSize.width ); break; } - case Layout::HORIZONTAL_ALIGN_END: + case Text::HorizontalAlignment::END: { cursorInfo.primaryPosition.x = mModel->mVisualModel->mControlSize.width - mEventData->mDecorator->GetCursorWidth(); break; diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 4137326..df15cad 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -356,7 +356,7 @@ bool Controller::IsMultiLineEnabled() const return Layout::Engine::MULTI_LINE_BOX == mImpl->mLayoutEngine.GetLayout(); } -void Controller::SetHorizontalAlignment( Layout::HorizontalAlignment alignment ) +void Controller::SetHorizontalAlignment( Text::HorizontalAlignment::Type alignment ) { if( alignment != mImpl->mModel->mHorizontalAlignment ) { @@ -370,12 +370,12 @@ void Controller::SetHorizontalAlignment( Layout::HorizontalAlignment alignment ) } } -Layout::HorizontalAlignment Controller::GetHorizontalAlignment() const +Text::HorizontalAlignment::Type Controller::GetHorizontalAlignment() const { return mImpl->mModel->mHorizontalAlignment; } -void Controller::SetVerticalAlignment( Layout::VerticalAlignment alignment ) +void Controller::SetVerticalAlignment( VerticalAlignment::Type alignment ) { if( alignment != mImpl->mModel->mVerticalAlignment ) { @@ -388,7 +388,7 @@ void Controller::SetVerticalAlignment( Layout::VerticalAlignment alignment ) } } -Layout::VerticalAlignment Controller::GetVerticalAlignment() const +VerticalAlignment::Type Controller::GetVerticalAlignment() const { return mImpl->mModel->mVerticalAlignment; } @@ -3460,17 +3460,17 @@ void Controller::CalculateVerticalOffset( const Size& controlSize ) switch( mImpl->mModel->mVerticalAlignment ) { - case Layout::VERTICAL_ALIGN_TOP: + case VerticalAlignment::TOP: { mImpl->mModel->mScrollPosition.y = 0.f; break; } - case Layout::VERTICAL_ALIGN_CENTER: + case VerticalAlignment::CENTER: { mImpl->mModel->mScrollPosition.y = floorf( 0.5f * ( controlSize.height - layoutSize.height ) ); // try to avoid pixel alignment. break; } - case Layout::VERTICAL_ALIGN_BOTTOM: + case VerticalAlignment::BOTTOM: { mImpl->mModel->mScrollPosition.y = controlSize.height - layoutSize.height; break; diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h index fc75596..6b7505d 100755 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -23,6 +23,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -30,7 +31,6 @@ #include #include - namespace Dali { @@ -325,24 +325,24 @@ public: // Configure the text controller. * * @param[in] alignment The horizontal alignment. */ - void SetHorizontalAlignment( Layout::HorizontalAlignment alignment ); + void SetHorizontalAlignment( HorizontalAlignment::Type alignment ); /** * @copydoc ModelInterface::GetHorizontalAlignment() */ - Layout::HorizontalAlignment GetHorizontalAlignment() const; + HorizontalAlignment::Type GetHorizontalAlignment() const; /** * @brief Sets the text's vertical alignment. * * @param[in] alignment The vertical alignment. */ - void SetVerticalAlignment( Layout::VerticalAlignment alignment ); + void SetVerticalAlignment( VerticalAlignment::Type alignment ); /** * @copydoc ModelInterface::GetVerticalAlignment() */ - Layout::VerticalAlignment GetVerticalAlignment() const; + VerticalAlignment::Type GetVerticalAlignment() const; /** * @brief Sets the text's wrap mode diff --git a/dali-toolkit/internal/text/text-enumerations-impl.cpp b/dali-toolkit/internal/text/text-enumerations-impl.cpp new file mode 100644 index 0000000..8dc3eb8 --- /dev/null +++ b/dali-toolkit/internal/text/text-enumerations-impl.cpp @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2017 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. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Text +{ + +namespace +{ +DALI_ENUM_TO_STRING_TABLE_BEGIN( HORIZONTAL_ALIGNMENT_TYPE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::HorizontalAlignment::Type, BEGIN ) +DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::HorizontalAlignment::Type, CENTER ) +DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::HorizontalAlignment::Type, END ) +DALI_ENUM_TO_STRING_TABLE_END( HORIZONTAL_ALIGNMENT_TYPE ) + +DALI_ENUM_TO_STRING_TABLE_BEGIN( VERTICAL_ALIGNMENT_TYPE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::VerticalAlignment::Type, TOP ) +DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::VerticalAlignment::Type, CENTER ) +DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::VerticalAlignment::Type, BOTTOM ) +DALI_ENUM_TO_STRING_TABLE_END( VERTICAL_ALIGNMENT_TYPE ) + +} // namespace + +bool GetHorizontalAlignmentEnum( const Property::Value& propertyValue, Toolkit::Text::HorizontalAlignment::Type& alignment ) +{ + return Scripting::GetEnumerationProperty( propertyValue, HORIZONTAL_ALIGNMENT_TYPE_TABLE, HORIZONTAL_ALIGNMENT_TYPE_TABLE_COUNT, alignment ); +} + +bool GetVerticalAlignmentEnum( const Property::Value& propertyValue, Toolkit::Text::VerticalAlignment::Type& alignment ) +{ + return Scripting::GetEnumerationProperty( propertyValue, VERTICAL_ALIGNMENT_TYPE_TABLE, VERTICAL_ALIGNMENT_TYPE_TABLE_COUNT, alignment ); +} + +const char* GetHorizontalAlignmentString( const Toolkit::Text::HorizontalAlignment::Type& alignment ) +{ + return Scripting::GetLinearEnumerationName< Toolkit::Text::HorizontalAlignment::Type >( alignment, + HORIZONTAL_ALIGNMENT_TYPE_TABLE, + HORIZONTAL_ALIGNMENT_TYPE_TABLE_COUNT ); + +} + +const char* GetVerticalAlignmentString( const Toolkit::Text::VerticalAlignment::Type& alignment ) +{ + return Scripting::GetLinearEnumerationName< Toolkit::Text::VerticalAlignment::Type >( alignment, + VERTICAL_ALIGNMENT_TYPE_TABLE, + VERTICAL_ALIGNMENT_TYPE_TABLE_COUNT ); +} + + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali diff --git a/dali-toolkit/internal/text/text-enumerations-impl.h b/dali-toolkit/internal/text/text-enumerations-impl.h new file mode 100644 index 0000000..2462bc7 --- /dev/null +++ b/dali-toolkit/internal/text/text-enumerations-impl.h @@ -0,0 +1,73 @@ +#ifndef DALI_TOOLKIT_TEXT_ENUMERATION_IMPL_H +#define DALI_TOOLKIT_TEXT_ENUMERATION_IMPL_H + +/* + * Copyright (c) 2017 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 + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Text +{ + +/** + * @brief Get the alignment from the provided property value. + * @param[in] propertyValue the source value + * @param[out] alignment the resulting alignment from the given source + * @return true if the resulting alignment has been updated + */ +bool GetHorizontalAlignmentEnum( const Property::Value& propertyValue, Toolkit::Text::HorizontalAlignment::Type& alignment ); + +/** + * @brief Get the alignment from the provided property value. + * @param[in] propertyValue the source value + * @param[out] alignment the resulting alignment from the given source + * @return true if the resulting alignment has been updated + */ +bool GetVerticalAlignmentEnum( const Property::Value& propertyValue, Toolkit::Text::VerticalAlignment::Type& alignment ); + +/** + * @brief Get the alignment string from the provided alignment string. + * @param[in] alignment the Text::Horizontal enum source + * @return the string equivalent + */ +const char* GetHorizontalAlignmentString( const Toolkit::Text::HorizontalAlignment::Type& alignment ); + +/** + * @brief Get the alignment string from the provided alignment string. + * @param[in] alignment the Text::VerticalAlignment enum source + * @return the string equivalent + */ +const char* GetVerticalAlignmentString( const Toolkit::Text::VerticalAlignment::Type& alignment ); + + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali + +#endif // DALI_TOOLKIT_TEXT_ENUMERATION_IMPL_H diff --git a/dali-toolkit/internal/text/text-model-interface.h b/dali-toolkit/internal/text/text-model-interface.h index 18cb7cc..eca061a 100755 --- a/dali-toolkit/internal/text/text-model-interface.h +++ b/dali-toolkit/internal/text/text-model-interface.h @@ -22,7 +22,7 @@ #include // INTERNAL INCLUDES -#include +#include #include #include #include @@ -74,14 +74,14 @@ public: * * @return The horizontal alignment. */ - virtual Layout::HorizontalAlignment GetHorizontalAlignment() const = 0; + virtual HorizontalAlignment::Type GetHorizontalAlignment() const = 0; /** * @brief Retrieves the text's vertical alignment. * * @return The vertical alignment. */ - virtual Layout::VerticalAlignment GetVerticalAlignment() const = 0; + virtual VerticalAlignment::Type GetVerticalAlignment() const = 0; /** * @brief Whether the text elide property is enabled. diff --git a/dali-toolkit/internal/text/text-model.cpp b/dali-toolkit/internal/text/text-model.cpp index cf6f35c..b31810a 100755 --- a/dali-toolkit/internal/text/text-model.cpp +++ b/dali-toolkit/internal/text/text-model.cpp @@ -47,12 +47,12 @@ const Vector2& Model::GetScrollPosition() const return mScrollPosition; } -Layout::HorizontalAlignment Model::GetHorizontalAlignment() const +HorizontalAlignment::Type Model::GetHorizontalAlignment() const { return mHorizontalAlignment; } -Layout::VerticalAlignment Model::GetVerticalAlignment() const +VerticalAlignment::Type Model::GetVerticalAlignment() const { return mVerticalAlignment; } @@ -162,8 +162,8 @@ Model::Model() mVisualModel(), mScrollPosition(), mScrollPositionLast(), - mHorizontalAlignment( Layout::HORIZONTAL_ALIGN_BEGIN ), - mVerticalAlignment( Layout::VERTICAL_ALIGN_TOP ), + mHorizontalAlignment( HorizontalAlignment::BEGIN ), + mVerticalAlignment( VerticalAlignment::TOP ), mLineWrapMode( Layout::LineWrap::WORD ), mAlignmentOffset( 0.0f ), mElideEnabled( false ) diff --git a/dali-toolkit/internal/text/text-model.h b/dali-toolkit/internal/text/text-model.h index cd49581..d4da2bc 100755 --- a/dali-toolkit/internal/text/text-model.h +++ b/dali-toolkit/internal/text/text-model.h @@ -22,7 +22,7 @@ #include // INTERNAL INCLUDES -#include +#include #include #include #include @@ -77,12 +77,12 @@ public: /** * @copydoc ModelInterface::GetHorizontalAlignment() */ - virtual Layout::HorizontalAlignment GetHorizontalAlignment() const; + virtual HorizontalAlignment::Type GetHorizontalAlignment() const; /** * @copydoc ModelInterface::GetVerticalAlignment() */ - virtual Layout::VerticalAlignment GetVerticalAlignment() const; + virtual VerticalAlignment::Type GetVerticalAlignment() const; /** * @copydoc ModelInterface::IsTextElideEnabled() @@ -211,13 +211,13 @@ public: * 0,0 means that the top-left corner of the layout matches the top-left corner of the UI control. * Typically this will have a negative value with scrolling occurs. */ - Vector2 mScrollPosition; ///< The text is offset by this position when scrolling. - Vector2 mScrollPositionLast; ///< The last offset value of mScrollPosition - Layout::HorizontalAlignment mHorizontalAlignment; ///< The layout's horizontal alignment. - Layout::VerticalAlignment mVerticalAlignment; ///< The layout's vertical alignment. - Layout::LineWrap::Mode mLineWrapMode; ///< The text wrap mode - float mAlignmentOffset; ///< The alignment offset. - bool mElideEnabled:1; ///< Whether the text's elide is enabled. + Vector2 mScrollPosition; ///< The text is offset by this position when scrolling. + Vector2 mScrollPositionLast; ///< The last offset value of mScrollPosition + HorizontalAlignment::Type mHorizontalAlignment; ///< The layout's horizontal alignment. + VerticalAlignment::Type mVerticalAlignment; ///< The layout's vertical alignment. + Layout::LineWrap::Mode mLineWrapMode; ///< The text wrap mode + float mAlignmentOffset; ///< The alignment offset. + bool mElideEnabled:1; ///< Whether the text's elide is enabled. }; } // namespace Text diff --git a/dali-toolkit/internal/text/text-scroller.cpp b/dali-toolkit/internal/text/text-scroller.cpp index f235ce8..ae65fd2 100644 --- a/dali-toolkit/internal/text/text-scroller.cpp +++ b/dali-toolkit/internal/text/text-scroller.cpp @@ -104,24 +104,24 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( * * -0.5f aligns the text to the left, 0.0f aligns the text to the center, 0.5f aligns the text to the right. * The final alignment depends on two factors: - * 1) The alignment value of the text label (Use Text::Layout::HorizontalAlignment enumerations). + * 1) The alignment value of the text label (Use Text::HorizontalAlignment enumerations). * 2) The text direction, i.e. whether it's LTR or RTL (0 = LTR, 1 = RTL). */ -const float HORIZONTAL_ALIGNMENT_TABLE[ Text::Layout::HORIZONTAL_ALIGN_COUNT ][ 2 ] = +const float HORIZONTAL_ALIGNMENT_TABLE[ Text::HorizontalAlignment::END+1 ][ 2 ] = { - // HORIZONTAL_ALIGN_BEGIN + // HorizontalAlignment::BEGIN { -0.5f, // LTR 0.5f // RTL }, - // HORIZONTAL_ALIGN_CENTER + // HorizontalAlignment::CENTER { 0.0f, // LTR 0.0f // RTL }, - // HORIZONTAL_ALIGN_END + // HorizontalAlignment::END { 0.5f, // LTR -0.5f // RTL @@ -132,13 +132,13 @@ const float HORIZONTAL_ALIGNMENT_TABLE[ Text::Layout::HORIZONTAL_ALIGN_COUNT ][ * @brief How the text should be aligned vertically when scrolling the text. * * -0.5f aligns the text to the top, 0.0f aligns the text to the center, 0.5f aligns the text to the bottom. - * The alignment depends on the alignment value of the text label (Use Text::Layout::VerticalAlignment enumerations). + * The alignment depends on the alignment value of the text label (Use Text::VerticalAlignment enumerations). */ -const float VERTICAL_ALIGNMENT_TABLE[ Text::Layout::VERTICAL_ALIGN_COUNT ] = +const float VERTICAL_ALIGNMENT_TABLE[ Text::VerticalAlignment::BOTTOM+1 ] = { - -0.5f, // VERTICAL_ALIGN_TOP - 0.0f, // VERTICAL_ALIGN_CENTER - 0.5f // VERTICAL_ALIGN_BOTTOM + -0.5f, // VerticalAlignment::TOP + 0.0f, // VerticalAlignment::CENTER + 0.5f // VerticalAlignment::BOTTOM }; } // namespace @@ -252,7 +252,7 @@ TextScroller::~TextScroller() { } -void TextScroller::SetParameters( Actor scrollingTextActor, Renderer renderer, TextureSet textureSet, const Size& controlSize, const Size& textNaturalSize, CharacterDirection direction, Layout::HorizontalAlignment horizontalAlignment, Layout::VerticalAlignment verticalAlignment ) +void TextScroller::SetParameters( Actor scrollingTextActor, Renderer renderer, TextureSet textureSet, const Size& controlSize, const Size& textNaturalSize, CharacterDirection direction, HorizontalAlignment::Type horizontalAlignment, VerticalAlignment::Type verticalAlignment ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters controlSize[%f,%f] offscreenSize[%f,%f] direction[%d]\n", controlSize.x, controlSize.y, textNaturalSize.x, textNaturalSize.y, direction ); diff --git a/dali-toolkit/internal/text/text-scroller.h b/dali-toolkit/internal/text/text-scroller.h index daf2587..f2203a7 100644 --- a/dali-toolkit/internal/text/text-scroller.h +++ b/dali-toolkit/internal/text/text-scroller.h @@ -25,9 +25,9 @@ #include // INTERNAL INCLUDES +#include #include #include -#include namespace Dali { @@ -70,7 +70,7 @@ public: * @param[in] horizontalAlignment horizontal alignment of the text * @param[in] verticalAlignment vertical alignment of the text */ - void SetParameters( Actor scrollingTextActor, Dali::Renderer renderer, TextureSet textureSet, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, Layout::HorizontalAlignment horizontalAlignment, Layout::VerticalAlignment verticalAlignment ); + void SetParameters( Actor scrollingTextActor, Dali::Renderer renderer, TextureSet textureSet, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, HorizontalAlignment::Type horizontalAlignment, VerticalAlignment::Type verticalAlignment ); /** * @brief Set the gap distance to elapse before the text wraps around diff --git a/dali-toolkit/internal/visuals/text/text-visual.cpp b/dali-toolkit/internal/visuals/text/text-visual.cpp index 05fbf0d..360b9c1 100755 --- a/dali-toolkit/internal/visuals/text/text-visual.cpp +++ b/dali-toolkit/internal/visuals/text/text-visual.cpp @@ -33,6 +33,7 @@ #include #include #include +#include namespace Dali { @@ -58,50 +59,8 @@ const char * const ENABLE_MARKUP_PROPERTY( "enableMarkup" ); const char * const SHADOW_PROPERTY( "shadow" ); const char * const UNDERLINE_PROPERTY( "underline" ); -const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] = -{ - { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN }, - { "CENTER", Toolkit::Text::Layout::HORIZONTAL_ALIGN_CENTER }, - { "END", Toolkit::Text::Layout::HORIZONTAL_ALIGN_END }, -}; -const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] ); - -const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] = -{ - { "TOP", Toolkit::Text::Layout::VERTICAL_ALIGN_TOP }, - { "CENTER", Toolkit::Text::Layout::VERTICAL_ALIGN_CENTER }, - { "BOTTOM", Toolkit::Text::Layout::VERTICAL_ALIGN_BOTTOM }, -}; -const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] ); - const Vector4 FULL_TEXTURE_RECT( 0.f, 0.f, 1.f, 1.f ); -std::string GetHorizontalAlignment( Toolkit::Text::Layout::HorizontalAlignment alignment ) -{ - const char* name = Scripting::GetEnumerationName( alignment, - HORIZONTAL_ALIGNMENT_STRING_TABLE, - HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT ); - - if( name ) - { - return std::string( name ); - } - return std::string(); -} - -std::string GetVerticalAlignment( Toolkit::Text::Layout::VerticalAlignment alignment ) -{ - const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::VerticalAlignment >( alignment, - VERTICAL_ALIGNMENT_STRING_TABLE, - VERTICAL_ALIGNMENT_STRING_TABLE_COUNT ); - - if( name ) - { - return std::string( name ); - } - return std::string(); -} - const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( attribute mediump vec2 aPosition;\n uniform mediump mat4 uMvpMatrix;\n @@ -397,9 +356,9 @@ void TextVisual::DoCreatePropertyMap( Property::Map& map ) const map.Insert( Toolkit::TextVisual::Property::MULTI_LINE, mController->IsMultiLineEnabled() ); - map.Insert( Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT, GetHorizontalAlignment( mController->GetHorizontalAlignment() ) ); + map.Insert( Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT, mController->GetHorizontalAlignment() ); - map.Insert( Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT, GetVerticalAlignment( mController->GetVerticalAlignment() ) ); + map.Insert( Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT, mController->GetVerticalAlignment() ); map.Insert( Toolkit::TextVisual::Property::TEXT_COLOR, mController->GetDefaultColor() ); @@ -554,26 +513,18 @@ void TextVisual::DoSetProperty( Dali::Property::Index index, const Dali::Propert } case Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT: { - Toolkit::Text::Layout::HorizontalAlignment alignment( Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN ); - if( Scripting::GetEnumeration< Toolkit::Text::Layout::HorizontalAlignment >( propertyValue.Get< std::string >().c_str(), - HORIZONTAL_ALIGNMENT_STRING_TABLE, - HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT, - alignment ) ) - { - mController->SetHorizontalAlignment( alignment ); - } + Text::HorizontalAlignment::Type alignment( Toolkit::Text::HorizontalAlignment::BEGIN ); + Toolkit::Text::GetHorizontalAlignmentEnum( propertyValue, alignment ); + + mController->SetHorizontalAlignment( alignment ); break; } case Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT: { - Toolkit::Text::Layout::VerticalAlignment alignment( Toolkit::Text::Layout::VERTICAL_ALIGN_BOTTOM ); - if( Scripting::GetEnumeration< Toolkit::Text::Layout::VerticalAlignment >( propertyValue.Get< std::string >().c_str(), - VERTICAL_ALIGNMENT_STRING_TABLE, - VERTICAL_ALIGNMENT_STRING_TABLE_COUNT, - alignment ) ) - { - mController->SetVerticalAlignment( alignment ); - } + Text::VerticalAlignment::Type alignment( Toolkit::Text::VerticalAlignment::BOTTOM ); + Toolkit::Text::GetVerticalAlignmentEnum( propertyValue, alignment); + + mController->SetVerticalAlignment( alignment ); break; } case Toolkit::TextVisual::Property::TEXT_COLOR: diff --git a/dali-toolkit/public-api/controls/text-controls/text-editor.h b/dali-toolkit/public-api/controls/text-controls/text-editor.h index 659e339..0d20794 100644 --- a/dali-toolkit/public-api/controls/text-controls/text-editor.h +++ b/dali-toolkit/public-api/controls/text-controls/text-editor.h @@ -117,8 +117,9 @@ public: /** * @brief The text horizontal alignment. - * @details Name "horizontalAlignment", type Property::STRING. + * @details Name "horizontalAlignment", type Property::STRING or type HorizontalAlignment::Type (Property::INTEGER) * Values "BEGIN" "CENTER" "END". + * @note Return type is Property::STRING * @SINCE_1_1.37 */ HORIZONTAL_ALIGNMENT, diff --git a/dali-toolkit/public-api/controls/text-controls/text-field.h b/dali-toolkit/public-api/controls/text-controls/text-field.h index 48e0ef5..1fb34e0 100644 --- a/dali-toolkit/public-api/controls/text-controls/text-field.h +++ b/dali-toolkit/public-api/controls/text-controls/text-field.h @@ -138,16 +138,18 @@ public: /** * @brief The line horizontal alignment. - * @details Name "horizontalAlignment", type Property::STRING. + * @details Name "horizontalAlignment", type Property::STRING or type HorizontalAlignment::Type (Property::INTEGER) * Values "BEGIN", "CENTER", "END". + * @note Return type is Property::STRING * @SINCE_1_0.0 */ HORIZONTAL_ALIGNMENT, /** * @brief The line vertical alignment. - * @details Name "verticalAlignment", type Property::STRING. + * @details Name "verticalAlignment", type Property::STRING type VerticalAlignment::Type (Property::INTEGER) * Values "TOP", "CENTER", "BOTTOM". + * @note Return type is Property::STRING * @SINCE_1_0.0 */ VERTICAL_ALIGNMENT, diff --git a/dali-toolkit/public-api/controls/text-controls/text-label.h b/dali-toolkit/public-api/controls/text-controls/text-label.h index 0de1b01..7aa8634 100644 --- a/dali-toolkit/public-api/controls/text-controls/text-label.h +++ b/dali-toolkit/public-api/controls/text-controls/text-label.h @@ -144,16 +144,18 @@ public: /** * @brief The line horizontal alignment. - * @details Name "horizontalAlignment", type Property::STRING + * @details Name "horizontalAlignment", type Property::STRING or type HorizontalAlignment::Type (Property::INTEGER) * Values "BEGIN", "CENTER", "END", default BEGIN. + * @note Return type is Property::STRING * @SINCE_1_0.0 */ HORIZONTAL_ALIGNMENT, /** * @brief The line vertical alignment. - * @details Name "verticalAlignment", type Property::STRING. + * @details Name "verticalAlignment", type Property::STRING or type VerticalAlignment::Type (Property::INTEGER). * Values "TOP", "CENTER", "BOTTOM" @SINCE_1_0.0, default TOP. + * @note Return type is Property::STRING * @SINCE_1_0.0 */ VERTICAL_ALIGNMENT, diff --git a/dali-toolkit/public-api/file.list b/dali-toolkit/public-api/file.list index e695d21..f29325b 100755 --- a/dali-toolkit/public-api/file.list +++ b/dali-toolkit/public-api/file.list @@ -114,8 +114,9 @@ public_api_accessibility_manager_header_files = \ public_api_focus_manager_header_files = \ $(public_api_src_dir)/focus-manager/keyboard-focus-manager.h -public_api_rendering_backend_header_files = \ - $(public_api_src_dir)/text/rendering-backend.h +public_api_text_header_files = \ + $(public_api_src_dir)/text/rendering-backend.h \ + $(public_api_src_dir)/text/text-enumerations.h public_api_video_view_header_files = \ $(public_api_src_dir)/controls/video-view/video-view.h diff --git a/dali-toolkit/public-api/text/text-enumerations.h b/dali-toolkit/public-api/text/text-enumerations.h new file mode 100644 index 0000000..9d9dff2 --- /dev/null +++ b/dali-toolkit/public-api/text/text-enumerations.h @@ -0,0 +1,83 @@ +#ifndef DALI_TOOLKIT_TEXT_ENUMERATIONS_H +#define DALI_TOOLKIT_TEXT_ENUMERATIONS_H + +/* + * Copyright (c) 2017 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. + * + */ + +namespace Dali +{ + +namespace Toolkit +{ + +/** + * @addtogroup dali_toolkit_controls + * @{ + */ + +namespace Text +{ + +/** + * @brief The available Horizontal alignments for text + * @SINCE_1_2.60 + */ +namespace HorizontalAlignment +{ + /** + * @brief Enumerations for Horizontal alignment + * + * @SINCE_1_2.60 + */ + enum Type + { + BEGIN, ///< @SINCE_1_2.60 + CENTER, ///< @SINCE_1_2.60 + END ///< @SINCE_1_2.60 + }; +} + +/** + * @brief The available Vertical alignments for text + * @SINCE_1_2.60 + */ +namespace VerticalAlignment +{ + /** + * @brief Enumerations for Vertical alignment + * + * @SINCE_1_2.60 + */ + enum Type + { + TOP, ///< @SINCE_1_2.60 + CENTER, ///< @SINCE_1_2.60 + BOTTOM ///< @SINCE_1_2.60 + }; +} + +} // Text + +/** + * @} + */ + +} // Toolkit + +} // Dali + +#endif //DALI_TOOLKIT_TEXT_ENUMERATIONS_H diff --git a/dali-toolkit/public-api/visuals/text-visual-properties.h b/dali-toolkit/public-api/visuals/text-visual-properties.h index 6399efc..10c4ab7 100644 --- a/dali-toolkit/public-api/visuals/text-visual-properties.h +++ b/dali-toolkit/public-api/visuals/text-visual-properties.h @@ -80,14 +80,18 @@ enum /** * @brief The line horizontal alignment. - * @details name "horizontalAlignment", type Property::STRING, values "BEGIN", "CENTER", "END", default BEGIN. + * @details Name "horizontalAlignment", type HorizontalAlignment::Type (Property::INTEGER) or Property::STRING. + * @note Optional. If not specified, the default is HorizontalAlignment::BEGIN + * @note Return type is HorizontalAlignment::Type (Property::INTEGER) * @SINCE_1_2.60 */ HORIZONTAL_ALIGNMENT, /** * @brief The line vertical alignment. - * @details name "verticalAlignment", type Property::STRING, values "TOP", "CENTER", "BOTTOM", default TOP. + * @details name "verticalAlignment", VerticalAlignment::Type (Property::INTEGER) or Property::STRING + * @note Optional. If not specified, the default is VerticalAlignment::TOP + * @note Return type is VerticalAlignment::Type (Property::INTEGER)` * @SINCE_1_2.60 */ VERTICAL_ALIGNMENT, -- 2.7.4