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-editor-impl.cpp;h=4224df2a5d203c699e901817243f1642ce99269f;hp=5fac4ba437b7741585bbf6aa5449df0cd70ff477;hb=b68ba033c963cc1f92b127a4b4ed1ceea124fec9;hpb=8bb92d7d1170f2ddf59da60bd3588be601ef8cd2 diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index 5fac4ba..4224df2 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -142,6 +142,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "renderingBackend", DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "maxLength", INTEGER, MAX_LENGTH ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "selectedTextStart", INTEGER, SELECTED_TEXT_START ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "selectedTextEnd", INTEGER, SELECTED_TEXT_END ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "enableEditing", BOOLEAN, ENABLE_EDITING ) DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED ) DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED ) @@ -718,6 +719,13 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P } break; } + case Toolkit::DevelTextEditor::Property::ENABLE_EDITING: + { + const bool editable = value.Get< bool >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_EDITING %d\n", impl.mController.Get(), editable ); + impl.SetEditable( editable ); + break; + } } // switch } // texteditor } @@ -1044,6 +1052,11 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind value = static_cast(range.second); break; } + case Toolkit::DevelTextEditor::Property::ENABLE_EDITING: + { + value = impl.IsEditable(); + break; + } } //switch } @@ -1367,7 +1380,7 @@ void TextEditor::RenderText( Text::Controller::UpdateTextType updateTextType ) void TextEditor::OnKeyInputFocusGained() { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnKeyInputFocusGained %p\n", mController.Get() ); - if ( mInputMethodContext ) + if ( mInputMethodContext && IsEditable() ) { mInputMethodContext.StatusChangedSignal().Connect( this, &TextEditor::KeyboardStatusChanged ); @@ -1421,7 +1434,7 @@ void TextEditor::OnKeyInputFocusLost() void TextEditor::OnTap( const TapGesture& gesture ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnTap %p\n", mController.Get() ); - if ( mInputMethodContext ) + if ( mInputMethodContext && IsEditable() ) { mInputMethodContext.Activate(); } @@ -1441,7 +1454,7 @@ void TextEditor::OnPan( const PanGesture& gesture ) void TextEditor::OnLongPress( const LongPressGesture& gesture ) { - if ( mInputMethodContext ) + if ( mInputMethodContext && IsEditable() ) { mInputMethodContext.Activate(); } @@ -1776,6 +1789,20 @@ void TextEditor::ApplyScrollPosition() } } +bool TextEditor::IsEditable() const +{ + return mController->IsEditable(); +} + +void TextEditor::SetEditable( bool editable ) +{ + mController->SetEditable(editable); + if ( mInputMethodContext && !editable ) + { + mInputMethodContext.Deactivate(); + } +} + TextEditor::TextEditor() : Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), mAnimationPeriod( 0.0f, 0.0f ),