2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
22 #include <dali/public-api/actors/actor.h>
23 #include <dali/public-api/adaptor-framework/timer.h>
24 #include <dali/public-api/actors/image-actor.h>
25 #include <dali/public-api/actors/layer.h>
26 #include <dali/public-api/actors/mesh-actor.h>
27 #include <dali/public-api/common/constants.h>
28 #include <dali/public-api/events/tap-gesture.h>
29 #include <dali/public-api/events/tap-gesture-detector.h>
30 #include <dali/public-api/events/pan-gesture.h>
31 #include <dali/public-api/events/pan-gesture-detector.h>
32 #include <dali/public-api/geometry/mesh.h>
33 #include <dali/public-api/geometry/mesh-data.h>
34 #include <dali/public-api/images/resource-image.h>
35 #include <dali/public-api/math/vector2.h>
36 #include <dali/public-api/math/vector4.h>
37 //#include <dali/public-api/images/nine-patch-image.h>
38 #include <dali/public-api/signals/connection-tracker.h>
41 #include <dali-toolkit/public-api/controls/control.h>
42 #include <dali-toolkit/public-api/controls/control-impl.h>
43 #include <dali-toolkit/public-api/controls/buttons/push-button.h>
44 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
45 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
46 #include <dali-toolkit/public-api/controls/text-controls/text-selection-popup.h>
49 #define DECORATOR_DEBUG
56 const char* DEFAULT_GRAB_HANDLE_IMAGE( DALI_IMAGE_DIR "insertpoint-icon.png" );
57 const char* DEFAULT_SELECTION_HANDLE_ONE( DALI_IMAGE_DIR "text-input-selection-handle-left.png" );
58 const char* DEFAULT_SELECTION_HANDLE_TWO( DALI_IMAGE_DIR "text-input-selection-handle-right.png" );
59 //const char* DEFAULT_SELECTION_HANDLE_ONE_PRESSED( DALI_IMAGE_DIR "text-input-selection-handle-left-press.png" );
60 //const char* DEFAULT_SELECTION_HANDLE_TWO_PRESSED( DALI_IMAGE_DIR "text-input-selection-handle-right-press.png" );
62 const Dali::Vector3 DEFAULT_GRAB_HANDLE_RELATIVE_SIZE( 1.5f, 2.0f, 1.0f );
63 const Dali::Vector3 DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE( 1.5f, 1.5f, 1.0f );
65 const std::size_t CURSOR_BLINK_INTERVAL = 500; // Cursor blink interval
66 const std::size_t MILLISECONDS = 1000;
68 const float DISPLAYED_HIGHLIGHT_Z_OFFSET( -0.05f );
71 * structure to hold coordinates of each quad, which will make up the mesh.
73 struct QuadCoordinates
84 * @param[in] x1 left co-ordinate
85 * @param[in] y1 top co-ordinate
86 * @param[in] x2 right co-ordinate
87 * @param[in] y2 bottom co-ordinate
89 QuadCoordinates(float x1, float y1, float x2, float y2)
95 Dali::Vector2 min; ///< top-left (minimum) position of quad
96 Dali::Vector2 max; ///< bottom-right (maximum) position of quad
99 typedef std::vector<QuadCoordinates> QuadContainer;
101 } // end of namespace
112 struct Decorator::Impl : public ConnectionTracker
121 color(Dali::Color::WHITE)
133 struct SelectionHandleImpl
135 SelectionHandleImpl()
145 float lineHeight; ///< Not the handle height
155 Impl( Dali::Toolkit::Internal::Control& parent, Observer& observer )
156 : mTextControlParent(parent),
158 mActiveCursor(ACTIVE_CURSOR_NONE),
159 mActiveGrabHandle(false),
160 mActiveSelection( false ),
161 mActiveCopyPastePopup( false ),
162 mCursorBlinkInterval( CURSOR_BLINK_INTERVAL ),
163 mCursorBlinkDuration( 0.0f ),
164 mCursorBlinkStatus( true ),
165 mGrabDisplacementX( 0.0f ),
166 mGrabDisplacementY( 0.0f ),
167 mHighlightColor( 0.07f, 0.41f, 0.59f, 1.0f ), // light blue
168 mBoundingBox( Rect<int>() )
173 * Relayout of the decorations owned by the decorator.
174 * @param[in] size The Size of the UI control the decorater is adding it's decorations to.
176 void Relayout( const Vector2& size, const Vector2& scrollPosition )
178 // TODO - Remove this if nothing is active
181 // Show or hide the cursors
185 mPrimaryCursor.SetPosition( mCursor[PRIMARY_CURSOR].x + scrollPosition.x,
186 mCursor[PRIMARY_CURSOR].y + scrollPosition.y );
187 mPrimaryCursor.SetSize( Size( 1.0f, mCursor[PRIMARY_CURSOR].cursorHeight ) );
189 if( mSecondaryCursor )
191 mSecondaryCursor.SetPosition( mCursor[SECONDARY_CURSOR].x + scrollPosition.x,
192 mCursor[SECONDARY_CURSOR].y + scrollPosition.y );
193 mSecondaryCursor.SetSize( Size( 1.0f, mCursor[SECONDARY_CURSOR].cursorHeight ) );
196 // Show or hide the grab handle
197 if( mActiveGrabHandle )
203 mGrabHandle.SetPosition( mCursor[PRIMARY_CURSOR].x + scrollPosition.x,
204 mCursor[PRIMARY_CURSOR].lineHeight + scrollPosition.y );
206 else if( mGrabHandle )
208 UnparentAndReset( mGrabHandle );
211 // Show or hide the selection handles/highlight
212 if( mActiveSelection )
216 CreateSelectionHandles();
218 SelectionHandleImpl& primary = mSelectionHandle[ PRIMARY_SELECTION_HANDLE ];
219 primary.actor.SetPosition( primary.x + scrollPosition.x,
220 primary.lineHeight + scrollPosition.y );
222 SelectionHandleImpl& secondary = mSelectionHandle[ SECONDARY_SELECTION_HANDLE ];
223 secondary.actor.SetPosition( secondary.x + scrollPosition.x,
224 secondary.lineHeight + scrollPosition.y );
231 UnparentAndReset( mSelectionHandle[ PRIMARY_SELECTION_HANDLE ].actor );
232 UnparentAndReset( mSelectionHandle[ SECONDARY_SELECTION_HANDLE ].actor );
233 UnparentAndReset( mHighlightMeshActor );
236 if ( mActiveCopyPastePopup )
238 if ( !mCopyPastePopup )
240 mCopyPastePopup = TextSelectionPopup::New();
241 mActiveLayer.Add ( mCopyPastePopup );
243 mCopyPastePopup.SetPosition( Vector3( 200.0f, -100.0f, 0.0f ) ); //todo grabhandle or selection handle positions to be used
247 if ( mCopyPastePopup )
249 UnparentAndReset( mCopyPastePopup );
254 void CreateCursor( ImageActor& cursor )
256 cursor = CreateSolidColorActor( Color::WHITE );
257 cursor.SetParentOrigin( ParentOrigin::TOP_LEFT ); // Need to set the default parent origin as CreateSolidColorActor() sets a different one.
258 cursor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
259 cursor.SetRelayoutEnabled( false );
262 // Add or Remove cursor(s) from parent
265 if( mActiveCursor == ACTIVE_CURSOR_NONE )
267 UnparentAndReset( mPrimaryCursor );
268 UnparentAndReset( mSecondaryCursor );
272 /* Create Primary and or Secondary Cursor(s) if active and add to parent */
273 if ( mActiveCursor == ACTIVE_CURSOR_PRIMARY ||
274 mActiveCursor == ACTIVE_CURSOR_BOTH )
276 if ( !mPrimaryCursor )
278 CreateCursor( mPrimaryCursor );
279 #ifdef DECORATOR_DEBUG
280 mPrimaryCursor.SetName( "PrimaryCursorActor" );
282 mActiveLayer.Add( mPrimaryCursor);
286 if ( mActiveCursor == ACTIVE_CURSOR_BOTH )
288 if ( !mSecondaryCursor )
290 CreateCursor( mSecondaryCursor );
291 #ifdef DECORATOR_DEBUG
292 mSecondaryCursor.SetName( "SecondaryCursorActor" );
294 mActiveLayer.Add( mSecondaryCursor);
299 UnparentAndReset( mSecondaryCursor );
304 bool OnCursorBlinkTimerTick()
307 if ( mPrimaryCursor )
309 mPrimaryCursor.SetVisible( mCursorBlinkStatus );
311 if ( mSecondaryCursor )
313 mSecondaryCursor.SetVisible( mCursorBlinkStatus );
316 mCursorBlinkStatus = !mCursorBlinkStatus;
321 void SetupTouchEvents()
325 mTapDetector = TapGestureDetector::New();
326 mTapDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnTap );
329 if ( !mPanGestureDetector )
331 mPanGestureDetector = PanGestureDetector::New();
332 mPanGestureDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnPan );
336 void CreateActiveLayer()
340 Actor parent = mTextControlParent.Self();
342 mActiveLayer = Layer::New();
343 #ifdef DECORATOR_DEBUG
344 mActiveLayer.SetName ( "ActiveLayerActor" );
347 mActiveLayer.SetParentOrigin( ParentOrigin::CENTER );
348 mActiveLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
349 mActiveLayer.SetPositionInheritanceMode( USE_PARENT_POSITION );
351 parent.Add( mActiveLayer );
354 mActiveLayer.RaiseToTop();
357 void CreateGrabHandle()
361 if ( !mGrabHandleImage )
363 mGrabHandleImage = ResourceImage::New( DEFAULT_GRAB_HANDLE_IMAGE );
366 mGrabHandle = ImageActor::New( mGrabHandleImage );
367 #ifdef DECORATOR_DEBUG
368 mGrabHandle.SetName( "GrabHandleActor" );
370 mGrabHandle.SetAnchorPoint( AnchorPoint::TOP_CENTER );
371 mGrabHandle.SetDrawMode( DrawMode::OVERLAY );
372 // Area that Grab handle responds to, larger than actual handle so easier to move
373 #ifdef DECORATOR_DEBUG
374 mGrabArea = Toolkit::CreateSolidColorActor( Vector4(0.0f, 0.0f, 0.0f, 0.0f), true, Color::RED, 1 );
375 mGrabArea.SetName( "GrabArea" );
377 mGrabArea = Actor::New();
378 mGrabArea.SetRelayoutEnabled( true );
380 mGrabArea.SetParentOrigin( ParentOrigin::TOP_CENTER );
381 mGrabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
382 mGrabArea.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS );
383 mGrabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE );
384 mGrabHandle.Add( mGrabArea );
386 mTapDetector.Attach( mGrabArea );
387 mPanGestureDetector.Attach( mGrabArea );
389 mActiveLayer.Add(mGrabHandle);
393 void CreateSelectionHandles()
395 SelectionHandleImpl& primary = mSelectionHandle[ PRIMARY_SELECTION_HANDLE ];
396 if ( !primary.actor )
398 if ( !primary.releasedImage )
400 primary.releasedImage = ResourceImage::New( DEFAULT_SELECTION_HANDLE_ONE );
403 primary.actor = ImageActor::New( primary.releasedImage );
404 #ifdef DECORATOR_DEBUG
405 primary.actor.SetName("SelectionHandleOne");
407 primary.actor.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); // Change to BOTTOM_RIGHT if Look'n'Feel requires handle above text.
408 primary.actor.SetDrawMode( DrawMode::OVERLAY ); // ensure grab handle above text
409 primary.flipped = false;
411 primary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
412 primary.grabArea.SetRelayoutEnabled( true );
413 #ifdef DECORATOR_DEBUG
414 primary.grabArea.SetName("SelectionHandleOneGrabArea");
416 primary.grabArea.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS );
417 primary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
418 primary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
420 mTapDetector.Attach( primary.grabArea );
421 mPanGestureDetector.Attach( primary.grabArea );
422 primary.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnHandleOneTouched );
424 primary.actor.Add( primary.grabArea );
425 mActiveLayer.Add( primary.actor );
428 SelectionHandleImpl& secondary = mSelectionHandle[ SECONDARY_SELECTION_HANDLE ];
429 if ( !secondary.actor )
431 if ( !secondary.releasedImage )
433 secondary.releasedImage = ResourceImage::New( DEFAULT_SELECTION_HANDLE_TWO );
436 secondary.actor = ImageActor::New( secondary.releasedImage );
437 #ifdef DECORATOR_DEBUG
438 secondary.actor.SetName("SelectionHandleTwo");
440 secondary.actor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // Change to BOTTOM_LEFT if Look'n'Feel requires handle above text.
441 secondary.actor.SetDrawMode( DrawMode::OVERLAY ); // ensure grab handle above text
442 secondary.flipped = false;
444 secondary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
445 secondary.grabArea.SetRelayoutEnabled( true );
446 #ifdef DECORATOR_DEBUG
447 secondary.grabArea.SetName("SelectionHandleTwoGrabArea");
449 secondary.grabArea.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS );
450 secondary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
451 secondary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
453 mTapDetector.Attach( secondary.grabArea );
454 mPanGestureDetector.Attach( secondary.grabArea );
455 secondary.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnHandleTwoTouched );
457 secondary.actor.Add( secondary.grabArea );
458 mActiveLayer.Add( secondary.actor );
461 //SetUpHandlePropertyNotifications(); TODO
464 void CreateHighlight()
466 if ( !mHighlightMeshActor )
468 mHighlightMaterial = Material::New( "HighlightMaterial" );
469 mHighlightMaterial.SetDiffuseColor( mHighlightColor );
471 mHighlightMeshData.SetMaterial( mHighlightMaterial );
472 mHighlightMeshData.SetHasNormals( true );
474 mHighlightMesh = Mesh::New( mHighlightMeshData );
476 mHighlightMeshActor = MeshActor::New( mHighlightMesh );
477 #ifdef DECORATOR_DEBUG
478 mHighlightMeshActor.SetName( "HighlightMeshActor" );
480 mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
481 mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET );
483 Actor parent = mTextControlParent.Self();
484 parent.Add( mHighlightMeshActor );
488 void UpdateHighlight()
490 // Construct a Mesh with a texture to be used as the highlight 'box' for selected text
492 // Example scenarios where mesh is made from 3, 1, 2, 2 ,3 or 3 quads.
494 // [ TOP ] [ TOP ] [TOP ] [ TOP ] [ TOP ] [ TOP ]
495 // [ MIDDLE ] [BOTTOM] [BOTTOM] [ MIDDLE ] [ MIDDLE ]
496 // [ BOTTOM] [ MIDDLE ] [ MIDDLE ]
497 // [BOTTOM] [ MIDDLE ]
500 // Each quad is created as 2 triangles.
501 // Middle is just 1 quad regardless of its size.
515 if ( mHighlightMesh && mHighlightMaterial && !mHighlightQuadList.empty() )
517 MeshData::VertexContainer vertices;
518 Dali::MeshData::FaceIndices faceIndices;
520 std::vector<QuadCoordinates>::iterator iter = mHighlightQuadList.begin();
521 std::vector<QuadCoordinates>::iterator endIter = mHighlightQuadList.end();
523 // vertex position defaults to (0 0 0)
524 MeshData::Vertex vertex;
525 // set normal for all vertices as (0 0 1) pointing outward from TextInput Actor.
528 for(std::size_t v = 0; iter != endIter; ++iter,v+=4 )
530 // Add each quad geometry (a sub-selection) to the mesh data.
540 QuadCoordinates& quad = *iter;
542 vertex.x = quad.min.x;
543 vertex.y = quad.min.y;
544 vertices.push_back( vertex );
547 vertex.x = quad.max.x;
548 vertex.y = quad.min.y;
549 vertices.push_back( vertex );
552 vertex.x = quad.min.x;
553 vertex.y = quad.max.y;
554 vertices.push_back( vertex );
556 // bottom-right (v+3)
557 vertex.x = quad.max.x;
558 vertex.y = quad.max.y;
559 vertices.push_back( vertex );
561 // triangle A (3, 1, 0)
562 faceIndices.push_back( v + 3 );
563 faceIndices.push_back( v + 1 );
564 faceIndices.push_back( v );
566 // triangle B (0, 2, 3)
567 faceIndices.push_back( v );
568 faceIndices.push_back( v + 2 );
569 faceIndices.push_back( v + 3 );
571 mHighlightMeshData.SetFaceIndices( faceIndices );
574 BoneContainer bones(0); // passed empty as bones not required
575 mHighlightMeshData.SetData( vertices, faceIndices, bones, mHighlightMaterial );
576 mHighlightMesh.UpdateMeshData( mHighlightMeshData );
580 void OnTap( Actor actor, const TapGesture& tap )
582 if( actor == mGrabHandle )
588 void OnPan( Actor actor, const PanGesture& gesture )
590 if( actor == mGrabArea )
592 if( Gesture::Started == gesture.state )
594 mGrabDisplacementX = mGrabDisplacementY = 0;
597 mGrabDisplacementX += gesture.displacement.x;
598 mGrabDisplacementY += gesture.displacement.y;
600 float x = mCursor[PRIMARY_CURSOR].x + mGrabDisplacementX;
601 float y = mCursor[PRIMARY_CURSOR].y + mCursor[PRIMARY_CURSOR].lineHeight*0.5f + mGrabDisplacementY;
603 if( Gesture::Started == gesture.state ||
604 Gesture::Continuing == gesture.state )
606 mObserver.GrabHandleEvent( GRAB_HANDLE_PRESSED, x, y );
608 else if( Gesture::Finished == gesture.state ||
609 Gesture::Cancelled == gesture.state )
611 mObserver.GrabHandleEvent( GRAB_HANDLE_RELEASED, x, y );
616 bool OnHandleOneTouched( Actor actor, const TouchEvent& touch )
622 bool OnHandleTwoTouched( Actor actor, const TouchEvent& touch )
629 Internal::Control& mTextControlParent;
632 Layer mActiveLayer; // Layer for active handles and alike that ensures they are above all else.
634 unsigned int mActiveCursor;
635 bool mActiveGrabHandle;
636 bool mActiveSelection;
637 bool mActiveCopyPastePopup;
639 CursorImpl mCursor[CURSOR_COUNT];
641 Timer mCursorBlinkTimer; // Timer to signal cursor to blink
642 unsigned int mCursorBlinkInterval;
643 float mCursorBlinkDuration;
644 bool mCursorBlinkStatus; // Flag to switch between blink on and blink off
646 ImageActor mPrimaryCursor;
647 ImageActor mSecondaryCursor;
649 ImageActor mGrabHandle;
651 float mGrabDisplacementX;
652 float mGrabDisplacementY;
654 SelectionHandleImpl mSelectionHandle[SELECTION_HANDLE_COUNT];
656 MeshActor mHighlightMeshActor; ///< Mesh Actor to display highlight
657 Mesh mHighlightMesh; ///< Mesh for highlight
658 MeshData mHighlightMeshData; ///< Mesh Data for highlight
659 Material mHighlightMaterial; ///< Material used for highlight
660 Vector4 mHighlightColor; ///< Color of the highlight
661 QuadContainer mHighlightQuadList; ///< Sub-selections that combine to create the complete selection highlight
663 TextSelectionPopup mCopyPastePopup;
666 Image mGrabHandleImage;
668 TapGestureDetector mTapDetector;
669 PanGestureDetector mPanGestureDetector;
671 Rect<int> mBoundingBox;
674 DecoratorPtr Decorator::New( Internal::Control& parent, Observer& observer )
676 return DecoratorPtr( new Decorator(parent, observer) );
679 void Decorator::SetBoundingBox( const Rect<int>& boundingBox )
681 mImpl->mBoundingBox = boundingBox;
684 const Rect<int>& Decorator::GetBoundingBox() const
686 return mImpl->mBoundingBox;
689 void Decorator::Relayout( const Vector2& size, const Vector2& scrollPosition )
691 mImpl->Relayout( size, scrollPosition );
696 void Decorator::SetActiveCursor( ActiveCursor activeCursor )
698 mImpl->mActiveCursor = activeCursor;
701 unsigned int Decorator::GetActiveCursor() const
703 return mImpl->mActiveCursor;
706 void Decorator::SetPosition( Cursor cursor, float x, float y, float cursorHeight, float lineHeight )
708 // Adjust grab handle displacement
709 mImpl->mGrabDisplacementX -= x - mImpl->mCursor[cursor].x;
710 mImpl->mGrabDisplacementY -= y - mImpl->mCursor[cursor].y;
712 mImpl->mCursor[cursor].x = x;
713 mImpl->mCursor[cursor].y = y;
714 mImpl->mCursor[cursor].cursorHeight = cursorHeight;
715 mImpl->mCursor[cursor].lineHeight = lineHeight;
718 void Decorator::GetPosition( Cursor cursor, float& x, float& y, float& cursorHeight, float& lineHeight ) const
720 x = mImpl->mCursor[cursor].x;
721 y = mImpl->mCursor[cursor].y;
722 cursorHeight = mImpl->mCursor[cursor].cursorHeight;
723 lineHeight = mImpl->mCursor[cursor].lineHeight;
726 void Decorator::SetColor( Cursor cursor, const Dali::Vector4& color )
728 mImpl->mCursor[cursor].color = color;
731 const Dali::Vector4& Decorator::GetColor( Cursor cursor ) const
733 return mImpl->mCursor[cursor].color;
736 void Decorator::StartCursorBlink()
738 if ( !mImpl->mCursorBlinkTimer )
740 mImpl->mCursorBlinkTimer = Timer::New( mImpl->mCursorBlinkInterval );
741 mImpl->mCursorBlinkTimer.TickSignal().Connect( mImpl, &Decorator::Impl::OnCursorBlinkTimerTick );
744 if ( !mImpl->mCursorBlinkTimer.IsRunning() )
746 mImpl->mCursorBlinkTimer.Start();
750 void Decorator::StopCursorBlink()
752 if ( mImpl->mCursorBlinkTimer )
754 mImpl->mCursorBlinkTimer.Stop();
758 void Decorator::SetCursorBlinkInterval( float seconds )
760 mImpl->mCursorBlinkInterval = seconds*MILLISECONDS; // Convert to milliseconds
763 float Decorator::GetCursorBlinkInterval() const
765 return mImpl->mCursorBlinkInterval;
768 void Decorator::SetCursorBlinkDuration( float seconds )
770 mImpl->mCursorBlinkDuration = seconds;
773 float Decorator::GetCursorBlinkDuration() const
775 return mImpl->mCursorBlinkDuration;
780 void Decorator::SetGrabHandleActive( bool active )
782 mImpl->mActiveGrabHandle = active;
785 bool Decorator::IsGrabHandleActive() const
787 return mImpl->mActiveGrabHandle;
790 void Decorator::SetGrabHandleImage( Dali::Image image )
792 mImpl->mGrabHandleImage = image;
795 Dali::Image Decorator::GetGrabHandleImage() const
797 return mImpl->mGrabHandleImage;
802 void Decorator::SetSelectionActive( bool active )
804 mImpl->mActiveSelection = active;
807 bool Decorator::IsSelectionActive() const
809 return mImpl->mActiveSelection;
812 void Decorator::SetPosition( SelectionHandle handle, float x, float y, float height )
814 mImpl->mSelectionHandle[handle].x = x;
815 mImpl->mSelectionHandle[handle].y = y;
816 mImpl->mSelectionHandle[handle].lineHeight = height;
819 void Decorator::GetPosition( SelectionHandle handle, float& x, float& y, float& height ) const
821 x = mImpl->mSelectionHandle[handle].x;
822 y = mImpl->mSelectionHandle[handle].y;
823 height = mImpl->mSelectionHandle[handle].lineHeight;
826 void Decorator::SetImage( SelectionHandle handle, SelectionHandleState state, Dali::Image image )
828 if( SELECTION_HANDLE_PRESSED == state )
830 mImpl->mSelectionHandle[handle].pressedImage = image;
834 mImpl->mSelectionHandle[handle].releasedImage = image;
838 Dali::Image Decorator::GetImage( SelectionHandle handle, SelectionHandleState state ) const
840 if( SELECTION_HANDLE_PRESSED == state )
842 return mImpl->mSelectionHandle[handle].pressedImage;
845 return mImpl->mSelectionHandle[handle].releasedImage;
848 void Decorator::AddHighlight( float x1, float y1, float x2, float y2 )
850 mImpl->mHighlightQuadList.push_back( QuadCoordinates(x1, y1, x2, y2) );
853 void Decorator::ClearHighlights()
855 mImpl->mHighlightQuadList.clear();
858 void Decorator::SetPopupActive( bool active )
860 mImpl->mActiveCopyPastePopup = active;
863 bool Decorator::IsPopupActive() const
865 return mImpl->mActiveCopyPastePopup ;
868 Decorator::~Decorator()
873 Decorator::Decorator( Dali::Toolkit::Internal::Control& parent, Observer& observer )
876 mImpl = new Decorator::Impl( parent, observer );
881 } // namespace Toolkit