IME_LAYOUT_PASSWORD_VARIATION_NUMBERONLY, /**< The password layout to allow only number */
} ime_layout_variation_e;
+/**
+ * @brief Enumeration of string attribute type
+ *
+ * @remarks Currently, a font style is available to use.
+ *
+ * @since_tizen 2.4
+ *
+ * @see ime_preedit_attribute, ime_update_preedit_string
+ */
+typedef enum
+{
+ IME_ATTR_NONE, /**< No attribute */
+ IME_ATTR_FONTSTYLE, /**< A font style attribute, e.g., underline, etc. */
+} ime_attribute_type;
+
+/**
+ * @brief Value for #IME_ATTR_FONTSTYLE. Draw a line under the text.
+ * @since_tizen 2.4
+ */
+#define IME_ATTR_FONTSTYLE_UNDERLINE 1
+
+/**
+ * @brief Value for #IME_ATTR_FONTSTYLE. Draw text in highlighted color.
+ * @since_tizen 2.4
+ */
+#define IME_ATTR_FONTSTYLE_HIGHLIGHT 2
+
+/**
+ * @brief Value for #IME_ATTR_FONTSTYLE. Draw text in reversal color.
+ * @since_tizen 2.4
+ */
+#define IME_ATTR_FONTSTYLE_REVERSAL 4
+
+/**
+ * @brief The structure type to contain the attributes for preedit string.
+ *
+ * @remarks A preedit string may have one or more different attributes. This structure describes each attribute of the string.
+ *
+ * @since_tizen 2.4
+ *
+ * @see ime_update_preedit_string, ime_attribute_type
+ */
+typedef struct
+{
+ unsigned int start; /**< The start position in the string of this attribute */
+ unsigned int length; /**< The byte length of this attribute, the range is [start, start+length] */
+ ime_attribute_type type; /**< The type of this attribute */
+ unsigned int value; /**< The value of this attribute */
+} ime_preedit_attribute;
+
/**
* @brief Handle of an associated text input UI control's input context.
*
* @privilege %http://tizen.org/privilege/ime
*
* @param[in] str The UTF-8 string to be updated in preedit
+ * @paran[in] attrs The Eina_List which has #ime_preedit_attribute lists; @a str can be composed of multiple
+ * string attributes: underline, highlight color and reversal color. The @a attrs will be released internally on success
*
* @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
*
- * @see ime_commit_string, ime_show_preedit_string, ime_hide_preedit_string
+ * @see ime_preedit_attribute, ime_commit_string, ime_show_preedit_string, ime_hide_preedit_string
+ *
+ * @code
+ {
+ int ret;
+ Eina_List *list = NULL;
+
+ ime_preedit_attribute *attr = calloc(1, sizeof (ime_preedit_attribute));
+ attr->start = 0;
+ attr->length = 1;
+ attr->type = IME_ATTR_FONTSTYLE;
+ attr->value = IME_ATTR_FONTSTYLE_UNDERLINE;
+ list = eina_list_append(list, attr);
+
+ attr = calloc(1, sizeof (ime_preedit_attribute));
+ attr->start = 1;
+ attr->length = 1;
+ attr->type = IME_ATTR_FONTSTYLE;
+ attr->value = IME_ATTR_FONTSTYLE_HIGHLIGHT;
+ list = eina_list_append(list, attr);
+
+ attr = calloc(1, sizeof (ime_preedit_attribute));
+ attr->start = 2;
+ attr->length = 1;
+ attr->type = IME_ATTR_FONTSTYLE;
+ attr->value = IME_ATTR_FONTSTYLE_REVERSAL;
+ list = eina_list_append(list, attr);
+
+ ret = ime_update_preedit_string("abcd", list);
+ if (ret != IME_ERROR_NONE) {
+ EINA_LIST_FREE(list, attr)
+ free(attr);
+ }
+ }
+ * @endcode
*/
-EXPORT_API int ime_update_preedit_string(const char *str);
+EXPORT_API int ime_update_preedit_string(const char *str, Eina_List *attrs);
/**
* @brief Requests the surrounding text from the position of the cursor, asynchronously.
* limitations under the License.
*/
+#define Uses_SCIM_ATTRIBUTE
+
+#include <scim.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!str)
+ return IME_ERROR_INVALID_PARAMETER;
+
g_core.commit_string(-1, NULL, str);
return IME_ERROR_NONE;
return IME_ERROR_NONE;
}
-int ime_update_preedit_string(const char *str)
+int ime_update_preedit_string(const char *str, Eina_List *attrs)
{
if (!g_running)
return IME_ERROR_NOT_RUNNING;
if (!str)
return IME_ERROR_INVALID_PARAMETER;
+ scim::AttributeList attrv;
+ ime_preedit_attribute *attr = NULL;
+
+ if (attrs) {
+ EINA_LIST_FREE(attrs, attr) {
+ if (attr) {
+ attrv.push_back(scim::Attribute(attr->start, attr->length, (scim::AttributeType)attr->type, attr->value));
+ free(attr);
+ }
+ }
+ }
+
+ //g_core.update_preedit_string(-1, NULL, str, attrv);
g_core.update_preedit_string(-1, NULL, str);
return IME_ERROR_NONE;
int ime_destroy_option_window(Evas_Object *window)
{
+ if (!g_running)
+ return IME_ERROR_NOT_RUNNING;
+
if (!window) {
LOGW("Window pointer is null.");
return IME_ERROR_INVALID_PARAMETER;
}
- if (!g_running)
- return IME_ERROR_NOT_RUNNING;
-
if (!g_event_callback.option_window_created || !g_event_callback.option_window_destroyed) {
LOGW("ime_create_option_window_cb() and ime_destroy_option_window_cb() callback functions are not set.");
return IME_ERROR_NO_CALLBACK_FUNCTION;
int ime_context_get_layout(ime_context_h context, Ecore_IMF_Input_Panel_Layout *layout)
{
- if (!context || !layout)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!context || !layout)
+ return IME_ERROR_INVALID_PARAMETER;
+
*layout = context->layout;
return IME_ERROR_NONE;
int ime_context_get_layout_variation(ime_context_h context, ime_layout_variation_e *layout_variation)
{
- if (!context || !layout_variation)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!context || !layout_variation)
+ return IME_ERROR_INVALID_PARAMETER;
+
*layout_variation = static_cast<ime_layout_variation_e>(context->layout_variation);
return IME_ERROR_NONE;
int ime_context_get_cursor_position(ime_context_h context, int *cursor_pos)
{
- if (!context || !cursor_pos)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!context || !cursor_pos)
+ return IME_ERROR_INVALID_PARAMETER;
+
*cursor_pos = context->cursor_pos;
return IME_ERROR_NONE;
int ime_context_get_autocapital_type(ime_context_h context, Ecore_IMF_Autocapital_Type *autocapital_type)
{
- if (!context || !autocapital_type)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!context || !autocapital_type)
+ return IME_ERROR_INVALID_PARAMETER;
+
*autocapital_type = context->autocapital_type;
return IME_ERROR_NONE;
int ime_context_get_return_key_type(ime_context_h context, Ecore_IMF_Input_Panel_Return_Key_Type *return_key_type)
{
- if (!context || !return_key_type)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!context || !return_key_type)
+ return IME_ERROR_INVALID_PARAMETER;
+
*return_key_type = context->return_key_type;
return IME_ERROR_NONE;
int ime_context_get_return_key_state(ime_context_h context, bool *return_key_state)
{
- if (!context || !return_key_state)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!context || !return_key_state)
+ return IME_ERROR_INVALID_PARAMETER;
+
*return_key_state = static_cast<bool>(context->return_key_disabled);
return IME_ERROR_NONE;
int ime_context_get_prediction_mode(ime_context_h context, bool *prediction_mode)
{
- if (!context || !prediction_mode)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!context || !prediction_mode)
+ return IME_ERROR_INVALID_PARAMETER;
+
*prediction_mode = static_cast<bool>(context->prediction_allow);
return IME_ERROR_NONE;
int ime_context_get_password_mode(ime_context_h context, bool *password_mode)
{
- if (!context || !password_mode)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!context || !password_mode)
+ return IME_ERROR_INVALID_PARAMETER;
+
*password_mode = static_cast<bool>(context->password_mode);
return IME_ERROR_NONE;
int ime_context_get_input_hint(ime_context_h context, Ecore_IMF_Input_Hints *input_hint)
{
- if (!context || !input_hint)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!context || !input_hint)
+ return IME_ERROR_INVALID_PARAMETER;
+
*input_hint = context->input_hint;
return IME_ERROR_NONE;
int ime_context_get_bidi_direction(ime_context_h context, Ecore_IMF_BiDi_Direction *bidi)
{
- if (!context || !bidi)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!context || !bidi)
+ return IME_ERROR_INVALID_PARAMETER;
+
*bidi = context->bidi_direction;
return IME_ERROR_NONE;
int ime_context_get_language(ime_context_h context, Ecore_IMF_Input_Panel_Lang *language)
{
- if (!context || !language)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!context || !language)
+ return IME_ERROR_INVALID_PARAMETER;
+
*language = context->language;
return IME_ERROR_NONE;
int ime_device_info_get_name(ime_device_info_h dev_info, char **dev_name)
{
- if (!dev_info || !dev_name)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!dev_info || !dev_name)
+ return IME_ERROR_INVALID_PARAMETER;
+
if (!dev_info->dev_name)
*dev_name = strdup("");
else
int ime_device_info_get_class(ime_device_info_h dev_info, Ecore_IMF_Device_Class *dev_class)
{
- if (!dev_info || !dev_class)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!dev_info || !dev_class)
+ return IME_ERROR_INVALID_PARAMETER;
+
*dev_class = dev_info->dev_class;
return IME_ERROR_NONE;
int ime_device_info_get_subclass(ime_device_info_h dev_info, Ecore_IMF_Device_Subclass *dev_subclass)
{
- if (!dev_info || !dev_subclass)
- return IME_ERROR_INVALID_PARAMETER;
-
if (!g_running)
return IME_ERROR_NOT_RUNNING;
+ if (!dev_info || !dev_subclass)
+ return IME_ERROR_INVALID_PARAMETER;
+
*dev_subclass = dev_info->dev_subclass;
return IME_ERROR_NONE;