Elm entry: Added changed,user signal.

This signal indicates the entry was changed because of user interaction

SVN revision: 62045
This commit is contained in:
Tom Hacohen 2011-08-03 09:00:36 +00:00
parent 5f84a1a170
commit 8144ea2198
4 changed files with 24 additions and 3 deletions

View File

@ -8256,6 +8256,7 @@ extern "C" {
* This widget emits the following signals:
*
* @li "changed": The text within the entry was changed.
* @li "changed,user": The text within the entry was changed because of user interaction.
* @li "activated": The enter key was pressed on a single line entry.
* @li "press": A mouse button has been pressed on the entry.
* @li "longpressed": A mouse button has been pressed and held for a couple

View File

@ -750,7 +750,7 @@ notify_handler_text(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify)
cnp_debug("Notify handler text %d %d %p\n", data->format,data->length, data->data);
str = mark_up((char *)data->data, data->length, NULL);
cnp_debug("String is %s (from %s)\n", str, data->data);
elm_entry_entry_insert(sel->requestwidget, str);
_elm_entry_entry_paste(sel->requestwidget, str);
free(str);
return 0;
}
@ -936,7 +936,7 @@ notify_handler_html(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify)
strncpy(stripstr, (char *)data->data, data->length);
stripstr[data->length] = '\0';
cnp_debug("String is %s (%d bytes)\n", stripstr, data->length);
elm_entry_entry_insert(sel->requestwidget, stripstr);
_elm_entry_entry_paste(sel->requestwidget, stripstr);
free(stripstr);
return 0;
}
@ -1023,7 +1023,7 @@ pasteimage_append(char *file, Evas_Object *entry)
entrytag = alloca(len + 1);
snprintf(entrytag, len + 1, tagstring, file);
elm_entry_entry_insert(entry, entrytag);
_elm_entry_entry_paste(entry, entrytag);
return EINA_TRUE;
}

View File

@ -118,6 +118,7 @@ static void _signal_cursor_changed(void *data, Evas_Object *obj, const char *emi
static void _add_chars_till_limit(Evas_Object *obj, char **text, int can_add, Length_Unit unit);
static const char SIG_CHANGED[] = "changed";
static const char SIG_CHANGED_USER[] = "changed,user";
static const char SIG_ACTIVATED[] = "activated";
static const char SIG_PRESS[] = "press";
static const char SIG_LONGPRESSED[] = "longpressed";
@ -162,6 +163,7 @@ static const Evas_Smart_Cb_Description _signals[] = {
{SIG_ANCHOR_IN, ""},
{SIG_ANCHOR_OUT, ""},
{SIG_PREEDIT_CHANGED, ""},
{SIG_CHANGED_USER, ""},
{NULL, NULL}
};
@ -924,6 +926,13 @@ _select(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
elm_widget_scroll_hold_push(data);
}
void
_elm_entry_entry_paste(Evas_Object *obj, const char *entry)
{
elm_entry_entry_insert(obj, entry);
evas_object_smart_callback_call(obj, SIG_CHANGED_USER, NULL);
}
static void
_paste(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
@ -1283,6 +1292,12 @@ _signal_entry_changed(void *data, Evas_Object *obj __UNUSED__, const char *emiss
_entry_changed_common_handling(data, SIG_CHANGED);
}
static void
_signal_entry_changed_user(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
evas_object_smart_callback_call(data, SIG_CHANGED_USER, NULL);
}
static void
_signal_preedit_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
@ -2001,6 +2016,8 @@ elm_entry_add(Evas_Object *parent)
_elm_theme_object_set(obj, wd->ent, "entry", "base", "default");
edje_object_signal_callback_add(wd->ent, "entry,changed", "elm.text",
_signal_entry_changed, obj);
edje_object_signal_callback_add(wd->ent, "entry,changed,user", "elm.text",
_signal_entry_changed_user, obj);
edje_object_signal_callback_add(wd->ent, "preedit,changed", "elm.text",
_signal_preedit_changed, obj);
edje_object_signal_callback_add(wd->ent, "selection,start", "elm.text",

View File

@ -237,4 +237,7 @@ extern int _elm_log_dom;
extern Eina_List *_elm_win_list;
extern int _elm_win_deferred_free;
/* Used by the paste handler */
void _elm_entry_entry_paste(Evas_Object *obj, const char *entry);
#endif