+bool SetBackgroundProperties( ControllerPtr controller, const Property::Value& value, EffectStyle::Type type )
+{
+ bool update = false;
+
+ if( controller )
+ {
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ const Property::Map& propertiesMap = value.Get<Property::Map>();
+
+ bool enabled = false;
+ bool colorDefined = false;
+ Vector4 color;
+
+ bool empty = true;
+
+ if ( !propertiesMap.Empty() )
+ {
+ empty = ParseBackgroundProperties( propertiesMap,
+ enabled,
+ colorDefined,
+ color );
+ }
+
+ if( !empty )
+ {
+ if( enabled != controller->IsBackgroundEnabled() )
+ {
+ controller->SetBackgroundEnabled( enabled );
+ update = true;
+ }
+
+ if( colorDefined && ( controller->GetBackgroundColor() != color ) )
+ {
+ controller->SetBackgroundColor( color );
+ update = true;
+ }
+ }
+ else
+ {
+ // Disable background.
+ if( controller->IsBackgroundEnabled() )
+ {
+ controller->SetBackgroundEnabled( false );
+ update = true;
+ }
+ }
+ break;
+ }
+ case EffectStyle::INPUT:
+ {
+ // Text background is not supported while inputting yet
+ break;
+ }
+ } // switch
+ } // if( controller )
+
+ return update;
+}
+
+void GetBackgroundProperties( ControllerPtr controller, Property::Value& value, EffectStyle::Type type )
+{
+ if( controller )
+ {
+ switch( type )
+ {
+ case EffectStyle::DEFAULT:
+ {
+ const bool enabled = controller->IsBackgroundEnabled();
+ const Vector4& color = controller->GetBackgroundColor();
+
+ Property::Map map;
+ map.Insert( ENABLE_KEY, enabled );
+ map.Insert( COLOR_KEY, color );
+
+ value = map;
+
+ break;
+
+ }
+ case EffectStyle::INPUT:
+ {
+ // Text background is not supported while inputting yet
+ break;
+ }
+ }
+ }
+}
+
+