Text Alignment Enums now public 97/153897/12
authorAgnelo Vaz <agnelo.vaz@samsung.com>
Mon, 2 Oct 2017 19:08:05 +0000 (20:08 +0100)
committerDavid Steele <david.steele@samsung.com>
Thu, 5 Oct 2017 18:02:16 +0000 (19:02 +0100)
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

35 files changed:
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Typesetter.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-ViewModel.cpp
automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
build/tizen/dali-toolkit/Makefile.am
dali-toolkit/dali-toolkit.h
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/file.list
dali-toolkit/internal/text/layouts/layout-alignment.h [deleted file]
dali-toolkit/internal/text/layouts/layout-engine.cpp
dali-toolkit/internal/text/layouts/layout-engine.h
dali-toolkit/internal/text/layouts/layout-parameters.h
dali-toolkit/internal/text/rendering/text-typesetter.cpp
dali-toolkit/internal/text/rendering/view-model.cpp
dali-toolkit/internal/text/rendering/view-model.h
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/internal/text/text-enumerations-impl.cpp [new file with mode: 0644]
dali-toolkit/internal/text/text-enumerations-impl.h [new file with mode: 0644]
dali-toolkit/internal/text/text-model-interface.h
dali-toolkit/internal/text/text-model.cpp
dali-toolkit/internal/text/text-model.h
dali-toolkit/internal/text/text-scroller.cpp
dali-toolkit/internal/text/text-scroller.h
dali-toolkit/internal/visuals/text/text-visual.cpp
dali-toolkit/public-api/controls/text-controls/text-editor.h
dali-toolkit/public-api/controls/text-controls/text-field.h
dali-toolkit/public-api/controls/text-controls/text-label.h
dali-toolkit/public-api/file.list
dali-toolkit/public-api/text/text-enumerations.h [new file with mode: 0644]
dali-toolkit/public-api/visuals/text-visual-properties.h

index 43fc5ac..3758b47 100644 (file)
@@ -281,7 +281,7 @@ void CreateTextModel( const std::string& text,
                                        charactersToGlyph.Begin(),
                                        glyphsPerCharacter.Begin(),
                                        numberOfGlyphs,
                                        charactersToGlyph.Begin(),
                                        glyphsPerCharacter.Begin(),
                                        numberOfGlyphs,
-                                       Layout::HORIZONTAL_ALIGN_BEGIN,
+                                       Text::HorizontalAlignment::BEGIN,
                                        Layout::LineWrap::WORD );
 
   Vector<LineRun>& lines = visualModel->mLines;
                                        Layout::LineWrap::WORD );
 
   Vector<LineRun>& lines = visualModel->mLines;
@@ -339,7 +339,7 @@ void CreateTextModel( const std::string& text,
     layoutEngine.Align( textArea,
                         0u,
                         numberOfCharacters,
     layoutEngine.Align( textArea,
                         0u,
                         numberOfCharacters,
-                        Layout::HORIZONTAL_ALIGN_BEGIN,
+                        Text::HorizontalAlignment::BEGIN,
                         lines,
                         alignmentOffset );
   }
                         lines,
                         alignmentOffset );
   }
index 3f6a9a6..50090ee 100644 (file)
@@ -169,7 +169,7 @@ bool LayoutTextTest( const LayoutTextData& data )
                                        visualModel->mCharactersToGlyph.Begin(),
                                        visualModel->mGlyphsPerCharacter.Begin(),
                                        totalNumberOfGlyphs,
                                        visualModel->mCharactersToGlyph.Begin(),
                                        visualModel->mGlyphsPerCharacter.Begin(),
                                        totalNumberOfGlyphs,
-                                       Layout::HORIZONTAL_ALIGN_BEGIN,
+                                       Text::HorizontalAlignment::BEGIN,
                                        Layout::LineWrap::WORD );
 
   layoutParameters.isLastNewParagraph = isLastNewParagraph;
                                        Layout::LineWrap::WORD );
 
   layoutParameters.isLastNewParagraph = isLastNewParagraph;
@@ -385,7 +385,7 @@ bool ReLayoutRightToLeftLinesTest( const ReLayoutRightToLeftLinesData& data )
                                        visualModel->mCharactersToGlyph.Begin(),
                                        visualModel->mGlyphsPerCharacter.Begin(),
                                        visualModel->mGlyphs.Count(),
                                        visualModel->mCharactersToGlyph.Begin(),
                                        visualModel->mGlyphsPerCharacter.Begin(),
                                        visualModel->mGlyphs.Count(),
