Adding focus and unfocused smart callbacks for entry
authorIván Briano <sachieru@gmail.com>
Fri, 26 Mar 2010 06:46:31 +0000 (06:46 +0000)
committerIván Briano <sachieru@gmail.com>
Fri, 26 Mar 2010 06:46:31 +0000 (06:46 +0000)
SVN revision: 47481

src/lib/Elementary.h.in
src/lib/elc_scrolled_entry.c
src/lib/elm_entry.c

index c78b57b..916c213 100644 (file)
@@ -614,7 +614,7 @@ extern "C" {
     * "selection,start" - the user started selecting text
     * "selection,changed" - the user modified the selection size/location
     * "selection,cleared" - the user cleared the selection
-    * "selection,paste" - the user rrequested a paste of text
+    * "selection,paste" - the user requested a paste of text
     * "selection,copy" - the user copied the text
     * "selection,cut" - the user cut the text
     * "cursor,changed" - the cursor changed position
@@ -624,6 +624,8 @@ extern "C" {
     * "clicked" - when finger/mouse is pressed and released (without a drag etc.)
     * "clicked,double" - when finger/mouse is double-pressed
     * "longpressed" - the entry has been longpressed
+    * "focused" - the entry has received keyboard focus
+    * "unfocused" - keyboard focus is gone
     */
 
    /* composite widgets - these basically put together basic widgets above
index a5ba170..5175d44 100644 (file)
@@ -145,6 +145,18 @@ _entry_longpressed(void *data, Evas_Object *obj __UNUSED__, void *event_info __U
    evas_object_smart_callback_call(data, "longpressed", NULL);
 }
 
+static void
+_entry_focused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   evas_object_smart_callback_call(data, "focused", NULL);
+}
+
+static void
+_entry_unfocused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   evas_object_smart_callback_call(data, "unfocused", NULL);
+}
+
 EAPI Evas_Object *
 elm_scrolled_entry_add(Evas_Object *parent)
 {
@@ -189,6 +201,8 @@ elm_scrolled_entry_add(Evas_Object *parent)
    evas_object_smart_callback_add(wd->entry, "selection,copy", _entry_selection_copy, obj);
    evas_object_smart_callback_add(wd->entry, "selection,cut", _entry_selection_cut, obj);
    evas_object_smart_callback_add(wd->entry, "longpressed", _entry_longpressed, obj);
+   evas_object_smart_callback_add(wd->entry, "focused", _entry_focused, obj);
+   evas_object_smart_callback_add(wd->entry, "unfocused", _entry_unfocused, obj);
 
    _sizing_eval(obj);
 
index 46221a9..6a1a394 100644 (file)
@@ -211,12 +211,14 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
        evas_object_focus_set(wd->ent, 1);
        edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
        if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
+       evas_object_smart_callback_call(obj, "focused", NULL);
      }
    else
      {
        edje_object_signal_emit(wd->ent, "elm,action,unfocus", "elm");
        evas_object_focus_set(wd->ent, 0);
        if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
+       evas_object_smart_callback_call(obj, "unfocused", NULL);
      }
 }