Add ime_context_get_caps_mode in internal header 87/113387/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 7 Feb 2017 08:56:43 +0000 (17:56 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 7 Feb 2017 09:08:40 +0000 (18:08 +0900)
Change-Id: I65250d023970f563a1be2c7e95e411cfc464053b
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
include/inputmethod_internal.h
include/inputmethod_private.h
src/inputmethod.cpp

index 910562a..207c176 100644 (file)
@@ -28,6 +28,8 @@
 extern "C" {
 #endif
 
+typedef struct _ime_context *ime_context_h;
+
 /**
  * @brief Called when an caps mode is changed.
  *
@@ -154,6 +156,32 @@ EXPORT_API int ime_event_set_candidate_hide_cb(ime_candidate_hide_cb callback_fu
 EXPORT_API int ime_event_set_lookup_table_changed_cb(ime_lookup_table_changed_cb callback_func, void *user_data);
 
 /**
+ * @brief Gets the caps mode information from the given input context.
+ *
+ * @details Each edit field has various attributes for input panel. This function can be
+ * called to get the caps mode information in ime_show_cb() callback function.
+ *
+ * @since_tizen 3.0
+ *
+ * @privilege %http://tizen.org/privilege/ime
+ *
+ * @param[in] context The input context information of an associated text input UI control
+ * @param[out] caps_mode Caps mode information \n @c true to turn on shift mode
+ * text feature if available, @c false to disable the predictive text feature
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
+ * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
+ *
+ * @post Input panel UI should be drawn or operated by this information accordingly.
+ *
+ * @see ime_show_cb()
+ */
+EXPORT_API int ime_context_get_caps_mode(ime_context_h context, bool *caps_mode);
+
+/**
  * @brief Set keyboard engine.
  *
  * @since_tizen 3.0
@@ -164,6 +192,7 @@ EXPORT_API int ime_event_set_lookup_table_changed_cb(ime_lookup_table_changed_cb
  *
  * @return 0 on success, otherwise a negative error value
  * @retval #IME_ERROR_NONE No error
+ * @retval #IME_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #IME_ERROR_PERMISSION_DENIED The application does not have the privilege to call this function
  * @retval #IME_ERROR_NOT_RUNNING IME main loop isn't started yet
  */
index 8aad9a7..b30bb44 100644 (file)
@@ -31,6 +31,7 @@ struct _ime_context {
        Ecore_IMF_BiDi_Direction bidi_direction;/**< Bidirectional mode */
        Ecore_IMF_Input_Panel_Lang language;    /**< Preferred input language */
        unsigned int client_window;             /**< Client application window object */
+       Eina_Bool caps_mode;                    /**< Caps mode */
 };
 
 struct _ime_device_info {
index 3c39f31..ac1b49c 100644 (file)
@@ -214,6 +214,7 @@ void CCoreEventCallback::on_ise_show(sclint ic, const int degree, Ise_Context &c
         input_context.bidi_direction = context.bidi_direction;
         input_context.language = context.language;
         input_context.client_window = context.client_window;
+        input_context.caps_mode = context.caps_mode;
 
         g_basic_callback.show(ic, static_cast<ime_context_h>(&input_context), g_user_data);
     }
@@ -1842,6 +1843,31 @@ int ime_context_get_language(ime_context_h context, Ecore_IMF_Input_Panel_Lang *
     return IME_ERROR_NONE;
 }
 
+int ime_context_get_caps_mode(ime_context_h context, bool *caps_mode)
+{
+    ime_error_e retVal = IME_ERROR_NONE;
+
+    if (!context || !caps_mode) {
+        LOGW("IME_ERROR_INVALID_PARAMETER");
+        return IME_ERROR_INVALID_PARAMETER;
+    }
+
+    if (!g_running) {
+        LOGW("IME_ERROR_NOT_RUNNING");
+        return IME_ERROR_NOT_RUNNING;
+    }
+
+    retVal = _check_privilege();
+    if (retVal != IME_ERROR_NONE) {
+        LOGE("_check_privilege returned %d.", retVal);
+        return retVal;
+    }
+
+    *caps_mode = static_cast<bool>(context->caps_mode);
+
+    return IME_ERROR_NONE;
+}
+
 int ime_device_info_get_name(ime_device_info_h dev_info, char **dev_name)
 {
     ime_error_e retVal = IME_ERROR_NONE;