class TextEditorExample : public ConnectionTracker
{
public:
-
TextEditorExample( Application& application )
: mApplication( application )
{
"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 );
}
{
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<TextEditor::InputStyle::Mask>( mask & TextEditor::InputStyle::COLOR ) )
+ {
+ const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
+
+ mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color );
+ mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color );
+ }
+
+ editor.Reset();
+ }
+
private:
Application& mApplication;