X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-field-impl.cpp;h=467748d125144eebaf40efb7c78f239f8ede5a97;hp=745a5a5afba698c09c9237cf8007b66f1567ae9c;hb=593ab514474062b4d3de55682e63627a79b2eb5a;hpb=9b1300733bb67e51e234ce719cef36c484e4091a diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp old mode 100644 new mode 100755 index 745a5a5..467748d --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -22,17 +22,17 @@ #include #include #include -#include -#include +#include +#include #include #include #include #include // INTERNAL INCLUDES -#include #include #include +#include #include #include #include @@ -64,7 +64,7 @@ namespace // unnamed namespace Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS"); #endif - const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND; + const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::DevelText::DEFAULT_RENDERING_BACKEND; } // unnamed namespace namespace @@ -78,7 +78,6 @@ BaseHandle Create() // Setup properties, signals and actions using the type-registry. DALI_TYPE_REGISTRATION_BEGIN( Toolkit::TextField, Toolkit::Control, Create ); -DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "renderingBackend", INTEGER, RENDERING_BACKEND ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "text", STRING, TEXT ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholderText", STRING, PLACEHOLDER_TEXT ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholderTextFocused", STRING, PLACEHOLDER_TEXT_FOCUSED ) @@ -91,8 +90,6 @@ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "horizontalAlignment", DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "verticalAlignment", STRING, VERTICAL_ALIGNMENT ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "textColor", VECTOR4, TEXT_COLOR ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholderTextColor", VECTOR4, PLACEHOLDER_TEXT_COLOR ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "reservedProperty01", STRING, RESERVED_PROPERTY_01 ) -DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "reservedProperty02", STRING, RESERVED_PROPERTY_02 ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "primaryCursorColor", VECTOR4, PRIMARY_CURSOR_COLOR ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "secondaryCursorColor", VECTOR4, SECONDARY_CURSOR_COLOR ) DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "enableCursorBlink", BOOLEAN, ENABLE_CURSOR_BLINK ) @@ -136,6 +133,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "matchSystemLanguageDirect DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandlePopup", BOOLEAN, ENABLE_GRAB_HANDLE_POPUP ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "textBackground", VECTOR4, BACKGROUND ) DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextField, "selectedText", STRING, SELECTED_TEXT ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "renderingBackend", INTEGER, RENDERING_BACKEND ) DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED ) DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED ) @@ -191,13 +189,13 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr switch( index ) { - case Toolkit::TextField::Property::RENDERING_BACKEND: + case Toolkit::DevelTextField::Property::RENDERING_BACKEND: { int backend = value.Get< int >(); DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p RENDERING_BACKEND %d\n", impl.mController.Get(), backend ); #ifndef ENABLE_VECTOR_BASED_TEXT_RENDERING - if( Text::RENDERING_VECTOR_BASED == backend ) + if( DevelText::RENDERING_VECTOR_BASED == backend ) { backend = TextAbstraction::BITMAP_GLYPH; // Fallback to bitmap-based rendering } @@ -210,7 +208,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr if( impl.mController ) { // When using the vector-based rendering, the size of the GLyphs are different - TextAbstraction::GlyphType glyphType = (Text::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH; + TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH; impl.mController->SetGlyphType( glyphType ); } } @@ -824,7 +822,7 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde switch( index ) { - case Toolkit::TextField::Property::RENDERING_BACKEND: + case Toolkit::DevelTextField::Property::RENDERING_BACKEND: { value = impl.mRenderingBackend; break; @@ -1310,7 +1308,7 @@ void TextField::OnInitialize() mController = Text::Controller::New( this, this ); // When using the vector-based rendering, the size of the GLyphs are different - TextAbstraction::GlyphType glyphType = (Text::RENDERING_VECTOR_BASED == mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH; + TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH; mController->SetGlyphType( glyphType ); mDecorator = Text::Decorator::New( *mController, @@ -1362,7 +1360,7 @@ void TextField::OnInitialize() // Fill-parent area by default self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); - self.OnStageSignal().Connect( this, &TextField::OnStageConnect ); + self.OnSceneSignal().Connect( this, &TextField::OnSceneConnect ); DevelControl::SetInputMethodContext( *this, mInputMethodContext ); @@ -1436,7 +1434,15 @@ void TextField::OnRelayout( const Vector2& size, RelayoutContainer& container ) Vector2 contentSize( size.x - ( padding.start + padding.end ), size.y - ( padding.top + padding.bottom ) ); // Support Right-To-Left of padding - Dali::LayoutDirection::Type layoutDirection = static_cast( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get() ); + Dali::LayoutDirection::Type layoutDirection; + if( mController->IsMatchSystemLanguageDirection() ) + { + layoutDirection = static_cast( DevelWindow::Get( self ).GetRootLayer().GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get() ); + } + else + { + layoutDirection = static_cast( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get() ); + } if( Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection ) { std::swap( padding.start, padding.end ); @@ -1682,19 +1688,19 @@ void TextField::OnLongPress( const LongPressGesture& gesture ) bool TextField::OnKeyEvent( const KeyEvent& event ) { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyEvent %p keyCode %d\n", mController.Get(), event.keyCode ); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyEvent %p keyCode %d\n", mController.Get(), event.GetKeyCode() ); - if( Dali::DALI_KEY_ESCAPE == event.keyCode && mController->ShouldClearFocusOnEscape() ) + if( Dali::DALI_KEY_ESCAPE == event.GetKeyCode() && mController->ShouldClearFocusOnEscape() ) { // Make sure ClearKeyInputFocus when only key is up - if( event.state == KeyEvent::Up ) + if( event.GetState() == KeyEvent::Up ) { ClearKeyInputFocus(); } return true; } - else if( Dali::DevelKey::DALI_KEY_RETURN == event.keyCode ) + else if( Dali::DevelKey::DALI_KEY_RETURN == event.GetKeyCode() ) { // Do nothing when enter is comming. return false; @@ -1788,7 +1794,7 @@ void TextField::AddDecoration( Actor& actor, bool needsClipping ) } } -void TextField::OnStageConnect( Dali::Actor actor ) +void TextField::OnSceneConnect( Dali::Actor actor ) { if ( mHasBeenStaged ) { @@ -1858,20 +1864,20 @@ void TextField::KeyboardStatusChanged(bool keyboardShown) } } -void TextField::OnStageConnection( int depth ) +void TextField::OnSceneConnection( int depth ) { // Sets the depth to the visuals inside the text's decorator. mDecorator->SetTextDepth( depth ); // The depth of the text renderer is set in the RenderText() called from OnRelayout(). - // Call the Control::OnStageConnection() to set the depth of the background. - Control::OnStageConnection( depth ); + // Call the Control::OnSceneConnection() to set the depth of the background. + Control::OnSceneConnection( depth ); } -bool TextField::OnTouched( Actor actor, const TouchData& touch ) +bool TextField::OnTouched( Actor actor, const TouchEvent& touch ) { - return true; + return false; } void TextField::OnIdleSignal()