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=5eaecfa0292e174252be83850c3f13437fc30d5e;hp=fa8f3c7b3500e468ecc281aada5e04532550add7;hb=a97787d5b7db865cea0b003db309a619877b0144;hpb=6450bfaff9367ce929f3c7769be7fcd365be550f 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 fa8f3c7..5eaecfa 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -138,9 +137,11 @@ DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "enableShiftSelection", DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "enableGrabHandle", BOOLEAN, ENABLE_GRAB_HANDLE ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "matchSystemLanguageDirection", BOOLEAN, MATCH_SYSTEM_LANGUAGE_DIRECTION ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "renderingBackend", INTEGER, RENDERING_BACKEND ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "maxLength", INTEGER, MAX_LENGTH ) DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED ) DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED ) +DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED ) DALI_TYPE_REGISTRATION_END() @@ -771,6 +772,17 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P } break; } + case Toolkit::DevelTextEditor::Property::MAX_LENGTH: + { + if( impl.mController ) + { + const int max = value.Get< int >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p MAX_LENGTH %d\n", impl.mController.Get(), max ); + + impl.mController->SetMaximumNumberOfCharacters( max ); + } + break; + } } // switch } // texteditor } @@ -1171,6 +1183,14 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind } break; } + case Toolkit::DevelTextEditor::Property::MAX_LENGTH: + { + if( impl.mController ) + { + value = impl.mController->GetMaximumNumberOfCharacters(); + } + break; + } } //switch } @@ -1182,6 +1202,11 @@ InputMethodContext TextEditor::GetInputMethodContext() return mInputMethodContext; } +DevelTextEditor::MaxLengthReachedSignalType& TextEditor::MaxLengthReachedSignal() +{ + return mMaxLengthReachedSignal; +} + bool TextEditor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) { Dali::BaseHandle handle( object ); @@ -1197,6 +1222,14 @@ bool TextEditor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface { editor.InputStyleChangedSignal().Connect( tracker, functor ); } + else if( 0 == strcmp( signalName.c_str(), SIGNAL_MAX_LENGTH_REACHED ) ) + { + if( editor ) + { + Internal::TextEditor& editorImpl( GetImpl( editor ) ); + editorImpl.MaxLengthReachedSignal().Connect( tracker, functor ); + } + } else { // signalName does not match any signal @@ -1588,7 +1621,8 @@ void TextEditor::TextChanged() void TextEditor::MaxLengthReached() { - // Nothing to do as TextEditor doesn't emit a max length reached signal. + Dali::Toolkit::TextEditor handle( GetOwner() ); + mMaxLengthReachedSignal.Emit( handle ); } void TextEditor::InputStyleChanged( Text::InputStyle::Mask inputStyleMask )