forked from enlightenment/efl
Edje entry: Added edje_object_part_text_cursor_pos_get/set.
This adds the ability to control the text position of an edje_entry. Patch by Jihoon Kim. SVN revision: 57365
This commit is contained in:
parent
e1f359a127
commit
7a66e72df5
|
@ -37,3 +37,7 @@
|
|||
|
||||
* fix signal comming from box/table item to include their
|
||||
index or name correctly.
|
||||
|
||||
2011-02-25 Jihoon Kim
|
||||
|
||||
* Add edje_object_part_text_cursor_pos_{set,get} API
|
||||
|
|
|
@ -608,6 +608,8 @@ typedef Evas_Object *(*Edje_Item_Provider_Cb) (void *data, Evas_Object *obj, c
|
|||
EAPI Eina_Bool edje_object_part_text_cursor_is_format_get (const Evas_Object *obj, const char *part, Edje_Cursor cur);
|
||||
EAPI Eina_Bool edje_object_part_text_cursor_is_visible_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur);
|
||||
EAPI const char *edje_object_part_text_cursor_content_get (const Evas_Object *obj, const char *part, Edje_Cursor cur);
|
||||
EAPI void edje_object_part_text_cursor_pos_set (Evas_Object *obj, const char *part, Edje_Cursor cur, int pos);
|
||||
EAPI int edje_object_part_text_cursor_pos_get (const Evas_Object *obj, const char *part, Edje_Cursor cur);
|
||||
|
||||
EAPI void edje_object_text_insert_filter_callback_add (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data);
|
||||
EAPI void *edje_object_text_insert_filter_callback_del (Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func);
|
||||
|
|
|
@ -2603,6 +2603,37 @@ _edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur)
|
|||
return s;
|
||||
}
|
||||
|
||||
void
|
||||
_edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos)
|
||||
{
|
||||
Entry *en = rp->entry_data;
|
||||
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
||||
if (!c) return;
|
||||
evas_textblock_cursor_pos_set(c, pos);
|
||||
_curs_update_from_curs(c, rp->object, rp->entry_data);
|
||||
_sel_update(c, rp->object, rp->entry_data);
|
||||
|
||||
#ifdef HAVE_ECORE_IMF
|
||||
if (en->imf_context)
|
||||
{
|
||||
ecore_imf_context_reset(en->imf_context);
|
||||
ecore_imf_context_cursor_position_set(en->imf_context,
|
||||
evas_textblock_cursor_pos_get(en->cursor));
|
||||
}
|
||||
#endif
|
||||
|
||||
_edje_emit(rp->edje, "cursor,changed", rp->part->name);
|
||||
_edje_entry_real_part_configure(rp);
|
||||
}
|
||||
|
||||
int
|
||||
_edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur)
|
||||
{
|
||||
Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
|
||||
if (!c) return 0;
|
||||
return evas_textblock_cursor_pos_get(c);
|
||||
}
|
||||
|
||||
#ifdef HAVE_ECORE_IMF
|
||||
static Eina_Bool
|
||||
_edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx __UNUSED__, char **text, int *cursor_pos)
|
||||
|
|
|
@ -1776,6 +1776,8 @@ Eina_Bool _edje_entry_cursor_coord_set(Edje_Real_Part *rp, Edje_Cursor cur, int
|
|||
Eina_Bool _edje_entry_cursor_is_format_get(Edje_Real_Part *rp, Edje_Cursor cur);
|
||||
Eina_Bool _edje_entry_cursor_is_visible_format_get(Edje_Real_Part *rp, Edje_Cursor cur);
|
||||
const char *_edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur);
|
||||
void _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos);
|
||||
int _edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur);
|
||||
|
||||
void _edje_external_init();
|
||||
void _edje_external_shutdown();
|
||||
|
|
|
@ -2213,6 +2213,57 @@ edje_object_part_text_cursor_content_get(const Evas_Object *obj, const char *par
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the cursor position to the given value
|
||||
*
|
||||
* @param obj A valid Evas_Object handle
|
||||
* @param part The part name
|
||||
* @param cur The cursor to move
|
||||
* @param pos the position of the cursor
|
||||
* @since 1.1.0
|
||||
*/
|
||||
EAPI void
|
||||
edje_object_part_text_cursor_pos_set(Evas_Object *obj, const char *part, Edje_Cursor cur, int pos)
|
||||
{
|
||||
Edje *ed;
|
||||
Edje_Real_Part *rp;
|
||||
|
||||
ed = _edje_fetch(obj);
|
||||
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_cursor_pos_set(rp, cur, pos);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves the current position of the cursor
|
||||
*
|
||||
* @param obj A valid Evas_Object handle
|
||||
* @param part The part name
|
||||
* @param cur The cursor to get the position
|
||||
* @return The cursor position
|
||||
* @since 1.1.0
|
||||
*/
|
||||
EAPI int
|
||||
edje_object_part_text_cursor_pos_get(const Evas_Object *obj, const char *part, Edje_Cursor cur)
|
||||
{
|
||||
Edje *ed;
|
||||
Edje_Real_Part *rp;
|
||||
|
||||
ed = _edje_fetch(obj);
|
||||
if ((!ed) || (!part)) return 0;
|
||||
rp = _edje_real_part_recursive_get(ed, part);
|
||||
if (!rp) return 0;
|
||||
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
||||
{
|
||||
return _edje_entry_cursor_pos_get(rp, cur);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a filter function for newly inserted text.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue