X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-label-impl.cpp;h=75518d1de51579540a9c2371bbca3a05e19f6cb0;hp=c29f484773894112d83d039a74a921ea8622b91c;hb=refs%2Fchanges%2F97%2F153897%2F12;hpb=f090b040537e2a5a60a6dc80009ade9b72d37d4b 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 );