X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Ftext-editor%2Ftext-editor-example.cpp;h=d2a05d76d649851539a3bce8b5d413c114247e40;hb=557de64999d33e551830812eb7e94f7ef25870e9;hp=eb83eecf984ab8b6c0fbdc6cd1ca4e1befe19ba5;hpb=b57c3cd944761a29611789fffa3ee097804e7575;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/text-editor/text-editor-example.cpp b/examples/text-editor/text-editor-example.cpp index eb83eec..d2a05d7 100644 --- a/examples/text-editor/text-editor-example.cpp +++ b/examples/text-editor/text-editor-example.cpp @@ -62,7 +62,6 @@ const unsigned int NUMBER_OF_COLORS = sizeof( COLORS ) / sizeof( Vector4 ); class TextEditorExample : public ConnectionTracker { public: - TextEditorExample( Application& application ) : mApplication( application ) { @@ -152,6 +151,8 @@ public: "Asšúm sapěret usu ůť.\n" "Síť ut apeirián laboramúš percipitur, sůas hařum ín éos?\n" ); + mEditor.InputStyleChangedSignal().Connect( this, &TextEditorExample::OnTextInputStyleChanged ); + contents.Add( mEditor ); } @@ -222,18 +223,36 @@ public: { const std::string& name = button.GetName(); + Vector4 color; if( "color" == name.substr( 0u, 5u ) ) { const unsigned int index = strtoul( name.substr( 5u, 1u ).c_str(), NULL, 10u ); - mEditor.SetProperty( TextEditor::Property::INPUT_COLOR, COLORS[index] ); + color = COLORS[index]; + mEditor.SetProperty( TextEditor::Property::INPUT_COLOR, color ); } + mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color ); + mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color ); + mButtonContainer.SetVisible( false ); mButtonContainer.SetSensitive( false ); return true; } + void OnTextInputStyleChanged( TextEditor editor, TextEditor::InputStyle::Mask mask ) + { + if( TextEditor::InputStyle::NONE != static_cast( mask & TextEditor::InputStyle::COLOR ) ) + { + const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get(); + + mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color ); + mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color ); + } + + editor.Reset(); + } + private: Application& mApplication;