Elementary entry: Added elm_entry_cursor_pos_set/get (for scrolled as well).

Added elm_scrolled_entry_cursor_pos_set/get and elm_entry_cursor_pos_set/get
Patch by Jihoon Kim.

SVN revision: 57366
This commit is contained in:
Tom Hacohen 2011-02-27 10:25:45 +00:00
parent 8530ab5f6e
commit 09bbe67ee2
3 changed files with 72 additions and 0 deletions

View File

@ -1224,6 +1224,8 @@ extern "C" {
EAPI Eina_Bool elm_entry_cursor_is_visible_format_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI const char *elm_entry_cursor_content_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI Eina_Bool elm_entry_cursor_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) EINA_ARG_NONNULL(1);
EAPI void elm_entry_cursor_pos_set(const Evas_Object *obj, int pos) EINA_ARG_NONNULL(1);
EAPI int elm_entry_cursor_pos_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_entry_selection_cut(Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_entry_selection_copy(Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_entry_selection_paste(Evas_Object *obj) EINA_ARG_NONNULL(1);
@ -2242,6 +2244,8 @@ extern "C" {
EAPI Eina_Bool elm_scrolled_entry_cursor_is_format_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI Eina_Bool elm_scrolled_entry_cursor_is_visible_format_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI const char *elm_scrolled_entry_cursor_content_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_scrolled_entry_cursor_pos_set(const Evas_Object *obj, int pos) EINA_ARG_NONNULL(1);
EAPI int elm_scrolled_entry_cursor_pos_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_scrolled_entry_selection_cut(Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_scrolled_entry_selection_copy(Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_scrolled_entry_selection_paste(Evas_Object *obj) EINA_ARG_NONNULL(1);

View File

@ -1150,6 +1150,40 @@ elm_scrolled_entry_cursor_content_get(const Evas_Object *obj)
return elm_entry_cursor_content_get(wd->entry);
}
/**
* Sets the cursor position in the scrolled entry to the given value
*
* @param obj The scrolled entry object
* @param pos the position of the cursor
*
* @ingroup Scrolled_Entry
*/
EAPI void
elm_scrolled_entry_cursor_pos_set(const Evas_Object *obj, int pos)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
elm_entry_cursor_pos_set(wd->entry, pos);
}
/**
* Retrieves the current position of the cursor in the scrolled entry
*
* @param obj The entry object
* @return the cursor position
*
* @ingroup Scrolled_Entry
*/
EAPI int
elm_scrolled_entry_cursor_pos_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) 0;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
return elm_entry_cursor_pos_get(wd->entry);
}
/**
* This executes a "cut" action on the selected text in the scrolled entry.
*

View File

@ -2211,6 +2211,40 @@ elm_entry_cursor_content_get(const Evas_Object *obj)
return edje_object_part_text_cursor_content_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
/**
* Sets the cursor position in the entry to the given value
*
* @param obj The entry object
* @param pos The position of the cursor
*
* @ingroup Entry
*/
EAPI void
elm_entry_cursor_pos_set(const Evas_Object *obj, int pos)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
edje_object_part_text_cursor_pos_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN, pos);
}
/**
* Retrieves the current position of the cursor in the entry
*
* @param obj The entry object
* @return The cursor position
*
* @ingroup Entry
*/
EAPI int
elm_entry_cursor_pos_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) 0;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return 0;
return edje_object_part_text_cursor_pos_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
/**
* This executes a "cut" action on the selected text in the entry.
*