X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fdecorator%2Ftext-decorator.cpp;h=648c17a131acce2824f579b6c9e5f492e2566fb5;hb=refs%2Fchanges%2F03%2F251703%2F2;hp=2a57d4d955de4a08be8e92bb2f6278fa4a2f2c17;hpb=6865cb71a775041100dbbfa3c4d950e69d3864b7;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index 2a57d4d..648c17a 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -34,37 +34,13 @@ #include #include #include +#include #ifdef DEBUG_ENABLED #define DECORATOR_DEBUG #endif -#define MAKE_SHADER(A)#A - -namespace -{ -const char* VERTEX_SHADER = MAKE_SHADER( -attribute mediump vec2 aPosition; -uniform highp mat4 uMvpMatrix; - -void main() -{ - mediump vec4 position = vec4( aPosition, 0.0, 1.0 ); - gl_Position = uMvpMatrix * position; -} -); - -const char* FRAGMENT_SHADER = MAKE_SHADER( -uniform lowp vec4 uColor; - -void main() -{ - gl_FragColor = uColor; -} -); -} - namespace Dali { namespace Internal @@ -266,10 +242,11 @@ struct Decorator::Impl : public ConnectionTracker mHorizontalScrollingEnabled( false ), mVerticalScrollingEnabled( false ), mSmoothHandlePanEnabled( false ), - mIsHighlightBoxActive( false ) + mIsHighlightBoxActive( false ), + mHidePrimaryCursorAndGrabHandle( false ) { mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2; - mHighlightShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); + mHighlightShader = Shader::New( SHADER_TEXT_DECORATOR_SHADER_VERT, SHADER_TEXT_DECORATOR_SHADER_FRAG ); SetupGestures(); } @@ -290,7 +267,7 @@ struct Decorator::Impl : public ConnectionTracker if( mPrimaryCursor ) { const CursorImpl& cursor = mCursor[PRIMARY_CURSOR]; - mPrimaryCursorVisible = ( ( mControlSize.width - ( cursor.position.x + mCursorWidth ) > -Math::MACHINE_EPSILON_1000 ) && + mPrimaryCursorVisible = (!mHidePrimaryCursorAndGrabHandle) && ( ( mControlSize.width - ( cursor.position.x + mCursorWidth ) > -Math::MACHINE_EPSILON_1000 ) && ( cursor.position.x > -Math::MACHINE_EPSILON_1000 ) && ( mControlSize.height - ( cursor.position.y + cursor.cursorHeight ) > -Math::MACHINE_EPSILON_1000 ) && ( cursor.position.y > -Math::MACHINE_EPSILON_1000 ) ); @@ -330,7 +307,7 @@ struct Decorator::Impl : public ConnectionTracker grabHandle.verticallyVisible = ( ( ( mControlSize.height - grabHandle.lineHeight ) - grabHandle.position.y > -Math::MACHINE_EPSILON_1000 ) && ( grabHandle.position.y > -Math::MACHINE_EPSILON_1000 ) ); - const bool isVisible = grabHandle.horizontallyVisible && grabHandle.verticallyVisible; + const bool isVisible = grabHandle.horizontallyVisible && grabHandle.verticallyVisible && (!mHidePrimaryCursorAndGrabHandle); if( isVisible ) { CreateGrabHandle(); @@ -1945,6 +1922,7 @@ struct Decorator::Impl : public ConnectionTracker bool mVerticalScrollingEnabled : 1; ///< Whether the vertical scrolling is enabled. bool mSmoothHandlePanEnabled : 1; ///< Whether to pan smoothly the handles. bool mIsHighlightBoxActive : 1; ///< Whether the highlight box is active. + bool mHidePrimaryCursorAndGrabHandle : 1; ///< Whether the primary cursor and grab are hidden always. }; DecoratorPtr Decorator::New( ControllerInterface& controller, @@ -2093,6 +2071,11 @@ int Decorator::GetCursorWidth() const return static_cast( mImpl->mCursorWidth ); } +void Decorator::SetEditable( bool editable ) +{ + mImpl->mHidePrimaryCursorAndGrabHandle = !editable; + mImpl->Relayout( mImpl->mControlSize ); +} /** Handles **/ void Decorator::SetHandleActive( HandleType handleType, bool active )