Add edje_object_part_text_input_hint_set/get API

Sets or get the input hint which allows input methods to fine-tune their behavior.
This commit is contained in:
Jihoon Kim 2014-09-01 19:01:54 +09:00
parent 6ed29b4425
commit 715da43d3a
5 changed files with 94 additions and 0 deletions

View File

@ -1007,6 +1007,13 @@ typedef enum _Edje_Input_Panel_Layout
EDJE_INPUT_PANEL_LAYOUT_EMOTICON /**< Emoticon layout @since 1.10 */
} Edje_Input_Panel_Layout;
typedef enum
{
EDJE_INPUT_HINT_NONE = 0, /**< No active hints @since 1.12 */
EDJE_INPUT_HINT_AUTO_COMPLETE = 1 << 0, /**< Suggest word auto completion @since 1.12 */
EDJE_INPUT_HINT_SENSITIVE_DATA = 1 << 1, /**< Typed text should not be stored. @since 1.12 */
} Edje_Input_Hints;
enum
{
EDJE_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_NORMAL,

View File

@ -3191,6 +3191,40 @@ _edje_entry_prediction_allow_get(Edje_Real_Part *rp)
return en->prediction_allow;
}
void
_edje_entry_input_hint_set(Edje_Real_Part *rp, Edje_Input_Hints input_hints)
{
Entry *en;
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
(!rp->typedata.text)) return;
en = rp->typedata.text->entry_data;
if (!en) return;
#ifdef HAVE_ECORE_IMF
if (en->imf_context)
ecore_imf_context_input_hint_set(en->imf_context, input_hints);
#else
(void) input_hints;
#endif
}
Edje_Input_Hints
_edje_entry_input_hint_get(const Edje_Real_Part *rp)
{
Entry *en;
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
(!rp->typedata.text)) return EDJE_INPUT_HINT_NONE;
en = rp->typedata.text->entry_data;
if (!en) return EDJE_INPUT_HINT_NONE;
#ifdef HAVE_ECORE_IMF
if (en->imf_context)
return ecore_imf_context_input_hint_get(en->imf_context);
#endif
return EDJE_INPUT_HINT_NONE;
}
void
_edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled)
{

View File

@ -2013,6 +2013,28 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File)
@in const(char)* part; /*@ The part name */
}
}
part_text_input_hint_set {
/*@
Sets the input hint which allows input methods to fine-tune their behavior.
@since 1.12.0 */
params {
@in const(char)* part; /*@ The part name */
@in Edje_Input_Hints input_hints; /*@ input hints */
}
}
part_text_input_hint_get @const {
/*@
Gets the value of input hint
@return The value of input hint
@since 1.12.0 */
return: Edje_Input_Hints;
params {
@in const(char)* part; /*@ The part name */
}
}
part_text_selection_get @const {
/*@
@brief Return the selection text of the object part.

View File

@ -2358,6 +2358,8 @@ void _edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_
Edje_Text_Autocapital_Type _edje_entry_autocapital_type_get(Edje_Real_Part *rp);
void _edje_entry_prediction_allow_set(Edje_Real_Part *rp, Eina_Bool prediction);
Eina_Bool _edje_entry_prediction_allow_get(Edje_Real_Part *rp);
void _edje_entry_input_hint_set(Edje_Real_Part *rp, Edje_Input_Hints input_hints);
Edje_Input_Hints _edje_entry_input_hint_get(const Edje_Real_Part *rp);
void _edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled);
Eina_Bool _edje_entry_input_panel_enabled_get(Edje_Real_Part *rp);
void _edje_entry_input_panel_show(Edje_Real_Part *rp);

View File

@ -2130,6 +2130,35 @@ _edje_object_part_text_prediction_allow_get(Eo *obj EINA_UNUSED, Edje *ed, const
return ret;
}
EOLIAN void
_edje_object_part_text_input_hint_set(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Edje_Input_Hints input_hints)
{
Edje_Real_Part *rp;
if ((!ed) || (!part)) return;
rp = _edje_real_part_recursive_get(&ed, part);
if (!rp) return;
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
{
_edje_entry_input_hint_set(rp, input_hints);
}
}
EOLIAN Edje_Input_Hints
_edje_object_part_text_input_hint_get(const Eo *obj EINA_UNUSED, Edje *ed, const char *part)
{
Edje_Real_Part *rp;
if ((!ed) || (!part)) return EINA_FALSE;
rp = _edje_real_part_recursive_get(&ed, part);
if (!rp) return EINA_FALSE;
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
{
return _edje_entry_input_hint_get(rp);
}
return EINA_FALSE;
}
EOLIAN void
_edje_object_part_text_input_panel_enabled_set(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Eina_Bool enabled)
{