-                                       Layout::HORIZONTAL_ALIGN_BEGIN,
+                                       Text::HorizontalAlignment::BEGIN,
                                        Layout::LineWrap::WORD );
 
   layoutParameters.numberOfBidirectionalInfoRuns = logicalModel->mBidirectionalLineInfo.Count();
                                        Layout::LineWrap::WORD );
 
   layoutParameters.numberOfBidirectionalInfoRuns = logicalModel->mBidirectionalLineInfo.Count();
@@ -428,17 +428,17 @@ bool ReLayoutRightToLeftLinesTest( const ReLayoutRightToLeftLinesData& data )
 
 struct AlignData
 {
 
 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 )
 };
 
 bool AlignTest( const AlignData& data )
@@ -4141,8 +4141,8 @@ int UtcDaliTextAlign01(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_BEGIN,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::BEGIN,
+    Text::VerticalAlignment::TOP,
     0u,
     22u,
     6u,
     0u,
     22u,
     6u,
@@ -4260,8 +4260,8 @@ int UtcDaliTextAlign02(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_BEGIN,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::BEGIN,
+    Text::VerticalAlignment::TOP,
     22u,
     26u,
     6u,
     22u,
     26u,
     6u,
@@ -4379,8 +4379,8 @@ int UtcDaliTextAlign03(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_BEGIN,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::BEGIN,
+    Text::VerticalAlignment::TOP,
     48u,
     26u,
     6u,
     48u,
     26u,
     6u,
@@ -4498,8 +4498,8 @@ int UtcDaliTextAlign04(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_CENTER,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::CENTER,
+    Text::VerticalAlignment::TOP,
     0u,
     22u,
     6u,
     0u,
     22u,
     6u,
@@ -4617,8 +4617,8 @@ int UtcDaliTextAlign05(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_CENTER,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::CENTER,
+    Text::VerticalAlignment::TOP,
     22u,
     26u,
     6u,
     22u,
     26u,
     6u,
@@ -4736,8 +4736,8 @@ int UtcDaliTextAlign06(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_CENTER,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::CENTER,
+    Text::VerticalAlignment::TOP,
     48u,
     26u,
     6u,
     48u,
     26u,
     6u,
@@ -4855,8 +4855,8 @@ int UtcDaliTextAlign07(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_END,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::END,
+    Text::VerticalAlignment::TOP,
     0u,
     22u,
     6u,
     0u,
     22u,
     6u,
@@ -4974,8 +4974,8 @@ int UtcDaliTextAlign08(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_END,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::END,
+    Text::VerticalAlignment::TOP,
     22u,
     26u,
     6u,
     22u,
     26u,
     6u,
@@ -5093,8 +5093,8 @@ int UtcDaliTextAlign09(void)
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
     textArea,
     6u,
     fontDescriptionRuns.Begin(),
-    Layout::HORIZONTAL_ALIGN_END,
-    Layout::VERTICAL_ALIGN_TOP,
+    Text::HorizontalAlignment::END,
+    Text::VerticalAlignment::TOP,
     48u,
     26u,
     6u,
     48u,
     26u,
     6u,
index e742a9e..50ca75d 100644 (file)
@@ -116,7 +116,7 @@ int UtcDaliTextRenderingControllerRender(void)
   DALI_TEST_EQUALS( Pixel::RGBA8888, bitmap.GetPixelFormat(), TEST_LOCATION );
 
   // Changes vertical alignment.
   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.
   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 );
 
   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.
   controller->Relayout( relayoutSize );
 
   // Renders the text and creates the final bitmap.
index 422e6ac..13595ab 100644 (file)
@@ -307,14 +307,14 @@ int UtcDaliTextViewModelGetAlignment(void)
   ViewModel* model = typesetter->GetViewModel();
   DALI_TEST_CHECK( NULL != model );
 
   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;
 
   tet_result(TET_PASS);
   END_TEST;
index fbc55d2..e64a216 100644 (file)
@@ -1055,13 +1055,13 @@ int UtcDaliVisualGetPropertyMap10(void)
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK( value->Get<bool>() );
 
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK( value->Get<bool>() );
 
-  value = resultMap.Find( TextVisual::Property::HORIZONTAL_ALIGNMENT, Property::STRING );
+  value = resultMap.Find( TextVisual::Property::HORIZONTAL_ALIGNMENT, Property::INTEGER );
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK( value );
-  DALI_TEST_EQUALS( value->Get<std::string>(), "CENTER", TEST_LOCATION );
+  DALI_TEST_EQUALS( value->Get<int>(), (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_CHECK( value );
-  DALI_TEST_EQUALS( value->Get<std::string>(), "CENTER", TEST_LOCATION );
+  DALI_TEST_EQUALS( value->Get<int>(), (int)Text::VerticalAlignment::CENTER, TEST_LOCATION );
 
   value = resultMap.Find( TextVisual::Property::TEXT_COLOR, Property::VECTOR4 );
   DALI_TEST_CHECK( value );
 
   value = resultMap.Find( TextVisual::Property::TEXT_COLOR, Property::VECTOR4 );
   DALI_TEST_CHECK( value );
index 4fbd30a..35534a0 100644 (file)
@@ -202,7 +202,7 @@ publicapistylingdir =              $(publicapidir)/styling
 publicapitableviewdir =            $(publicapicontrolsdir)/table-view
 publicapitextcontrolsdir =         $(publicapicontrolsdir)/text-controls
 publicapifocusmanagerdir =         $(publicapidir)/focus-manager
 publicapitableviewdir =            $(publicapicontrolsdir)/table-view
 publicapitextcontrolsdir =         $(publicapicontrolsdir)/text-controls
 publicapifocusmanagerdir =         $(publicapidir)/focus-manager
-publicapirenderingbackenddir =     $(publicapidir)/text
+publicapitextdir =                 $(publicapidir)/text
 publicapisliderdir =               $(publicapicontrolsdir)/slider
 publicapivisualsdir =              $(publicapidir)/visuals
 
 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)
 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)
 
 publicapislider_HEADERS =               $(public_api_slider_header_files)
 publicapivisuals_HEADERS =              $(public_api_visuals_header_files)
 
index bc1ffa2..6e8cc5e 100644 (file)
@@ -61,6 +61,7 @@
 #include <dali-toolkit/public-api/styling/style-manager.h>
 
 #include <dali-toolkit/public-api/text/rendering-backend.h>
 #include <dali-toolkit/public-api/styling/style-manager.h>
 
 #include <dali-toolkit/public-api/text/rendering-backend.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
 
 #include <dali-toolkit/public-api/visuals/border-visual-properties.h>
 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
 
 #include <dali-toolkit/public-api/visuals/border-visual-properties.h>
 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
index 5cb7df1..c719798 100644 (file)
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/text/rendering-backend.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/text/rendering-backend.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
 #include <dali-toolkit/public-api/visuals/visual-properties.h>
 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
 #include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/internal/text/text-enumerations-impl.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/rendering/text-backend.h>
 #include <dali-toolkit/internal/text/text-effects-style.h>
 #include <dali-toolkit/internal/text/text-font-style.h>
@@ -67,16 +69,6 @@ const float DEFAULT_SCROLL_SPEED = 1200.f; ///< The default scroll speed for the
 
 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 LINE_WRAP_MODE_STRING_TABLE[] =
 {
   { "WORD",      Toolkit::Text::Layout::LineWrap::WORD      },
 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() );
 
           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 );
           }
           {
             impl.mController->SetHorizontalAlignment( alignment );
           }
@@ -801,9 +791,7 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind
       {
         if( impl.mController )
         {
       {
         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 );
           if( name )
           {
             value = std::string( name );
index a2d6b44..73a733c 100644 (file)
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/text/rendering-backend.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/text/rendering-backend.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
 #include <dali-toolkit/public-api/visuals/visual-properties.h>
 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
 #include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/internal/text/text-enumerations-impl.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/rendering/text-backend.h>
 #include <dali-toolkit/internal/text/text-effects-style.h>
 #include <dali-toolkit/internal/text/text-font-style.h>
@@ -64,23 +66,6 @@ namespace // unnamed namespace
 
 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()
 {
 // 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() );
 
           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;
       }
         }
         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() );
 
           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;
       }
         }
         break;
       }
@@ -873,10 +848,9 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde
       {
         if( impl.mController )
         {
       {
         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 );
           }
           {
             value = std::string( name );
           }
@@ -887,9 +861,8 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde
       {
         if( impl.mController )
         {
       {
         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 );
           if( name )
           {
             value = std::string( name );
index c29f484..75518d1 100644 (file)
@@ -25,6 +25,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/text/rendering-backend.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/text/rendering-backend.h>
+#include <dali-toolkit/public-api/text/text-enumerations.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/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>
@@ -35,6 +36,7 @@
 #include <dali-toolkit/internal/styling/style-manager-impl.h>
 
 #include <dali-toolkit/public-api/align-enumerations.h>
 #include <dali-toolkit/internal/styling/style-manager-impl.h>
 
 #include <dali-toolkit/public-api/align-enumerations.h>
+#include <dali-toolkit/internal/text/text-enumerations-impl.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
 #include <dali-toolkit/public-api/visuals/text-visual-properties.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
 #include <dali-toolkit/public-api/visuals/text-visual-properties.h>
@@ -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 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  },
 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 )
         {
       {
         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;
       }
         }
         break;
       }
@@ -256,14 +239,10 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr
       {
         if( impl.mController )
         {
       {
         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;
       }
         }
         break;
       }
@@ -579,13 +558,12 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde
       {
         if( impl.mController )
         {
       {
         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;
       }
         }
         break;
       }
@@ -593,9 +571,7 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde
       {
         if( impl.mController )
         {
       {
         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 );
           if( name )
           {
             value = std::string( name );
index 77df72f..6622d01 100644 (file)
@@ -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/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 \
    $(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 (file)
index 339b321..0000000
+++ /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
index 12f20e4..704c9ed 100644 (file)
@@ -1078,7 +1078,7 @@ struct Engine::Impl
   void Align( const Size& size,
               CharacterIndex startIndex,
               Length numberOfCharacters,
   void Align( const Size& size,
               CharacterIndex startIndex,
               Length numberOfCharacters,
-              HorizontalAlignment horizontalAlignment,
+              Text::HorizontalAlignment::Type horizontalAlignment,
               Vector<LineRun>& lines,
               float& alignmentOffset )
   {
               Vector<LineRun>& lines,
               float& alignmentOffset )
   {
@@ -1116,32 +1116,32 @@ struct Engine::Impl
   }
 
   void CalculateHorizontalAlignment( float boxWidth,
   }
 
   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;
 
                                      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 )
       {
     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;
         }
           break;
         }
-        case HORIZONTAL_ALIGN_CENTER:
+        case HorizontalAlignment::CENTER:
         {
           // Nothing to do.
           break;
         }
         {
           // Nothing to do.
           break;
         }
-        case HORIZONTAL_ALIGN_END:
+        case HorizontalAlignment::END:
         {
         {
-          alignment = HORIZONTAL_ALIGN_BEGIN;
+          alignment = HorizontalAlignment::BEGIN;
           break;
         }
       }
           break;
         }
       }
@@ -1150,7 +1150,7 @@ struct Engine::Impl
     // Calculate the horizontal line offset.
     switch( alignment )
     {
     // Calculate the horizontal line offset.
     switch( alignment )
     {
-      case HORIZONTAL_ALIGN_BEGIN:
+      case HorizontalAlignment::BEGIN:
       {
         line.alignmentOffset = 0.f;
 
       {
         line.alignmentOffset = 0.f;
 
@@ -1161,7 +1161,7 @@ struct Engine::Impl
         }
         break;
       }
         }
         break;
       }
-      case HORIZONTAL_ALIGN_CENTER:
+      case HorizontalAlignment::CENTER:
       {
         line.alignmentOffset = 0.5f * ( boxWidth - lineLength );
 
       {
         line.alignmentOffset = 0.5f * ( boxWidth - lineLength );
 
@@ -1173,7 +1173,7 @@ struct Engine::Impl
         line.alignmentOffset = floorf( line.alignmentOffset ); // try to avoid pixel alignment.
         break;
       }
         line.alignmentOffset = floorf( line.alignmentOffset ); // try to avoid pixel alignment.
         break;
       }
-      case HORIZONTAL_ALIGN_END:
+      case HorizontalAlignment::END:
       {
         if( isRTL )
         {
       {
         if( isRTL )
         {
@@ -1272,7 +1272,7 @@ void Engine::ReLayoutRightToLeftLines( const Parameters& layoutParameters,
 void Engine::Align( const Size& size,
                     CharacterIndex startIndex,
                     Length numberOfCharacters,
 void Engine::Align( const Size& size,
                     CharacterIndex startIndex,
                     Length numberOfCharacters,
-                    Layout::HorizontalAlignment horizontalAlignment,
+                    Text::HorizontalAlignment::Type horizontalAlignment,
                     Vector<LineRun>& lines,
                     float& alignmentOffset )
 {
                     Vector<LineRun>& lines,
                     float& alignmentOffset )
 {
index 0d1f7d4..66525d1 100644 (file)
@@ -23,7 +23,7 @@
 #include <dali/public-api/math/vector2.h>
 
 // INTERNAL INCLUDE
 #include <dali/public-api/math/vector2.h>
 
 // INTERNAL INCLUDE
-#include <dali-toolkit/internal/text/layouts/layout-alignment.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/internal/text/line-run.h>
 #include <dali-toolkit/internal/text/metrics.h>
 
 #include <dali-toolkit/internal/text/line-run.h>
 #include <dali-toolkit/internal/text/metrics.h>
 
@@ -144,7 +144,7 @@ public:
   void Align( const Size& size,
               CharacterIndex startIndex,
               Length numberOfCharacters,
   void Align( const Size& size,
               CharacterIndex startIndex,
               Length numberOfCharacters,
-              Layout::HorizontalAlignment horizontalAlignment,
+              Text::HorizontalAlignment::Type horizontalAlignment,
               Vector<LineRun>& lines,
               float& alignmentOffset );
 
               Vector<LineRun>& lines,
               float& alignmentOffset );
 
index fa33087..5deb666 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali/public-api/math/vector2.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/math/vector2.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/internal/text/text-definitions.h>
 #include <dali-toolkit/internal/text/layouts/layout-wrap-mode.h>
 
 #include <dali-toolkit/internal/text/text-definitions.h>
 #include <dali-toolkit/internal/text/layouts/layout-wrap-mode.h>
 
@@ -72,7 +73,7 @@ struct Parameters
               const GlyphIndex* const charactersToGlyphsBuffer,
               const Length* const glyphsPerCharacterBuffer,
               Length totalNumberOfGlyphs,
               const GlyphIndex* const charactersToGlyphsBuffer,
               const Length* const glyphsPerCharacterBuffer,
               Length totalNumberOfGlyphs,
-              HorizontalAlignment horizontalAlignment,
+              Text::HorizontalAlignment::Type horizontalAlignment,
               LineWrap::Mode lineWrapMode )
   : boundingBox( boundingBox ),
     textBuffer( textBuffer ),
               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.
   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.
   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.
index c7d92c2..3184d4a 100755 (executable)
@@ -281,17 +281,17 @@ PixelData Typesetter::Render( const Vector2& size, RenderBehaviour behaviour, bo
 
   switch( mModel->GetVerticalAlignment() )
   {
 
   switch( mModel->GetVerticalAlignment() )
   {
-    case Layout::VERTICAL_ALIGN_TOP:
+    case VerticalAlignment::TOP:
     {
       // No offset to add.
       break;
     }
     {
       // No offset to add.
       break;
     }
-    case Layout::VERTICAL_ALIGN_CENTER:
+    case VerticalAlignment::CENTER:
     {
       penY = static_cast<int>( 0.5f * ( size.height - layoutSize.height ) );
       break;
     }
     {
       penY = static_cast<int>( 0.5f * ( size.height - layoutSize.height ) );
       break;
     }
-    case Layout::VERTICAL_ALIGN_BOTTOM:
+    case VerticalAlignment::BOTTOM:
     {
       penY = static_cast<int>( size.height - layoutSize.height );
       break;
     {
       penY = static_cast<int>( size.height - layoutSize.height );
       break;
index fe3c451..7c2d156 100755 (executable)
@@ -61,12 +61,12 @@ const Vector2& ViewModel::GetScrollPosition() const
   return mModel->GetScrollPosition();
 }
 
   return mModel->GetScrollPosition();
 }
 
-Layout::HorizontalAlignment ViewModel::GetHorizontalAlignment() const
+HorizontalAlignment::Type ViewModel::GetHorizontalAlignment() const
 {
   return mModel->GetHorizontalAlignment();
 }
 
 {
   return mModel->GetHorizontalAlignment();
 }
 
-Layout::VerticalAlignment ViewModel::GetVerticalAlignment() const
+VerticalAlignment::Type ViewModel::GetVerticalAlignment() const
 {
   return mModel->GetVerticalAlignment();
 }
 {
   return mModel->GetVerticalAlignment();
 }
index 827ecf0..c4e1ec0 100755 (executable)
@@ -22,6 +22,7 @@
 #include <dali/public-api/common/dali-vector.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-vector.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/internal/text/text-model-interface.h>
 
 namespace Dali
 #include <dali-toolkit/internal/text/text-model-interface.h>
 
 namespace Dali
@@ -74,12 +75,12 @@ public:
   /**
    * @copydoc ModelInterface::GetHorizontalAlignment()
    */
   /**
    * @copydoc ModelInterface::GetHorizontalAlignment()
    */
-  virtual Layout::HorizontalAlignment GetHorizontalAlignment() const;
+  virtual Text::HorizontalAlignment::Type GetHorizontalAlignment() const;
 
   /**
    * @copydoc ModelInterface::GetVerticalAlignment()
    */
 
   /**
    * @copydoc ModelInterface::GetVerticalAlignment()
    */
-  virtual Layout::VerticalAlignment GetVerticalAlignment() const;
+  virtual Text::VerticalAlignment::Type GetVerticalAlignment() const;
 
   /**
    * @copydoc ModelInterface::IsTextElideEnabled()
 
   /**
    * @copydoc ModelInterface::IsTextElideEnabled()
index 0101616..d859b42 100644 (file)
@@ -2611,17 +2611,17 @@ void Controller::Impl::GetCursorPosition( CharacterIndex logical,
 
     switch( mModel->mHorizontalAlignment )
     {
 
     switch( mModel->mHorizontalAlignment )
     {
-      case Layout::HORIZONTAL_ALIGN_BEGIN:
+      case Text::HorizontalAlignment::BEGIN :
       {
         cursorInfo.primaryPosition.x = 0.f;
         break;
       }
       {
         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;
       }
       {
         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;
       {
         cursorInfo.primaryPosition.x = mModel->mVisualModel->mControlSize.width - mEventData->mDecorator->GetCursorWidth();
         break;
index 4137326..df15cad 100755 (executable)
@@ -356,7 +356,7 @@ bool Controller::IsMultiLineEnabled() const
   return Layout::Engine::MULTI_LINE_BOX == mImpl->mLayoutEngine.GetLayout();
 }
 
   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 )
   {
 {
   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;
 }
 
 {
   return mImpl->mModel->mHorizontalAlignment;
 }
 
-void Controller::SetVerticalAlignment( Layout::VerticalAlignment alignment )
+void Controller::SetVerticalAlignment( VerticalAlignment::Type alignment )
 {
   if( alignment != mImpl->mModel->mVerticalAlignment )
   {
 {
   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;
 }
 {
   return mImpl->mModel->mVerticalAlignment;
 }
@@ -3460,17 +3460,17 @@ void Controller::CalculateVerticalOffset( const Size& controlSize )
 
   switch( mImpl->mModel->mVerticalAlignment )
   {
 
   switch( mImpl->mModel->mVerticalAlignment )
   {
-    case Layout::VERTICAL_ALIGN_TOP:
+    case VerticalAlignment::TOP:
     {
       mImpl->mModel->mScrollPosition.y = 0.f;
       break;
     }
     {
       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;
     }
     {
       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;
     {
       mImpl->mModel->mScrollPosition.y = controlSize.height - layoutSize.height;
       break;
index fc75596..6b7505d 100755 (executable)
@@ -23,6 +23,7 @@
 #include <dali/public-api/events/gesture.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/events/gesture.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
@@ -30,7 +31,6 @@
 #include <dali-toolkit/internal/text/hidden-text.h>
 #include <dali-toolkit/internal/text/text-model-interface.h>
 
 #include <dali-toolkit/internal/text/hidden-text.h>
 #include <dali-toolkit/internal/text/text-model-interface.h>
 
-
 namespace Dali
 {
 
 namespace Dali
 {
 
@@ -325,24 +325,24 @@ public: // Configure the text controller.
    *
    * @param[in] alignment The horizontal alignment.
    */
    *
    * @param[in] alignment The horizontal alignment.
    */
-  void SetHorizontalAlignment( Layout::HorizontalAlignment alignment );
+  void SetHorizontalAlignment( HorizontalAlignment::Type alignment );
 
   /**
    * @copydoc ModelInterface::GetHorizontalAlignment()
    */
 
   /**
    * @copydoc ModelInterface::GetHorizontalAlignment()
    */
-  Layout::HorizontalAlignment GetHorizontalAlignment() const;
+  HorizontalAlignment::Type GetHorizontalAlignment() const;
 
   /**
    * @brief Sets the text's vertical alignment.
    *
    * @param[in] alignment The vertical alignment.
    */
 
   /**
    * @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()
    */
 
   /**
    * @copydoc ModelInterface::GetVerticalAlignment()
    */
-  Layout::VerticalAlignment GetVerticalAlignment() const;
+  VerticalAlignment::Type GetVerticalAlignment() const;
 
   /**
    * @brief Sets the text's wrap mode
 
   /**
    * @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 (file)
index 0000000..8dc3eb8
--- /dev/null
@@ -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 <dali-toolkit/internal/text/text-enumerations-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/scripting/enum-helper.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
+
+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 (file)
index 0000000..2462bc7
--- /dev/null
@@ -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 <dali/public-api/object/property-value.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
+
+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
index 18cb7cc..eca061a 100755 (executable)
@@ -22,7 +22,7 @@
 #include <dali/public-api/math/vector2.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/math/vector2.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/layouts/layout-alignment.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/internal/text/line-run.h>
 #include <dali-toolkit/internal/text/script-run.h>
 #include <dali-toolkit/internal/text/text-definitions.h>
 #include <dali-toolkit/internal/text/line-run.h>
 #include <dali-toolkit/internal/text/script-run.h>
 #include <dali-toolkit/internal/text/text-definitions.h>
@@ -74,14 +74,14 @@ public:
    *
    * @return The horizontal alignment.
    */
    *
    * @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.
    */
 
   /**
    * @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.
 
   /**
    * @brief Whether the text elide property is enabled.
index cf6f35c..b31810a 100755 (executable)
@@ -47,12 +47,12 @@ const Vector2& Model::GetScrollPosition() const
   return mScrollPosition;
 }
 
   return mScrollPosition;
 }
 
-Layout::HorizontalAlignment Model::GetHorizontalAlignment() const
+HorizontalAlignment::Type Model::GetHorizontalAlignment() const
 {
   return mHorizontalAlignment;
 }
 
 {
   return mHorizontalAlignment;
 }
 
-Layout::VerticalAlignment Model::GetVerticalAlignment() const
+VerticalAlignment::Type Model::GetVerticalAlignment() const
 {
   return mVerticalAlignment;
 }
 {
   return mVerticalAlignment;
 }
@@ -162,8 +162,8 @@ Model::Model()
   mVisualModel(),
   mScrollPosition(),
   mScrollPositionLast(),
   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 )
   mLineWrapMode( Layout::LineWrap::WORD ),
   mAlignmentOffset( 0.0f ),
   mElideEnabled( false )
index cd49581..d4da2bc 100755 (executable)
@@ -22,7 +22,7 @@
 #include <dali/public-api/object/ref-object.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/object/ref-object.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/layouts/layout-alignment.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/internal/text/layouts/layout-wrap-mode.h>
 #include <dali-toolkit/internal/text/logical-model-impl.h>
 #include <dali-toolkit/internal/text/text-model-interface.h>
 #include <dali-toolkit/internal/text/layouts/layout-wrap-mode.h>
 #include <dali-toolkit/internal/text/logical-model-impl.h>
 #include <dali-toolkit/internal/text/text-model-interface.h>
@@ -77,12 +77,12 @@ public:
   /**
    * @copydoc ModelInterface::GetHorizontalAlignment()
    */
   /**
    * @copydoc ModelInterface::GetHorizontalAlignment()
    */
-  virtual Layout::HorizontalAlignment GetHorizontalAlignment() const;
+  virtual HorizontalAlignment::Type GetHorizontalAlignment() const;
 
   /**
    * @copydoc ModelInterface::GetVerticalAlignment()
    */
 
   /**
    * @copydoc ModelInterface::GetVerticalAlignment()
    */
-  virtual Layout::VerticalAlignment GetVerticalAlignment() const;
+  virtual VerticalAlignment::Type GetVerticalAlignment() const;
 
   /**
    * @copydoc ModelInterface::IsTextElideEnabled()
 
   /**
    * @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.
    */
    * 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
 };
 
 } // namespace Text
index f235ce8..ae65fd2 100644 (file)
@@ -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:
  *
  * -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).
  */
  *   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
   },
 
   {
     -0.5f, // LTR
     0.5f   // RTL
   },
 
-  // HORIZONTAL_ALIGN_CENTER
+  // HorizontalAlignment::CENTER
   {
     0.0f,  // LTR
     0.0f   // RTL
   },
 
   {
     0.0f,  // LTR
     0.0f   // RTL
   },
 
-  // HORIZONTAL_ALIGN_END
+  // HorizontalAlignment::END
   {
     0.5f,  // LTR
     -0.5f  // RTL
   {
     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.
  * @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
 };
 
 } // 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 );
 {
   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 );
index daf2587..f2203a7 100644 (file)
@@ -25,9 +25,9 @@
 #include <dali/public-api/rendering/renderer.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/rendering/renderer.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 #include <dali-toolkit/internal/text/text-definitions.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 #include <dali-toolkit/internal/text/text-definitions.h>
-#include <dali-toolkit/internal/text/layouts/layout-alignment.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -70,7 +70,7 @@ public:
    * @param[in] horizontalAlignment horizontal alignment of the text
    * @param[in] verticalAlignment vertical alignment of the text
    */
    * @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
 
   /**
    * @brief Set the gap distance to elapse before the text wraps around
index 05fbf0d..360b9c1 100755 (executable)
@@ -33,6 +33,7 @@
 #include <dali-toolkit/internal/text/text-font-style.h>
 #include <dali-toolkit/internal/text/text-effects-style.h>
 #include <dali-toolkit/internal/text/script-run.h>
 #include <dali-toolkit/internal/text/text-font-style.h>
 #include <dali-toolkit/internal/text/text-effects-style.h>
 #include <dali-toolkit/internal/text/script-run.h>
+#include <dali-toolkit/internal/text/text-enumerations-impl.h>
 
 namespace Dali
 {
 
 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 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 );
 
 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<Toolkit::Text::Layout::HorizontalAlignment>( 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
 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::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() );
 
 
   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:
     {
     }
     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:
     {
       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:
       break;
     }
     case Toolkit::TextVisual::Property::TEXT_COLOR:
index 659e339..0d20794 100644 (file)
@@ -117,8 +117,9 @@ public:
 
       /**
        * @brief The text horizontal alignment.
 
       /**
        * @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".
        *          Values "BEGIN" "CENTER" "END".
+       * @note Return type is Property::STRING
        * @SINCE_1_1.37
        */
       HORIZONTAL_ALIGNMENT,
        * @SINCE_1_1.37
        */
       HORIZONTAL_ALIGNMENT,
index 48e0ef5..1fb34e0 100644 (file)
@@ -138,16 +138,18 @@ public:
 
       /**
        * @brief The line horizontal alignment.
 
       /**
        * @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".
        *          Values "BEGIN", "CENTER", "END".
+       * @note Return type is Property::STRING
        * @SINCE_1_0.0
        */
       HORIZONTAL_ALIGNMENT,
 
       /**
        * @brief The line vertical alignment.
        * @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".
        *          Values "TOP",   "CENTER", "BOTTOM".
+       * @note Return type is Property::STRING
        * @SINCE_1_0.0
        */
       VERTICAL_ALIGNMENT,
        * @SINCE_1_0.0
        */
       VERTICAL_ALIGNMENT,
index 0de1b01..7aa8634 100644 (file)
@@ -144,16 +144,18 @@ public:
 
       /**
        * @brief The line horizontal alignment.
 
       /**
        * @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.
        *          Values "BEGIN", "CENTER", "END", default BEGIN.
+       * @note Return type is Property::STRING
        * @SINCE_1_0.0
        */
       HORIZONTAL_ALIGNMENT,
 
       /**
        * @brief The line vertical alignment.
        * @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.
        *          Values "TOP",   "CENTER", "BOTTOM" @SINCE_1_0.0, default TOP.
+       * @note Return type is Property::STRING
        * @SINCE_1_0.0
        */
       VERTICAL_ALIGNMENT,
        * @SINCE_1_0.0
        */
       VERTICAL_ALIGNMENT,
index e695d21..f29325b 100755 (executable)
@@ -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_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
 
 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 (file)
index 0000000..9d9dff2
--- /dev/null
@@ -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
index 6399efc..10c4ab7 100644 (file)
@@ -80,14 +80,18 @@ enum
 
   /**
    * @brief The line horizontal alignment.
 
   /**
    * @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.
    * @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,
    * @SINCE_1_2.60
    */
   VERTICAL_ALIGNMENT,