X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-field-impl.cpp;h=5a6ce6231c7c2e6205c3bf67a00506496fd75916;hb=fd7432d5ceddf91a4de58976b80906a321a9196b;hp=5e6958635add912d746c9a259ac9e2275788ebd5;hpb=7db6fbae4d8855dfb66823e2b5ba6b86da0ebb1b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index 5e69586..5a6ce62 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -28,6 +28,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -205,11 +206,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr { const std::string fontFamily = value.Get< std::string >(); DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() ); - - if( impl.mController->GetDefaultFontFamily() != fontFamily ) - { - impl.mController->SetDefaultFontFamily( fontFamily, true ); // "true" as SetProperty means user defined font so don't change when system font changes. - } + impl.mController->SetDefaultFontFamily( fontFamily ); } break; } @@ -464,7 +461,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr { const Image image = Scripting::NewImage( value ); - if( impl.mDecorator ) + if( impl.mDecorator && image ) { impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, image ); impl.RequestTextRelayout(); @@ -475,7 +472,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr { const Image image = Scripting::NewImage( value ); - if( impl.mDecorator ) + if( impl.mDecorator && image ) { impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, image ); impl.RequestTextRelayout(); @@ -486,7 +483,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr { const Image image = Scripting::NewImage( value ); - if( impl.mDecorator ) + if( impl.mDecorator && image ) { impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, image ); impl.RequestTextRelayout(); @@ -497,7 +494,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr { const Image image = Scripting::NewImage( value ); - if( impl.mDecorator ) + if( impl.mDecorator && image ) { impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, image ); impl.RequestTextRelayout(); @@ -507,7 +504,8 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT: { const Image image = Scripting::NewImage( value ); - if( impl.mDecorator ) + + if( impl.mDecorator && image ) { impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, image ); impl.RequestTextRelayout(); @@ -517,7 +515,8 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT: { const Image image = Scripting::NewImage( value ); - if( impl.mDecorator ) + + if( impl.mDecorator && image ) { impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, image ); impl.RequestTextRelayout(); @@ -827,7 +826,9 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde { if( impl.mDecorator ) { - value = impl.mDecorator->GetBoundingBox(); + Rect boundingBox; + impl.mDecorator->GetBoundingBox( boundingBox ); + value = boundingBox; } break; } @@ -889,18 +890,24 @@ void TextField::OnInitialize() mController->EnableTextInput( mDecorator ); // Forward input events to controller - EnableGestureDetection( static_cast( Gesture::Tap | Gesture::Pan |Gesture::LongPress ) ); + EnableGestureDetection( static_cast( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) ); GetTapGestureDetector().SetMaximumTapsRequired( 2 ); self.TouchedSignal().Connect( this, &TextField::OnTouched ); // Set BoundingBox to stage size if not already set. - if ( mDecorator->GetBoundingBox().IsEmpty() ) + Rect boundingBox; + mDecorator->GetBoundingBox( boundingBox ); + + if( boundingBox.IsEmpty() ) { Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); mDecorator->SetBoundingBox( Rect( 0.0f, 0.0f, stageSize.width, stageSize.height ) ); } + // Flip vertically the 'left' selection handle + mDecorator->FlipHandleVertically( LEFT_SELECTION_HANDLE, true ); + // Fill-parent area by default self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); @@ -981,7 +988,7 @@ void TextField::RenderText() Actor renderableActor; if( mRenderer ) { - renderableActor = mRenderer->Render( mController->GetView(), self.GetHierarchyDepth() ); + renderableActor = mRenderer->Render( mController->GetView(), TEXT_DEPTH_INDEX ); } if( renderableActor != mRenderableActor )