Add AllowTextPrediction/IsTextPredictionAllowed api 04/182504/3
authorxb.teng <xb.teng@samsung.com>
Mon, 25 Jun 2018 13:04:02 +0000 (21:04 +0800)
committerXianbing Teng <xb.teng@samsung.com>
Tue, 26 Jun 2018 09:15:49 +0000 (09:15 +0000)
Change-Id: I7fb9aacf7d2e38ebc16f3e8fb652632bdc16963f

dali/devel-api/adaptor-framework/input-method-context.cpp
dali/devel-api/adaptor-framework/input-method-context.h
dali/internal/input/common/input-method-context-impl.h
dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp
dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.h
dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp
dali/internal/input/ubuntu-x11/input-method-context-impl-x.h

index 11ef92e..427ae6c 100755 (executable)
@@ -186,6 +186,16 @@ bool InputMethodContext::FilterEventKey( const Dali::KeyEvent& keyEvent )
   return Internal::Adaptor::InputMethodContext::GetImplementation(*this).FilterEventKey( keyEvent );
 }
 
+void InputMethodContext::AllowTextPrediction( bool prediction )
+{
+  Internal::Adaptor::InputMethodContext::GetImplementation(*this).AllowTextPrediction( prediction );
+}
+
+bool InputMethodContext::IsTextPredictionAllowed() const
+{
+  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).IsTextPredictionAllowed();
+}
+
 InputMethodContext::ActivatedSignalType& InputMethodContext::ActivatedSignal()
 {
   return Internal::Adaptor::InputMethodContext::GetImplementation(*this).ActivatedSignal();
index 49901a1..6775ef2 100755 (executable)
@@ -399,6 +399,19 @@ public:
    */
   bool FilterEventKey( const Dali::KeyEvent& keyEvent );
 
+  /**
+   * @brief Sets whether the IM context should allow to use the text prediction.
+   *
+   * @param[in] prediction Whether to allow text prediction or not.
+   */
+  void AllowTextPrediction( bool prediction );
+
+  /**
+   * @brief Gets whether the IM context allow to use the text prediction.
+   *
+   * @return Whether the IM allow text prediction or not.
+   */
+  bool IsTextPredictionAllowed() const;
 public:
 
   // Signals
index 5e7cc34..a46cdb5 100755 (executable)
@@ -236,6 +236,15 @@ public:
    */
   virtual bool FilterEventKey( const Dali::KeyEvent& keyEvent ) { return false; }
 
+  /**
+   * @copydoc Dali::InputMethodContext::AllowTextPrediction()
+   */
+  virtual void AllowTextPrediction( bool prediction ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::IsTextPredictionAllowed()
+   */
+  virtual bool IsTextPredictionAllowed() const { return false; }
 public:  // Signals
 
   /**
index 6a83c43..ff46c94 100755 (executable)
@@ -920,6 +920,27 @@ bool InputMethodContextEcoreWl::FilterEventKey( const Dali::KeyEvent& keyEvent )
   return eventHandled;
 }
 
+void InputMethodContextEcoreWl::AllowTextPrediction( bool prediction )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::AllowTextPrediction\n" );
+
+  if( mIMFContext )
+  {
+    ecore_imf_context_prediction_allow_set( mIMFContext, prediction );
+  }
+}
+
+bool InputMethodContextEcoreWl::IsTextPredictionAllowed() const
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextEcoreWl::IsTextPredictionAllowed\n" );
+  bool prediction = false;
+  if( mIMFContext )
+  {
+    prediction = ecore_imf_context_prediction_allow_get( mIMFContext );
+  }
+  return prediction;
+}
+
 bool InputMethodContextEcoreWl::ProcessEventKeyDown( const KeyEvent& keyEvent )
 {
   bool eventHandled( false );
index 24fcd0b..4630637 100755 (executable)
@@ -226,6 +226,15 @@ public:
    */
   bool FilterEventKey( const Dali::KeyEvent& keyEvent ) override;
 
+  /**
+   * @copydoc Dali::InputMethodContext::AllowTextPrediction()
+   */
+  void AllowTextPrediction( bool prediction ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::IsTextPredictionAllowed()
+   */
+  bool IsTextPredictionAllowed() const override;
 private:
   /**
    * Context created the first time and kept until deleted.
index 7afcf5a..3b7fcda 100755 (executable)
@@ -727,6 +727,27 @@ bool InputMethodContextX::FilterEventKey( const Dali::KeyEvent& keyEvent )
   return eventHandled;
 }
 
+void InputMethodContextX::AllowTextPrediction( bool prediction )
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::AllowTextPrediction\n" );
+
+  if( mIMFContext )
+  {
+    ecore_imf_context_prediction_allow_set( mIMFContext, prediction );
+  }
+}
+
+bool InputMethodContextX::IsTextPredictionAllowed() const
+{
+  DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextX::IsTextPredictionAllowed\n" );
+  bool prediction = false;
+  if( mIMFContext )
+  {
+    prediction = ecore_imf_context_prediction_allow_get( mIMFContext );
+  }
+  return prediction;
+}
+
 bool InputMethodContextX::ProcessEventKeyDown( const KeyEvent& keyEvent )
 {
   bool eventHandled( false );
index ff3d5c4..95ea0d5 100755 (executable)
@@ -231,6 +231,15 @@ public:
    */
   bool FilterEventKey( const Dali::KeyEvent& keyEvent ) override;
 
+  /**
+   * @copydoc Dali::InputMethodContext::AllowTextPrediction()
+   */
+  void AllowTextPrediction( bool prediction ) override;
+
+  /**
+   * @copydoc Dali::InputMethodContext::IsTextPredictionAllowed()
+   */
+  bool IsTextPredictionAllowed() const override;
 private:
   /**
    * Context created the first time and kept until deleted.