[dali_1.9.1] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / input / common / input-method-context-impl.h
index 7890b1c..4125be2 100755 (executable)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_INPUT_COMMON_INPUT_METHOD_CONTEXT_IMPL_H
 
 /*
- * 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.
@@ -19,6 +19,9 @@
  */
 
 // EXTERNAL INCLUDES
+#include <functional>
+#include <memory>
+#include <dali/public-api/actors/actor.h>
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/object/base-object.h>
 #include <dali/integration-api/events/key-event-integ.h>
@@ -26,8 +29,6 @@
 // INTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/input-method-context.h>
 
-#include <memory>
-
 namespace Dali
 {
 
@@ -54,13 +55,14 @@ public:
   using KeyboardTypeSignalType = Dali::InputMethodContext::KeyboardTypeSignalType;
   using LanguageChangedSignalType = Dali::InputMethodContext::LanguageChangedSignalType;
   using KeyboardResizedSignalType = Dali::InputMethodContext::KeyboardResizedSignalType;
+  using ContentReceivedSignalType = Dali::InputMethodContext::ContentReceivedSignalType;
 
 public:
 
   /**
    * Create a new input method context instance.
    */
-  static InputMethodContextPtr New();
+  static InputMethodContextPtr New( Dali::Actor actor );
 
   /**
    * Initialize the object.
@@ -117,12 +119,12 @@ public:
   /**
    * @copydoc Dali::InputMethodContext::PreEditChanged()
    */
-  virtual void PreEditChanged( void *data, ImfContext* imfContext, void *event_info ) {}
+  virtual void PreEditChanged( void *data, ImfContext* imfContext, void *eventInfo ) {}
 
   /**
    * @copydoc Dali::InputMethodContext::CommitReceived()
    */
-  virtual void CommitReceived( void *data, ImfContext* imfContext, void *event_info ) {}
+  virtual void CommitReceived( void *data, ImfContext* imfContext, void *eventInfo ) {}
 
   /**
    * @copydoc Dali::InputMethodContext::RetrieveSurrounding()
@@ -133,12 +135,17 @@ public:
   /**
    * @copydoc Dali::InputMethodContext::DeleteSurrounding()
    */
-  virtual void DeleteSurrounding( void *data, ImfContext* imfContext, void *event_info ) {}
+  virtual void DeleteSurrounding( void *data, ImfContext* imfContext, void *eventInfo ) {}
 
   /**
    * @copydoc Dali::InputMethodContext::SendPrivateCommand()
    */
-  virtual void SendPrivateCommand( void* data, ImfContext* imfContext, void* event_info ) {}
+  virtual void SendPrivateCommand( void* data, ImfContext* imfContext, void* eventInfo ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::SendCommitContent()
+   */
+  virtual void SendCommitContent( void* data, ImfContext* imfContext, void* eventInfo ) {}
 
   // Cursor related
   /**
@@ -232,6 +239,11 @@ public:
   virtual std::string GetInputPanelLocale() { return std::string(); }
 
   /**
+   * @copydoc Dali::InputMethodContext::SetContentMIMETypes()
+   */
+  virtual void SetContentMIMETypes( const std::string& mimeTypes ) {}
+
+  /**
    * @copydoc Dali::InputMethodContext::FilterEventKey()
    */
   virtual bool FilterEventKey( const Dali::KeyEvent& keyEvent ) { return false; }
@@ -256,6 +268,16 @@ public:
    */
   virtual Dali::InputMethodContext::InputPanelLanguage GetInputPanelLanguage() const { return Dali::InputMethodContext::InputPanelLanguage(); }
 
+  /**
+   * @copydoc Dali::InputMethodContext::SetInputPanelPosition()
+   */
+  virtual void SetInputPanelPosition( unsigned int x, unsigned int y ) {}
+
+  /**
+   * @copydoc Dali::InputMethodContext::GetPreeditStyle()
+   */
+  virtual void GetPreeditStyle( Dali::InputMethodContext::PreEditAttributeDataContainer& attrs ) const {}
+
 public:  // Signals
 
   /**
@@ -288,12 +310,17 @@ public:  // Signals
    */
   KeyboardTypeSignalType& KeyboardTypeChangedSignal() { return mKeyboardTypeChangedSignal; }
 
+  /**
+   * @copydoc Dali::InputMethodContext::ContentReceivedSignal()
+   */
+  ContentReceivedSignalType& ContentReceivedSignal() { return mContentReceivedSignal; }
+
 public:
 
   /**
    * Constructor
    */
-  InputMethodContext() = default;
+  InputMethodContext();
 
   /**
    * Destructor
@@ -306,6 +333,33 @@ private:
   InputMethodContext& operator=( InputMethodContext& )  = delete;
 
 protected:
+  /**
+   * @brief Struct for providing Operation enumeration
+   */
+  struct Operation
+  {
+    enum Type
+    {
+      ALLOW_TEXT_PREDICTION = 0,
+      AUTO_ENABLE_INPUT_PANEL,
+      NOTIFY_TEXT_INPUT_MULTILINE,
+      SET_CONTENT_MIME_TYPES,
+      SET_INPUT_PANEL_DATA,
+      SET_INPUT_PANEL_LANGUAGE,
+      SET_INPUT_PANEL_POSITION,
+      SET_RETURN_KEY_STATE,
+      MAX_COUNT
+    };
+  };
+
+  using OperationList = std::vector< std::function<void()> >;
+
+  /**
+   * @brief Apply backup operations to the InputMethodContext
+   */
+  void ApplyBackupOperations();
+
+protected:
 
   ActivatedSignalType        mActivatedSignal;
   KeyboardEventSignalType    mEventSignal;
@@ -313,6 +367,8 @@ protected:
   KeyboardResizedSignalType  mKeyboardResizeSignal;
   LanguageChangedSignalType  mKeyboardLanguageChangedSignal;
   KeyboardTypeSignalType     mKeyboardTypeChangedSignal;
+  ContentReceivedSignalType  mContentReceivedSignal;
+  OperationList              mBackupOperations;
 
 public:
 
@@ -343,4 +399,4 @@ public:
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_INPUT_METHOD_CONTEXT_H
+#endif // DALI_INTERNAL_INPUT_COMMON_INPUT_METHOD_CONTEXT_IMPL_H