From: Inhong Han Date: Wed, 10 Apr 2019 02:00:16 +0000 (+0900) Subject: Add API to set candidate visibility state X-Git-Tag: submit/tizen/20190418.082316~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b27ab78dc295375717bb6e1fa8f19833ee36c169;p=platform%2Fcore%2Fapi%2Finputmethod.git Add API to set candidate visibility state Change-Id: I8fc7539cb7d1e33db72061f4a388ca1f5b55c536 --- diff --git a/include/inputmethod.h b/include/inputmethod.h index d972539..0eb468b 100644 --- a/include/inputmethod.h +++ b/include/inputmethod.h @@ -771,7 +771,7 @@ typedef void (*ime_mime_type_set_request_cb)(const char *mime_type, void *user_d * * @privilege %http://tizen.org/privilege/ime * - * @remarks @a value is valid only in the callback. To use outside the callback, make a copy. + * @remarks @a key and @a value is valid only in the callback. To use outside the callback, make a copy. * This function is used by the applications to deliver the prediction hint data message to the input panel. * * @param[in] key The prediction hint key to be set to the input panel @@ -2530,6 +2530,24 @@ int ime_request_hide(void); */ int ime_update_input_panel_event(ime_event_type_e type, unsigned int value); +/** + * @brief Sets the candidate visibility state. + * + * @since_tizen 5.5 + * + * @privlevel public + * + * @privilege %http://tizen.org/privilege/ime + * + * @param[in] visible @c true - show candidate string, @c false - hide candidate string + * + * @return 0 on success, otherwise a negative error value + * @retval #IME_ERROR_NONE No error + * @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 + */ +int ime_set_candidate_visibility_state(bool visible); + /** * @} */ diff --git a/src/inputmethod.cpp b/src/inputmethod.cpp index af09eb6..e5fb446 100644 --- a/src/inputmethod.cpp +++ b/src/inputmethod.cpp @@ -2131,3 +2131,23 @@ EXPORT_API int ime_update_input_panel_event(ime_event_type_e type, unsigned int return IME_ERROR_NONE; } + +EXPORT_API int ime_set_candidate_visibility_state(bool visible) +{ + ime_error_e retVal = IME_ERROR_NONE; + + if (!g_running) { + LOGW("IME_ERROR_NOT_RUNNING"); + return IME_ERROR_NOT_RUNNING; + } + + retVal = _check_privilege(); + if (retVal != IME_ERROR_NONE) return retVal; + + if (visible) + g_core.show_candidate_string(); + else + g_core.hide_candidate_string(); + + return IME_ERROR_NONE; +}