Add TextField BACKGROUND property and more Preedit style options
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-controls / text-field-impl.cpp
index 6a1f1c9..e9d1fe4 100755 (executable)
@@ -134,6 +134,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableShiftSelection",
 DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandle",               BOOLEAN,   ENABLE_GRAB_HANDLE                   )
 DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "matchSystemLanguageDirection",   BOOLEAN,   MATCH_SYSTEM_LANGUAGE_DIRECTION      )
 DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandlePopup",          BOOLEAN,   ENABLE_GRAB_HANDLE_POPUP             )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "textBackground",                 VECTOR4,   BACKGROUND                           )
 
 DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged",        SIGNAL_TEXT_CHANGED )
 DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached",   SIGNAL_MAX_LENGTH_REACHED )
@@ -767,7 +768,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
       }
       case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP:
       {
-        if (impl.mController)
+        if( impl.mController )
         {
           const bool grabHandlePopupEnabled = value.Get<bool>();
           DALI_LOG_INFO(gLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE_POPUP %d\n", impl.mController.Get(), grabHandlePopupEnabled);
@@ -776,6 +777,18 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
           break;
         }
       }
+      case Toolkit::DevelTextField::Property::BACKGROUND:
+      {
+        if( impl.mController )
+        {
+          const Vector4 backgroundColor = value.Get< Vector4 >();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p BACKGROUND %f,%f,%f,%f\n", impl.mController.Get(), backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a );
+
+          impl.mController->SetBackgroundEnabled( true );
+          impl.mController->SetBackgroundColor( backgroundColor );
+        }
+        break;
+      }
     } // switch
   } // textfield
 }
@@ -1185,12 +1198,20 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde
       }
       case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP:
       {
-        if (impl.mController)
+        if( impl.mController )
         {
           value = impl.mController->IsGrabHandlePopupEnabled();
         }
         break;
       }
+      case Toolkit::DevelTextField::Property::BACKGROUND:
+      {
+        if( impl.mController )
+        {
+          value = impl.mController->GetBackgroundColor();
+        }
+        break;
+      }
     } //switch
   }