Add TextField BACKGROUND property and more Preedit style options
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-input-method-context.cpp
index 775c0c0..2446f29 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -59,6 +59,8 @@ public:
   const std::string& GetSurroundingText() const;
   void ApplyOptions( const InputMethodOptions& options );
   bool FilterEventKey( const Dali::KeyEvent& keyEvent );
+  void SetPreeditStyle( Dali::InputMethodContext::PreeditStyle type );
+  void GetPreeditStyle( Vector< Dali::InputMethodContext::PreeditAttributeData >& attrs ) const;
 
 public:  // Signals
   ActivatedSignalType& ActivatedSignal() { return mActivatedSignal; }
@@ -85,6 +87,7 @@ private:
   bool mRestoreAfterFocusLost:1;             ///< Whether the keyboard needs to be restored (activated ) after focus regained.
   bool mIdleCallbackConnected:1;             ///< Whether the idle callback is already connected.
   InputMethodOptions        mOptions;
+  Vector< Dali::InputMethodContext::PreeditAttributeData > mPreeditAttrs; ///< Stores preedit attr data
 
   ActivatedSignalType      mActivatedSignal;
   KeyboardEventSignalType  mEventSignal;
@@ -212,6 +215,18 @@ bool InputMethodContext::FilterEventKey( const Dali::KeyEvent& keyEvent )
 {
   return false;
 }
+
+void InputMethodContext::SetPreeditStyle( Dali::InputMethodContext::PreeditStyle type )
+{
+  Dali::InputMethodContext::PreeditAttributeData data;
+  data.preeditType = type;
+  mPreeditAttrs.PushBack( data );
+}
+
+void InputMethodContext::GetPreeditStyle( Vector< Dali::InputMethodContext::PreeditAttributeData >& attrs ) const
+{
+  attrs = mPreeditAttrs;
+}
 } // Adaptor
 
 } // Internal
@@ -231,6 +246,11 @@ InputMethodContext::~InputMethodContext()
 
 InputMethodContext InputMethodContext::New()
 {
+  return InputMethodContext::New( Actor() );
+}
+
+InputMethodContext InputMethodContext::New( Actor actor )
+{
   return Internal::Adaptor::InputMethodContext::New();
 }
 
@@ -303,6 +323,17 @@ bool InputMethodContext::FilterEventKey( const Dali::KeyEvent& keyEvent )
   return Internal::Adaptor::InputMethodContext::GetImplementation(*this).FilterEventKey( keyEvent );
 }
 
+void InputMethodContext::SetPreeditStyle( Dali::InputMethodContext::PreeditStyle type )
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).SetPreeditStyle( type );
+}
+
+void InputMethodContext::GetPreeditStyle( Vector< Dali::InputMethodContext::PreeditAttributeData >& attrs ) const
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetPreeditStyle( attrs );
+}
+
+// Signals
 InputMethodContext::ActivatedSignalType& InputMethodContext::ActivatedSignal()
 {
   return Internal::Adaptor::InputMethodContext::GetImplementation(*this).ActivatedSignal();