X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-input%2Ftext-input-impl.cpp;h=bc490e2ac5e0b02199cd4331e4a3b6fa9d82df9e;hb=refs%2Fchanges%2F46%2F36346%2F1;hp=e891f5b20769a13c9a078d9d4f52b63c5ce7a6f7;hpb=2ddfbb9e23a7c3fc30e604236c41e0ef6d2ed6a2;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/text-input/text-input-impl.cpp b/dali-toolkit/internal/controls/text-input/text-input-impl.cpp index e891f5b..bc490e2 100644 --- a/dali-toolkit/internal/controls/text-input/text-input-impl.cpp +++ b/dali-toolkit/internal/controls/text-input/text-input-impl.cpp @@ -30,6 +30,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include @@ -197,19 +198,28 @@ namespace Internal namespace { +// Signals + +const char* const SIGNAL_START_INPUT = "start-input"; +const char* const SIGNAL_END_INPUT = "end-input"; +const char* const SIGNAL_STYLE_CHANGED = "style-changed"; +const char* const SIGNAL_MAX_INPUT_CHARACTERS_REACHED = "max-input-characters-reached"; +const char* const SIGNAL_TOOLBAR_DISPLAYED = "toolbar-displayed"; +const char* const SIGNAL_TEXT_EXCEED_BOUNDARIES = "text-exceed-boundaries"; + BaseHandle Create() { return Toolkit::TextInput::New(); } -TypeRegistration typeRegistration( typeid(Toolkit::TextInput), typeid(Toolkit::Control), Create ); +TypeRegistration typeRegistration( typeid( Toolkit::TextInput ), typeid( Toolkit::Control ), Create ); -SignalConnectorType signalConnector1( typeRegistration, Toolkit::TextInput::SIGNAL_START_INPUT, &TextInput::DoConnectSignal ); -SignalConnectorType signalConnector2( typeRegistration, Toolkit::TextInput::SIGNAL_END_INPUT, &TextInput::DoConnectSignal ); -SignalConnectorType signalConnector3( typeRegistration, Toolkit::TextInput::SIGNAL_STYLE_CHANGED, &TextInput::DoConnectSignal ); -SignalConnectorType signalConnector4( typeRegistration, Toolkit::TextInput::SIGNAL_MAX_INPUT_CHARACTERS_REACHED, &TextInput::DoConnectSignal ); -SignalConnectorType signalConnector5( typeRegistration, Toolkit::TextInput::SIGNAL_TOOLBAR_DISPLAYED, &TextInput::DoConnectSignal ); -SignalConnectorType signalConnector6( typeRegistration, Toolkit::TextInput::SIGNAL_TEXT_EXCEED_BOUNDARIES, &TextInput::DoConnectSignal ); +SignalConnectorType signalConnector1( typeRegistration, SIGNAL_START_INPUT, &TextInput::DoConnectSignal ); +SignalConnectorType signalConnector2( typeRegistration, SIGNAL_END_INPUT, &TextInput::DoConnectSignal ); +SignalConnectorType signalConnector3( typeRegistration, SIGNAL_STYLE_CHANGED, &TextInput::DoConnectSignal ); +SignalConnectorType signalConnector4( typeRegistration, SIGNAL_MAX_INPUT_CHARACTERS_REACHED, &TextInput::DoConnectSignal ); +SignalConnectorType signalConnector5( typeRegistration, SIGNAL_TOOLBAR_DISPLAYED, &TextInput::DoConnectSignal ); +SignalConnectorType signalConnector6( typeRegistration, SIGNAL_TEXT_EXCEED_BOUNDARIES, &TextInput::DoConnectSignal ); } @@ -578,25 +588,29 @@ bool TextInput::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* Dali::BaseHandle handle( object ); bool connected( true ); - Toolkit::TextInput textInput = Toolkit::TextInput::DownCast(handle); + Toolkit::TextInput textInput = Toolkit::TextInput::DownCast( handle ); - if( Toolkit::TextInput::SIGNAL_START_INPUT == signalName ) + if( 0 == strcmp( signalName.c_str(), SIGNAL_START_INPUT ) ) { textInput.InputStartedSignal().Connect( tracker, functor ); } - else if( Toolkit::TextInput::SIGNAL_END_INPUT == signalName ) + else if( 0 == strcmp( signalName.c_str(), SIGNAL_END_INPUT ) ) { textInput.InputFinishedSignal().Connect( tracker, functor ); } - else if( Toolkit::TextInput::SIGNAL_STYLE_CHANGED == signalName ) + else if( 0 == strcmp( signalName.c_str(), SIGNAL_STYLE_CHANGED ) ) { textInput.StyleChangedSignal().Connect( tracker, functor ); } - else if( Toolkit::TextInput::SIGNAL_MAX_INPUT_CHARACTERS_REACHED == signalName ) + else if( 0 == strcmp( signalName.c_str(), SIGNAL_MAX_INPUT_CHARACTERS_REACHED ) ) { textInput.MaxInputCharactersReachedSignal().Connect( tracker, functor ); } - else if( Toolkit::TextInput::SIGNAL_TEXT_EXCEED_BOUNDARIES == signalName ) + else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOOLBAR_DISPLAYED ) ) + { + textInput.CutAndPasteToolBarDisplayedSignal().Connect( tracker, functor ); + } + else if( 0 == strcmp( signalName.c_str(), SIGNAL_TEXT_EXCEED_BOUNDARIES ) ) { textInput.InputTextExceedBoundariesSignal().Connect( tracker, functor ); } @@ -2118,8 +2132,7 @@ void TextInput::SetUpTouchEvents() if ( !mDoubleTapDetector ) { - mDoubleTapDetector = TapGestureDetector::New(); - mDoubleTapDetector.SetTapsRequired( 2 ); + mDoubleTapDetector = TapGestureDetector::New( 2 ); mDoubleTapDetector.DetectedSignal().Connect(this, &TextInput::OnDoubleTap); // Only attach and detach the actor to the double tap detector when we enter/leave edit mode @@ -3021,7 +3034,7 @@ void TextInput::CreateGrabHandle( Dali::Image image ) { if ( !image ) { - mGrabHandleImage = Image::New(DEFAULT_GRAB_HANDLE); + mGrabHandleImage = ResourceImage::New(DEFAULT_GRAB_HANDLE); } else { @@ -3047,7 +3060,8 @@ void TextInput::CreateGrabArea( Actor& parent ) mGrabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move mGrabArea.SetName( "GrabArea" ); mGrabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); - mGrabArea.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE ) ) ); // grab area to be larger than text actor + mGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + mGrabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE ); mGrabArea.TouchedSignal().Connect(this,&TextInput::OnPressDown); mTapDetector.Attach( mGrabArea ); mPanGestureDetector.Attach( mGrabArea ); @@ -3226,37 +3240,37 @@ void TextInput::SetUpHandlePropertyNotifications() Vector3 handlesize = GetSelectionHandleSize(); // Exceeding horizontal boundary - PropertyNotification leftNotification = mSelectionHandleOne.AddPropertyNotification( Actor::WORLD_POSITION_X, LessThanCondition( mBoundingRectangleWorldCoordinates.x + handlesize.x) ); + PropertyNotification leftNotification = mSelectionHandleOne.AddPropertyNotification( Actor::Property::WORLD_POSITION_X, LessThanCondition( mBoundingRectangleWorldCoordinates.x + handlesize.x) ); leftNotification.NotifySignal().Connect( this, &TextInput::OnLeftBoundaryExceeded ); - PropertyNotification rightNotification = mSelectionHandleTwo.AddPropertyNotification( Actor::WORLD_POSITION_X, GreaterThanCondition( mBoundingRectangleWorldCoordinates.z - handlesize.x ) ); + PropertyNotification rightNotification = mSelectionHandleTwo.AddPropertyNotification( Actor::Property::WORLD_POSITION_X, GreaterThanCondition( mBoundingRectangleWorldCoordinates.z - handlesize.x ) ); rightNotification.NotifySignal().Connect( this, &TextInput::OnRightBoundaryExceeded ); // Within horizontal boundary - PropertyNotification leftLeaveNotification = mSelectionHandleOne.AddPropertyNotification( Actor::WORLD_POSITION_X, GreaterThanCondition( mBoundingRectangleWorldCoordinates.x + 2*handlesize.x ) ); + PropertyNotification leftLeaveNotification = mSelectionHandleOne.AddPropertyNotification( Actor::Property::WORLD_POSITION_X, GreaterThanCondition( mBoundingRectangleWorldCoordinates.x + 2*handlesize.x ) ); leftLeaveNotification.NotifySignal().Connect( this, &TextInput::OnReturnToLeftBoundary ); - PropertyNotification rightLeaveNotification = mSelectionHandleTwo.AddPropertyNotification( Actor::WORLD_POSITION_X, LessThanCondition( mBoundingRectangleWorldCoordinates.z - 2*handlesize.x ) ); + PropertyNotification rightLeaveNotification = mSelectionHandleTwo.AddPropertyNotification( Actor::Property::WORLD_POSITION_X, LessThanCondition( mBoundingRectangleWorldCoordinates.z - 2*handlesize.x ) ); rightLeaveNotification.NotifySignal().Connect( this, &TextInput::OnReturnToRightBoundary ); // Exceeding vertical boundary - PropertyNotification verticalExceedNotificationOne = mSelectionHandleOne.AddPropertyNotification( Actor::WORLD_POSITION_Y, + PropertyNotification verticalExceedNotificationOne = mSelectionHandleOne.AddPropertyNotification( Actor::Property::WORLD_POSITION_Y, OutsideCondition( mBoundingRectangleWorldCoordinates.y + handlesize.y, mBoundingRectangleWorldCoordinates.w - handlesize.y ) ); verticalExceedNotificationOne.NotifySignal().Connect( this, &TextInput::OnHandleOneLeavesBoundary ); - PropertyNotification verticalExceedNotificationTwo = mSelectionHandleTwo.AddPropertyNotification( Actor::WORLD_POSITION_Y, + PropertyNotification verticalExceedNotificationTwo = mSelectionHandleTwo.AddPropertyNotification( Actor::Property::WORLD_POSITION_Y, OutsideCondition( mBoundingRectangleWorldCoordinates.y + handlesize.y, mBoundingRectangleWorldCoordinates.w - handlesize.y ) ); verticalExceedNotificationTwo.NotifySignal().Connect( this, &TextInput::OnHandleTwoLeavesBoundary ); // Within vertical boundary - PropertyNotification verticalWithinNotificationOne = mSelectionHandleOne.AddPropertyNotification( Actor::WORLD_POSITION_Y, + PropertyNotification verticalWithinNotificationOne = mSelectionHandleOne.AddPropertyNotification( Actor::Property::WORLD_POSITION_Y, InsideCondition( mBoundingRectangleWorldCoordinates.y + handlesize.y, mBoundingRectangleWorldCoordinates.w - handlesize.y ) ); verticalWithinNotificationOne.NotifySignal().Connect( this, &TextInput::OnHandleOneWithinBoundary ); - PropertyNotification verticalWithinNotificationTwo = mSelectionHandleTwo.AddPropertyNotification( Actor::WORLD_POSITION_Y, + PropertyNotification verticalWithinNotificationTwo = mSelectionHandleTwo.AddPropertyNotification( Actor::Property::WORLD_POSITION_Y, InsideCondition( mBoundingRectangleWorldCoordinates.y + handlesize.y, mBoundingRectangleWorldCoordinates.w - handlesize.y ) ); verticalWithinNotificationTwo.NotifySignal().Connect( this, &TextInput::OnHandleTwoWithinBoundary ); @@ -3270,8 +3284,8 @@ void TextInput::CreateSelectionHandles( std::size_t start, std::size_t end, Dali if ( !mSelectionHandleOne ) { // create normal and pressed images - mSelectionHandleOneImage = Image::New( DEFAULT_SELECTION_HANDLE_ONE ); - mSelectionHandleOneImagePressed = Image::New( DEFAULT_SELECTION_HANDLE_ONE_PRESSED ); + mSelectionHandleOneImage = ResourceImage::New( DEFAULT_SELECTION_HANDLE_ONE ); + mSelectionHandleOneImagePressed = ResourceImage::New( DEFAULT_SELECTION_HANDLE_ONE_PRESSED ); mSelectionHandleOne = ImageActor::New( mSelectionHandleOneImage ); mSelectionHandleOne.SetName("SelectionHandleOne"); @@ -3283,7 +3297,8 @@ void TextInput::CreateSelectionHandles( std::size_t start, std::size_t end, Dali mHandleOneGrabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move mHandleOneGrabArea.SetName("SelectionHandleOneGrabArea"); - mHandleOneGrabArea.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE ) ) ); // grab area to be larger than text actor + mHandleOneGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + mHandleOneGrabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE ); mHandleOneGrabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); mTapDetector.Attach( mHandleOneGrabArea ); @@ -3298,8 +3313,8 @@ void TextInput::CreateSelectionHandles( std::size_t start, std::size_t end, Dali if ( !mSelectionHandleTwo ) { // create normal and pressed images - mSelectionHandleTwoImage = Image::New( DEFAULT_SELECTION_HANDLE_TWO ); - mSelectionHandleTwoImagePressed = Image::New( DEFAULT_SELECTION_HANDLE_TWO_PRESSED ); + mSelectionHandleTwoImage = ResourceImage::New( DEFAULT_SELECTION_HANDLE_TWO ); + mSelectionHandleTwoImagePressed = ResourceImage::New( DEFAULT_SELECTION_HANDLE_TWO_PRESSED ); mSelectionHandleTwo = ImageActor::New( mSelectionHandleTwoImage ); mSelectionHandleTwo.SetName("SelectionHandleTwo"); @@ -3310,7 +3325,8 @@ void TextInput::CreateSelectionHandles( std::size_t start, std::size_t end, Dali mHandleTwoGrabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move mHandleTwoGrabArea.SetName("SelectionHandleTwoGrabArea"); - mHandleTwoGrabArea.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE ) ) ); // grab area to be larger than text actor + mHandleTwoGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + mHandleTwoGrabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE ); mHandleTwoGrabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); mTapDetector.Attach( mHandleTwoGrabArea ); @@ -4877,7 +4893,6 @@ void TextInput::CreateHighlight() mHighlightMeshActor.SetParentOrigin( ParentOrigin::TOP_LEFT ); mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET ); - mHighlightMeshActor.SetAffectedByLighting(false); Self().Add(mHighlightMeshActor); }