Fix InputMethodContext to work well in multi-window env
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / input-method-context.h
index 3c427c2..4310c77 100755 (executable)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INPUT_METHOD_CONTEXT_H__
-#define __DALI_INPUT_METHOD_CONTEXT_H__
+#ifndef DALI_INPUT_METHOD_CONTEXT_H
+#define DALI_INPUT_METHOD_CONTEXT_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.
@@ -37,13 +37,14 @@ class InputMethodContext;
 }
 }
 
+class Actor;
+
 /**
  * @brief The InputMethodContext class
  *
  * Specifically manages the ecore input method framework which enables the virtual or hardware keyboards.
  */
-
-class DALI_IMPORT_API InputMethodContext : public BaseHandle
+class DALI_ADAPTOR_API InputMethodContext : public BaseHandle
 {
 public:
 
@@ -89,6 +90,12 @@ public:
     HARDWARE_KEYBOARD   ///< Hardware keyboard
   };
 
+  enum class InputPanelLanguage
+  {
+    AUTOMATIC,    ///< IME Language automatically set depending on the system display
+    ALPHABET      ///< Latin alphabet at all times
+  };
+
   /**
    * @brief This structure is used to pass on data from the InputMethodContext regarding predictive text.
    */
@@ -172,6 +179,7 @@ public:
   typedef Signal< void ( KeyboardType ) > KeyboardTypeSignalType; ///< keyboard type
   typedef Signal< void ( int ) > KeyboardResizedSignalType;  ///< Keyboard resized signal
   typedef Signal< void ( int ) > LanguageChangedSignalType;  ///< Language changed signal
+  typedef Signal< void ( const std::string&, const std::string&, const std::string& ) > ContentReceivedSignalType; ///< Content received signal
 
 public:
 
@@ -195,6 +203,13 @@ public:
   static InputMethodContext New();
 
   /**
+   * @brief Create a new instance of an InputMethodContext.
+   *
+   * @param[in] actor The actor that uses the new InputMethodContext instance.
+   */
+  static InputMethodContext New( Actor actor );
+
+  /**
    * @brief Copy constructor.
    *
    * @param[in] inputMethodContext InputMethodContext to copy. The copied inputMethodContext will point at the same implementation.
@@ -392,6 +407,16 @@ public:
   std::string GetInputPanelLocale();
 
   /**
+   * @brief Sets the allowed MIME Types to deliver to the input panel.
+   *
+   * ex) std::string mimeTypes = "text/plain,image/png,image/gif,application/pdf";
+   *
+   * You can receive a media content URI and its MIME type from ContentReceivedSignal(). @see ContentReceivedSignal
+   * @param[in] mimeTypes The allowed MIME types
+   */
+  void SetContentMIMETypes( const std::string& mimeTypes );
+
+  /**
    * @brief Process event key down or up, whether filter a key to isf.
    *
    * @param[in] keyEvent The event key to be handled.
@@ -399,6 +424,35 @@ 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;
+
+  /**
+   * @brief Sets the language of the input panel.
+   *
+   * This method can be used when you want to show the English keyboard.
+   * @param[in] language The language to be set to the input panel
+   */
+  void SetInputPanelLanguage( InputPanelLanguage language );
+
+  /**
+   * @brief Gets the language of the input panel.
+   *
+   * @return The language of the input panel
+   */
+  InputPanelLanguage GetInputPanelLanguage() const;
+
 public:
 
   // Signals
@@ -470,6 +524,18 @@ public:
    */
   KeyboardTypeSignalType& KeyboardTypeChangedSignal();
 
+  /**
+   * @brief Connect to this signal to be notified when the content, such as images, of input method is received.
+   *
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName( const std::string& contentUri, const std::string& description, const std::string& contentMIMEType );
+   * @endcode
+   *
+   * @return The signal to connect to.
+   */
+  ContentReceivedSignalType& ContentReceivedSignal();
+
 public:
 
   /**
@@ -485,4 +551,4 @@ public:
 
 } // namespace Dali
 
-#endif // __DALI_INPUT_METHOD_CONTEXT_H__
+#endif // DALI_INPUT_METHOD_CONTEXT_H