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
120 color(Dali::Color::WHITE)
131 struct SelectionHandleImpl
133 SelectionHandleImpl()
143 float cursorHeight; ///< Not the handle height
153 Impl( Dali::Toolkit::Internal::Control& parent, Observer& observer )
154 : mTextControlParent(parent),
156 mActiveCursor(ACTIVE_CURSOR_NONE),
157 mActiveGrabHandle(false),
158 mActiveSelection( false ),
159 mActiveCopyPastePopup( false ),
160 mCursorBlinkInterval( CURSOR_BLINK_INTERVAL ),
161 mCursorBlinkDuration( 0.0f ),
162 mCursorBlinkStatus( true ),
163 mGrabDisplacementX( 0.0f ),
164 mGrabDisplacementY( 0.0f ),
165 mHighlightColor( 0.07f, 0.41f, 0.59f, 1.0f ), // light blue
166 mBoundingBox( Rect<int>() )
171 * Relayout of the decorations owned by the decorator.
172 * @param[in] size The Size of the UI control the decorater is adding it's decorations to.
174 void Relayout( const Vector2& size, const Vector2& scrollPosition )
176 // TODO - Remove this if nothing is active
179 // Show or hide the cursors
183 mPrimaryCursor.SetPosition( mCursor[PRIMARY_CURSOR].x + scrollPosition.x,
184 mCursor[PRIMARY_CURSOR].y + scrollPosition.y );
185 mPrimaryCursor.SetSize( Vector2( 1.0f, mCursor[PRIMARY_CURSOR].height ) );
187 if( mSecondaryCursor )
189 mSecondaryCursor.SetPosition( mCursor[SECONDARY_CURSOR].x + scrollPosition.x,
190 mCursor[SECONDARY_CURSOR].y + scrollPosition.y );
191 mSecondaryCursor.SetSize( Vector2( 1.0f, mCursor[SECONDARY_CURSOR].height ) );
194 // Show or hide the grab handle
195 if( mActiveGrabHandle )
201 mGrabHandle.SetPosition( mCursor[PRIMARY_CURSOR].x + scrollPosition.x,
202 mCursor[PRIMARY_CURSOR].y + scrollPosition.y + mCursor[PRIMARY_CURSOR].height );
204 else if( mGrabHandle )
206 UnparentAndReset( mGrabHandle );
209 // Show or hide the selection handles/highlight
210 if( mActiveSelection )
214 CreateSelectionHandles();
216 SelectionHandleImpl& primary = mSelectionHandle[ PRIMARY_SELECTION_HANDLE ];
217 primary.actor.SetPosition( primary.x + scrollPosition.x,
218 primary.y + scrollPosition.y + primary.cursorHeight );
220 SelectionHandleImpl& secondary = mSelectionHandle[ SECONDARY_SELECTION_HANDLE ];
221 secondary.actor.SetPosition( secondary.x + scrollPosition.x,
222 secondary.y + scrollPosition.y + secondary.cursorHeight );
229 UnparentAndReset( mSelectionHandle[ PRIMARY_SELECTION_HANDLE ].actor );
230 UnparentAndReset( mSelectionHandle[ SECONDARY_SELECTION_HANDLE ].actor );
231 UnparentAndReset( mHighlightMeshActor );
234 if ( mActiveCopyPastePopup )
236 if ( !mCopyPastePopup )
238 mCopyPastePopup = TextSelectionPopup::New();
239 mActiveLayer.Add ( mCopyPastePopup );
241 mCopyPastePopup.SetPosition( Vector3( 200.0f, -100.0f, 0.0f ) ); //todo grabhandle or selection handle positions to be used
245 if ( mCopyPastePopup )
247 UnparentAndReset( mCopyPastePopup );
252 void CreateCursor( ImageActor& cursor )
254 cursor = CreateSolidColorActor( Color::WHITE );
255 cursor.SetParentOrigin( ParentOrigin::TOP_LEFT ); // Need to set the default parent origin as CreateSolidColorActor() sets a different one.
256 cursor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
257 cursor.SetRelayoutEnabled( false );
260 // Add or Remove cursor(s) from parent
263 if( mActiveCursor == ACTIVE_CURSOR_NONE )
265 UnparentAndReset( mPrimaryCursor );
266 UnparentAndReset( mSecondaryCursor );
270 /* Create Primary and or Secondary Cursor(s) if active and add to parent */
271 if ( mActiveCursor == ACTIVE_CURSOR_PRIMARY ||
272 mActiveCursor == ACTIVE_CURSOR_BOTH )
274 if ( !mPrimaryCursor )
276 CreateCursor( mPrimaryCursor );
277 #ifdef DECORATOR_DEBUG
278 mPrimaryCursor.SetName( "PrimaryCursorActor" );
280 mActiveLayer.Add( mPrimaryCursor);
284 if ( mActiveCursor == ACTIVE_CURSOR_BOTH )
286 if ( !mSecondaryCursor )
288 CreateCursor( mSecondaryCursor );
289 #ifdef DECORATOR_DEBUG
290 mSecondaryCursor.SetName( "SecondaryCursorActor" );
292 mActiveLayer.Add( mSecondaryCursor);
298 bool OnCursorBlinkTimerTick()
301 if ( mPrimaryCursor )
303 mPrimaryCursor.SetVisible( mCursorBlinkStatus );
305 if ( mSecondaryCursor )
307 mSecondaryCursor.SetVisible( mCursorBlinkStatus );
310 mCursorBlinkStatus = !mCursorBlinkStatus;
315 void SetupTouchEvents()
319 mTapDetector = TapGestureDetector::New();
320 mTapDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnTap );
323 if ( !mPanGestureDetector )
325 mPanGestureDetector = PanGestureDetector::New();
326 mPanGestureDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnPan );
330 void CreateActiveLayer()
334 Actor parent = mTextControlParent.Self();
336 mActiveLayer = Layer::New();
337 #ifdef DECORATOR_DEBUG
338 mActiveLayer.SetName ( "ActiveLayerActor" );
341 mActiveLayer.SetParentOrigin( ParentOrigin::CENTER );
342 mActiveLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
343 mActiveLayer.SetPositionInheritanceMode( USE_PARENT_POSITION );
345 parent.Add( mActiveLayer );
348 mActiveLayer.RaiseToTop();
351 void CreateGrabHandle()
355 if ( !mGrabHandleImage )
357 mGrabHandleImage = ResourceImage::New( DEFAULT_GRAB_HANDLE_IMAGE );
360 mGrabHandle = ImageActor::New( mGrabHandleImage );
361 #ifdef DECORATOR_DEBUG
362 mGrabHandle.SetName( "GrabHandleActor" );
364 mGrabHandle.SetAnchorPoint( AnchorPoint::TOP_CENTER );
365 mGrabHandle.SetDrawMode( DrawMode::OVERLAY );
366 // Area that Grab handle responds to, larger than actual handle so easier to move
367 #ifdef DECORATOR_DEBUG
368 mGrabArea = Toolkit::CreateSolidColorActor( Vector4(0.0f, 0.0f, 0.0f, 0.0f), true, Color::RED, 1 );
369 mGrabArea.SetName( "GrabArea" );
371 mGrabArea = Actor::New();
372 mGrabArea.SetRelayoutEnabled( true );
374 mGrabArea.SetParentOrigin( ParentOrigin::TOP_CENTER );
375 mGrabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
376 mGrabArea.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
377 mGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
378 mGrabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE );
379 mGrabHandle.Add( mGrabArea );
381 mTapDetector.Attach( mGrabArea );
382 mPanGestureDetector.Attach( mGrabArea );
384 mActiveLayer.Add(mGrabHandle);
388 void CreateSelectionHandles()
390 SelectionHandleImpl& primary = mSelectionHandle[ PRIMARY_SELECTION_HANDLE ];
391 if ( !primary.actor )
393 if ( !primary.releasedImage )
395 primary.releasedImage = ResourceImage::New( DEFAULT_SELECTION_HANDLE_ONE );
398 primary.actor = ImageActor::New( primary.releasedImage );
399 #ifdef DECORATOR_DEBUG
400 primary.actor.SetName("SelectionHandleOne");
402 primary.actor.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); // Change to BOTTOM_RIGHT if Look'n'Feel requires handle above text.
403 primary.actor.SetDrawMode( DrawMode::OVERLAY ); // ensure grab handle above text
404 primary.flipped = false;
406 primary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
407 primary.grabArea.SetRelayoutEnabled( true );
408 #ifdef DECORATOR_DEBUG
409 primary.grabArea.SetName("SelectionHandleOneGrabArea");
411 primary.grabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
412 primary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
413 primary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
415 mTapDetector.Attach( primary.grabArea );
416 mPanGestureDetector.Attach( primary.grabArea );
417 primary.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnHandleOneTouched );
419 primary.actor.Add( primary.grabArea );
420 mActiveLayer.Add( primary.actor );
423 SelectionHandleImpl& secondary = mSelectionHandle[ SECONDARY_SELECTION_HANDLE ];
424 if ( !secondary.actor )
426 if ( !secondary.releasedImage )
428 secondary.releasedImage = ResourceImage::New( DEFAULT_SELECTION_HANDLE_TWO );
431 secondary.actor = ImageActor::New( secondary.releasedImage );
432 #ifdef DECORATOR_DEBUG
433 secondary.actor.SetName("SelectionHandleTwo");
435 secondary.actor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // Change to BOTTOM_LEFT if Look'n'Feel requires handle above text.
436 secondary.actor.SetDrawMode( DrawMode::OVERLAY ); // ensure grab handle above text
437 secondary.flipped = false;
439 secondary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
440 secondary.grabArea.SetRelayoutEnabled( true );
441 #ifdef DECORATOR_DEBUG
442 secondary.grabArea.SetName("SelectionHandleTwoGrabArea");
444 secondary.grabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
445 secondary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
446 secondary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
448 mTapDetector.Attach( secondary.grabArea );
449 mPanGestureDetector.Attach( secondary.grabArea );
450 secondary.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnHandleTwoTouched );
452 secondary.actor.Add( secondary.grabArea );
453 mActiveLayer.Add( secondary.actor );
456 //SetUpHandlePropertyNotifications(); TODO
459 void CreateHighlight()
461 if ( !mHighlightMeshActor )
463 mHighlightMaterial = Material::New( "HighlightMaterial" );
464 mHighlightMaterial.SetDiffuseColor( mHighlightColor );
466 mHighlightMeshData.SetMaterial( mHighlightMaterial );
467 mHighlightMeshData.SetHasNormals( true );
469 mHighlightMesh = Mesh::New( mHighlightMeshData );
471 mHighlightMeshActor = MeshActor::New( mHighlightMesh );
472 #ifdef DECORATOR_DEBUG
473 mHighlightMeshActor.SetName( "HighlightMeshActor" );
475 mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
476 mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET );
478 Actor parent = mTextControlParent.Self();
479 parent.Add( mHighlightMeshActor );
483 void UpdateHighlight()
485 // Construct a Mesh with a texture to be used as the highlight 'box' for selected text
487 // Example scenarios where mesh is made from 3, 1, 2, 2 ,3 or 3 quads.
489 // [ TOP ] [ TOP ] [TOP ] [ TOP ] [ TOP ] [ TOP ]
490 // [ MIDDLE ] [BOTTOM] [BOTTOM] [ MIDDLE ] [ MIDDLE ]
491 // [ BOTTOM] [ MIDDLE ] [ MIDDLE ]
492 // [BOTTOM] [ MIDDLE ]
495 // Each quad is created as 2 triangles.
496 // Middle is just 1 quad regardless of its size.
510 if ( mHighlightMesh && mHighlightMaterial && !mHighlightQuadList.empty() )
512 MeshData::VertexContainer vertices;
513 Dali::MeshData::FaceIndices faceIndices;
515 std::vector<QuadCoordinates>::iterator iter = mHighlightQuadList.begin();
516 std::vector<QuadCoordinates>::iterator endIter = mHighlightQuadList.end();
518 // vertex position defaults to (0 0 0)
519 MeshData::Vertex vertex;
520 // set normal for all vertices as (0 0 1) pointing outward from TextInput Actor.
523 for(std::size_t v = 0; iter != endIter; ++iter,v+=4 )
525 // Add each quad geometry (a sub-selection) to the mesh data.
535 QuadCoordinates& quad = *iter;
537 vertex.x = quad.min.x;
538 vertex.y = quad.min.y;
539 vertices.push_back( vertex );
542 vertex.x = quad.max.x;
543 vertex.y = quad.min.y;
544 vertices.push_back( vertex );
547 vertex.x = quad.min.x;
548 vertex.y = quad.max.y;
549 vertices.push_back( vertex );
551 // bottom-right (v+3)
552 vertex.x = quad.max.x;
553 vertex.y = quad.max.y;
554 vertices.push_back( vertex );
556 // triangle A (3, 1, 0)
557 faceIndices.push_back( v + 3 );
558 faceIndices.push_back( v + 1 );
559 faceIndices.push_back( v );
561 // triangle B (0, 2, 3)
562 faceIndices.push_back( v );
563 faceIndices.push_back( v + 2 );
564 faceIndices.push_back( v + 3 );
566 mHighlightMeshData.SetFaceIndices( faceIndices );
569 BoneContainer bones(0); // passed empty as bones not required
570 mHighlightMeshData.SetData( vertices, faceIndices, bones, mHighlightMaterial );
571 mHighlightMesh.UpdateMeshData( mHighlightMeshData );
575 void OnTap( Actor actor, const TapGesture& tap )
577 if( actor == mGrabHandle )
583 void OnPan( Actor actor, const PanGesture& gesture )
585 if( actor == mGrabArea )
587 if( Gesture::Started == gesture.state )
589 mGrabDisplacementX = mGrabDisplacementY = 0;
592 mGrabDisplacementX += gesture.displacement.x;
593 mGrabDisplacementY += gesture.displacement.y;
595 float x = mCursor[PRIMARY_CURSOR].x + mGrabDisplacementX;
596 float y = mCursor[PRIMARY_CURSOR].y + mCursor[PRIMARY_CURSOR].height*0.5f + mGrabDisplacementY;
598 if( Gesture::Started == gesture.state ||
599 Gesture::Continuing == gesture.state )
601 mObserver.GrabHandleEvent( GRAB_HANDLE_PRESSED, x, y );
603 else if( Gesture::Finished == gesture.state ||
604 Gesture::Cancelled == gesture.state )
606 mObserver.GrabHandleEvent( GRAB_HANDLE_RELEASED, x, y );
611 bool OnHandleOneTouched( Actor actor, const TouchEvent& touch )
617 bool OnHandleTwoTouched( Actor actor, const TouchEvent& touch )
624 Internal::Control& mTextControlParent;
627 Layer mActiveLayer; // Layer for active handles and alike that ensures they are above all else.
629 unsigned int mActiveCursor;
630 bool mActiveGrabHandle;
631 bool mActiveSelection;
632 bool mActiveCopyPastePopup;
634 CursorImpl mCursor[CURSOR_COUNT];
636 Timer mCursorBlinkTimer; // Timer to signal cursor to blink
637 unsigned int mCursorBlinkInterval;
638 float mCursorBlinkDuration;
639 bool mCursorBlinkStatus; // Flag to switch between blink on and blink off
641 ImageActor mPrimaryCursor;
642 ImageActor mSecondaryCursor;
644 ImageActor mGrabHandle;
646 float mGrabDisplacementX;
647 float mGrabDisplacementY;
649 SelectionHandleImpl mSelectionHandle[SELECTION_HANDLE_COUNT];
651 MeshActor mHighlightMeshActor; ///< Mesh Actor to display highlight
652 Mesh mHighlightMesh; ///< Mesh for highlight
653 MeshData mHighlightMeshData; ///< Mesh Data for highlight
654 Material mHighlightMaterial; ///< Material used for highlight
655 Vector4 mHighlightColor; ///< Color of the highlight
656 QuadContainer mHighlightQuadList; ///< Sub-selections that combine to create the complete selection highlight
658 TextSelectionPopup mCopyPastePopup;
661 Image mGrabHandleImage;
663 TapGestureDetector mTapDetector;
664 PanGestureDetector mPanGestureDetector;
666 Rect<int> mBoundingBox;
669 DecoratorPtr Decorator::New( Internal::Control& parent, Observer& observer )
671 return DecoratorPtr( new Decorator(parent, observer) );
674 void Decorator::SetBoundingBox( const Rect<int>& boundingBox )
676 mImpl->mBoundingBox = boundingBox;
679 const Rect<int>& Decorator::GetBoundingBox() const
681 return mImpl->mBoundingBox;
684 void Decorator::Relayout( const Vector2& size, const Vector2& scrollPosition )
686 mImpl->Relayout( size, scrollPosition );
691 void Decorator::SetActiveCursor( ActiveCursor activeCursor )
693 mImpl->mActiveCursor = activeCursor;
696 unsigned int Decorator::GetActiveCursor() const
698 return mImpl->mActiveCursor;
701 void Decorator::SetPosition( Cursor cursor, float x, float y, float height )
703 // Adjust grab handle displacement
704 mImpl->mGrabDisplacementX -= x - mImpl->mCursor[cursor].x;
705 mImpl->mGrabDisplacementY -= y - mImpl->mCursor[cursor].y;
707 mImpl->mCursor[cursor].x = x;
708 mImpl->mCursor[cursor].y = y;
709 mImpl->mCursor[cursor].height = height;
712 void Decorator::GetPosition( Cursor cursor, float& x, float& y, float& height ) const
714 x = mImpl->mCursor[cursor].x;
715 y = mImpl->mCursor[cursor].y;
716 height = mImpl->mCursor[cursor].height;
719 void Decorator::SetColor( Cursor cursor, const Dali::Vector4& color )
721 mImpl->mCursor[cursor].color = color;
724 const Dali::Vector4& Decorator::GetColor( Cursor cursor ) const
726 return mImpl->mCursor[cursor].color;
729 void Decorator::StartCursorBlink()
731 if ( !mImpl->mCursorBlinkTimer )
733 mImpl->mCursorBlinkTimer = Timer::New( mImpl->mCursorBlinkInterval );
734 mImpl->mCursorBlinkTimer.TickSignal().Connect( mImpl, &Decorator::Impl::OnCursorBlinkTimerTick );
737 if ( !mImpl->mCursorBlinkTimer.IsRunning() )
739 mImpl->mCursorBlinkTimer.Start();
743 void Decorator::StopCursorBlink()
745 if ( mImpl->mCursorBlinkTimer )
747 mImpl->mCursorBlinkTimer.Stop();
751 void Decorator::SetCursorBlinkInterval( float seconds )
753 mImpl->mCursorBlinkInterval = seconds*MILLISECONDS; // Convert to milliseconds
756 float Decorator::GetCursorBlinkInterval() const
758 return mImpl->mCursorBlinkInterval;
761 void Decorator::SetCursorBlinkDuration( float seconds )
763 mImpl->mCursorBlinkDuration = seconds;
766 float Decorator::GetCursorBlinkDuration() const
768 return mImpl->mCursorBlinkDuration;
773 void Decorator::SetGrabHandleActive( bool active )
775 mImpl->mActiveGrabHandle = active;
778 bool Decorator::IsGrabHandleActive() const
780 return mImpl->mActiveGrabHandle;
783 void Decorator::SetGrabHandleImage( Dali::Image image )
785 mImpl->mGrabHandleImage = image;
788 Dali::Image Decorator::GetGrabHandleImage() const
790 return mImpl->mGrabHandleImage;
795 void Decorator::SetSelectionActive( bool active )
797 mImpl->mActiveSelection = active;
800 bool Decorator::IsSelectionActive() const
802 return mImpl->mActiveSelection;
805 void Decorator::SetPosition( SelectionHandle handle, float x, float y, float height )
807 mImpl->mSelectionHandle[handle].x = x;
808 mImpl->mSelectionHandle[handle].y = y;
809 mImpl->mSelectionHandle[handle].cursorHeight = height;
812 void Decorator::GetPosition( SelectionHandle handle, float& x, float& y, float& height ) const
814 x = mImpl->mSelectionHandle[handle].x;
815 y = mImpl->mSelectionHandle[handle].y;
816 height = mImpl->mSelectionHandle[handle].cursorHeight;
819 void Decorator::SetImage( SelectionHandle handle, SelectionHandleState state, Dali::Image image )
821 if( SELECTION_HANDLE_PRESSED == state )
823 mImpl->mSelectionHandle[handle].pressedImage = image;
827 mImpl->mSelectionHandle[handle].releasedImage = image;
831 Dali::Image Decorator::GetImage( SelectionHandle handle, SelectionHandleState state ) const
833 if( SELECTION_HANDLE_PRESSED == state )
835 return mImpl->mSelectionHandle[handle].pressedImage;
838 return mImpl->mSelectionHandle[handle].releasedImage;
841 void Decorator::AddHighlight( float x1, float y1, float x2, float y2 )
843 mImpl->mHighlightQuadList.push_back( QuadCoordinates(x1, y1, x2, y2) );
846 void Decorator::ClearHighlights()
848 mImpl->mHighlightQuadList.clear();
851 void Decorator::SetPopupActive( bool active )
853 mImpl->mActiveCopyPastePopup = active;
856 bool Decorator::IsPopupActive() const
858 return mImpl->mActiveCopyPastePopup ;
861 Decorator::~Decorator()
866 Decorator::Decorator( Dali::Toolkit::Internal::Control& parent, Observer& observer )
869 mImpl = new Decorator::Impl( parent, observer );
874 } // namespace Toolkit