X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller.cpp;h=6d18a3ab9d63141f4f2a85d729bffe4b3132743d;hp=4cc9d900713b9c3d72a9ec91fe0b3e70d7a3115d;hb=b0e657abb5cbb9f088d1b16499624bc34037da9e;hpb=5d9c9c74a345a826828d32e90d4d333639abad77 diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 4cc9d90..6d18a3a 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -27,6 +27,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -47,14 +48,14 @@ const float MAX_FLOAT = std::numeric_limits::max(); const std::string EMPTY_STRING(""); -const char * const PLACEHOLDER_TEXT = "placeholderText"; -const char * const PLACEHOLDER_TEXT_FOCUSED = "placeholderTextFocused"; -const char * const PLACEHOLDER_COLOR = "placeholderColor"; -const char * const PLACEHOLDER_FONT_FAMILY = "placeholderFontFamily"; -const char * const PLACEHOLDER_FONT_STYLE = "placeholderFontStyle"; -const char * const PLACEHOLDER_POINT_SIZE = "placeholderPointSize"; -const char * const PLACEHOLDER_PIXEL_SIZE = "placeholderPixelSize"; -const char * const PLACEHOLDER_ELLIPSIS = "placeholderEllipsis"; +const char * const PLACEHOLDER_TEXT = "text"; +const char * const PLACEHOLDER_TEXT_FOCUSED = "textFocused"; +const char * const PLACEHOLDER_COLOR = "color"; +const char * const PLACEHOLDER_FONT_FAMILY = "fontFamily"; +const char * const PLACEHOLDER_FONT_STYLE = "fontStyle"; +const char * const PLACEHOLDER_POINT_SIZE = "pointSize"; +const char * const PLACEHOLDER_PIXEL_SIZE = "pixelSize"; +const char * const PLACEHOLDER_ELLIPSIS = "ellipsis"; float ConvertToEven( float value ) { @@ -356,7 +357,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 +371,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,12 +389,12 @@ void Controller::SetVerticalAlignment( Layout::VerticalAlignment alignment ) } } -Layout::VerticalAlignment Controller::GetVerticalAlignment() const +VerticalAlignment::Type Controller::GetVerticalAlignment() const { return mImpl->mModel->mVerticalAlignment; } -void Controller::SetLineWrapMode( Layout::LineWrap::Mode lineWrapMode ) +void Controller::SetLineWrapMode( Text::LineWrap::Mode lineWrapMode ) { if( lineWrapMode != mImpl->mModel->mLineWrapMode ) { @@ -416,7 +417,7 @@ void Controller::SetLineWrapMode( Layout::LineWrap::Mode lineWrapMode ) } } -Layout::LineWrap::Mode Controller::GetLineWrapMode() const +Text::LineWrap::Mode Controller::GetLineWrapMode() const { return mImpl->mModel->mLineWrapMode; } @@ -1750,6 +1751,16 @@ void Controller::ShadowSetByString( bool setByString ) mImpl->mShadowSetByString = setByString; } +bool Controller::IsOutlineSetByString() +{ + return mImpl->mOutlineSetByString; +} + +void Controller::OutlineSetByString( bool setByString ) +{ + mImpl->mOutlineSetByString = setByString; +} + bool Controller::IsFontStyleSetByString() { return mImpl->mFontStyleSetByString; @@ -1976,19 +1987,19 @@ void Controller::SetPlaceholderProperty( const Property::Map& map ) Property::Key& key = keyValue.first; Property::Value& value = keyValue.second; - if( key == PLACEHOLDER_TEXT ) + if( key == Toolkit::Text::PlaceHolder::Property::TEXT || key == PLACEHOLDER_TEXT ) { std::string text = ""; value.Get( text ); SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text ); } - else if( key == PLACEHOLDER_TEXT_FOCUSED ) + else if( key == Toolkit::Text::PlaceHolder::Property::TEXT_FOCUSED || key == PLACEHOLDER_TEXT_FOCUSED ) { std::string text = ""; value.Get( text ); SetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text ); } - else if( key == PLACEHOLDER_COLOR ) + else if( key == Toolkit::Text::PlaceHolder::Property::COLOR || key == PLACEHOLDER_COLOR ) { Vector4 textColor; value.Get( textColor ); @@ -1997,17 +2008,17 @@ void Controller::SetPlaceholderProperty( const Property::Map& map ) SetPlaceholderTextColor( textColor ); } } - else if( key == PLACEHOLDER_FONT_FAMILY ) + else if( key == Toolkit::Text::PlaceHolder::Property::FONT_FAMILY || key == PLACEHOLDER_FONT_FAMILY ) { std::string fontFamily = ""; value.Get( fontFamily ); SetPlaceholderFontFamily( fontFamily ); } - else if( key == PLACEHOLDER_FONT_STYLE ) + else if( key == Toolkit::Text::PlaceHolder::Property::FONT_STYLE || key == PLACEHOLDER_FONT_STYLE ) { SetFontStyleProperty( this, value, Text::FontStyle::PLACEHOLDER ); } - else if( key == PLACEHOLDER_POINT_SIZE ) + else if( key == Toolkit::Text::PlaceHolder::Property::POINT_SIZE || key == PLACEHOLDER_POINT_SIZE ) { float pointSize; value.Get( pointSize ); @@ -2016,7 +2027,7 @@ void Controller::SetPlaceholderProperty( const Property::Map& map ) SetPlaceholderTextFontSize( pointSize, Text::Controller::POINT_SIZE ); } } - else if( key == PLACEHOLDER_PIXEL_SIZE ) + else if( key == Toolkit::Text::PlaceHolder::Property::PIXEL_SIZE || key == PLACEHOLDER_PIXEL_SIZE ) { float pixelSize; value.Get( pixelSize ); @@ -2025,7 +2036,7 @@ void Controller::SetPlaceholderProperty( const Property::Map& map ) SetPlaceholderTextFontSize( pixelSize, Text::Controller::PIXEL_SIZE ); } } - else if( key == PLACEHOLDER_ELLIPSIS ) + else if( key == Toolkit::Text::PlaceHolder::Property::ELLIPSIS || key == PLACEHOLDER_ELLIPSIS ) { bool ellipsis; value.Get( ellipsis ); @@ -2040,33 +2051,33 @@ void Controller::GetPlaceholderProperty( Property::Map& map ) { if( !mImpl->mEventData->mPlaceholderTextActive.empty() ) { - map[ PLACEHOLDER_TEXT_FOCUSED ] = mImpl->mEventData->mPlaceholderTextActive; + map[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = mImpl->mEventData->mPlaceholderTextActive; } if( !mImpl->mEventData->mPlaceholderTextInactive.empty() ) { - map[ PLACEHOLDER_TEXT ] = mImpl->mEventData->mPlaceholderTextInactive; + map[ Text::PlaceHolder::Property::TEXT ] = mImpl->mEventData->mPlaceholderTextInactive; } - map[ PLACEHOLDER_COLOR ] = mImpl->mEventData->mPlaceholderTextColor; - map[ PLACEHOLDER_FONT_FAMILY ] = GetPlaceholderFontFamily(); + map[ Text::PlaceHolder::Property::COLOR ] = mImpl->mEventData->mPlaceholderTextColor; + map[ Text::PlaceHolder::Property::FONT_FAMILY ] = GetPlaceholderFontFamily(); Property::Value fontStyleMapGet; GetFontStyleProperty( this, fontStyleMapGet, Text::FontStyle::PLACEHOLDER ); - map[ PLACEHOLDER_FONT_STYLE ] = fontStyleMapGet; + map[ Text::PlaceHolder::Property::FONT_STYLE ] = fontStyleMapGet; // Choose font size : POINT_SIZE or PIXEL_SIZE if( !mImpl->mEventData->mIsPlaceholderPixelSize ) { - map[ PLACEHOLDER_POINT_SIZE ] = GetPlaceholderTextFontSize( Text::Controller::POINT_SIZE ); + map[ Text::PlaceHolder::Property::POINT_SIZE ] = GetPlaceholderTextFontSize( Text::Controller::POINT_SIZE ); } else { - map[ PLACEHOLDER_PIXEL_SIZE ] = GetPlaceholderTextFontSize( Text::Controller::PIXEL_SIZE ); + map[ Text::PlaceHolder::Property::PIXEL_SIZE ] = GetPlaceholderTextFontSize( Text::Controller::PIXEL_SIZE ); } if( mImpl->mEventData->mPlaceholderEllipsisFlag ) { - map[ PLACEHOLDER_ELLIPSIS ] = IsPlaceholderTextElideEnabled(); + map[ Text::PlaceHolder::Property::ELLIPSIS ] = IsPlaceholderTextElideEnabled(); } } } @@ -2304,7 +2315,7 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) // Do nothing. return false; } - else if( Dali::DALI_KEY_ESCAPE == keyCode || Dali::DALI_KEY_BACK == keyCode ) + else if( Dali::DALI_KEY_ESCAPE == keyCode || Dali::DALI_KEY_BACK == keyCode || Dali::DALI_KEY_SEARCH == keyCode ) { // Do nothing return false; @@ -3450,17 +3461,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;