Enlightenment CVS committal

Author  : codewarrior
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_actions.c e_dialog.c e_entry.c 


Log Message:
Add ability to focus a button in an E_Dialog by either its number or a
pointer to it.

When we click a button we need to send a focus signal to it.


===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_actions.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- e_actions.c 24 Sep 2005 02:49:55 -0000      1.30
+++ e_actions.c 25 Sep 2005 21:33:48 -0000      1.31
@@ -1131,7 +1131,7 @@
    e_dialog_icon_set(dia, "enlightenment/exit", 64);
    e_dialog_button_add(dia, _("Yes"), NULL, _e_actions_cb_exit_dialog_ok, 
NULL);
    e_dialog_button_add(dia, _("No"), NULL, NULL, NULL);
-   e_dialog_button_focus(dia, 1);
+   e_dialog_button_focus_num(dia, 1);
    e_win_centered_set(dia->win, 1);
    e_dialog_show(dia);
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dialog.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- e_dialog.c  25 Sep 2005 13:12:57 -0000      1.19
+++ e_dialog.c  25 Sep 2005 21:33:48 -0000      1.20
@@ -19,6 +19,7 @@
 static void _e_dialog_free(E_Dialog *dia);
 static void _e_dialog_cb_button_clicked(void *data, Evas_Object *obj, const 
char *emission, const char *source);
 static void _e_dialog_button_cb_mouse_in(void *data, Evas *e, Evas_Object 
*obj, void *event);
+static void _e_dialog_button_cb_mouse_down(void *data, Evas *e, Evas_Object 
*obj, void *event);
 static void _e_dialog_cb_delete(E_Win *win);
 static void _e_dialog_cb_key_down(void *data, Evas *e, Evas_Object *obj, void 
*event);
 
@@ -115,6 +116,7 @@
    edje_object_part_text_set(db->obj, "button_text", db->label);
    
    evas_object_event_callback_add(db->obj, EVAS_CALLBACK_MOUSE_IN, 
_e_dialog_button_cb_mouse_in, dia);
+   evas_object_event_callback_add(db->obj, EVAS_CALLBACK_MOUSE_DOWN, 
_e_dialog_button_cb_mouse_down, db);
    
    if (icon)
      {
@@ -141,13 +143,17 @@
 }
 
 int
-e_dialog_button_focus(E_Dialog *dia, int button)
+e_dialog_button_focus_num(E_Dialog *dia, int button)
 {
    E_Dialog_Button *db = NULL;
+
+   if (button < 0)
+     return 0;
    
    db = evas_list_nth(dia->buttons, button);
-   
-   if (!db) return 0;
+    
+   if (!db) 
+     return 0;
 
    if (dia->focused)
      {
@@ -164,6 +170,34 @@
    return 1;
 }
 
+int
+e_dialog_button_focus_button(E_Dialog *dia, E_Dialog_Button *button)
+{
+   E_Dialog_Button *db = NULL;
+   
+   if (!button)
+     return 0;
+   
+   db = evas_list_find(dia->buttons, button);
+ 
+   if (!db)
+     return 0;
+   
+   if (dia->focused)
+     {
+       E_Dialog_Button *focused;
+
+       focused = dia->focused->data;
+       if (focused)
+         edje_object_signal_emit(focused->obj, "unfocus", "");      
+     }
+
+   dia->focused = evas_list_find_list(dia->buttons, button);
+   edje_object_signal_emit(db->obj, "focus", "");
+
+   return 1;
+}
+
 void
 e_dialog_title_set(E_Dialog *dia, char *title)
 {
@@ -244,8 +278,11 @@
    E_Dialog_Button *db;
    
    db = data;
-   if (db->func)
-     db->func(db->data, db->dialog);
+   if (db->func) 
+   {
+      edje_object_signal_emit(db->obj, "focus", "");
+      db->func(db->data, db->dialog);
+   }
    else
      e_object_del(E_OBJECT(db->dialog));
 }
@@ -256,6 +293,18 @@
    edje_object_signal_emit(obj, "enter", "");  
 }
 
+static void
+_e_dialog_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void 
*event)
+{        
+   E_Dialog *dia;
+   E_Dialog_Button *db;
+   
+   db = data;
+   dia = db->dialog;
+   
+   e_dialog_button_focus_button(dia, db);
+}
+
 /* TODO: Implement shift-tab and left arrow */
 static void
 _e_dialog_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event)
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_entry.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_entry.c   25 Sep 2005 13:12:57 -0000      1.2
+++ e_entry.c   25 Sep 2005 21:33:48 -0000      1.3
@@ -124,8 +124,7 @@
    E_Entry_Smart_Data *e_entry_sd;
       
    if (!object || !(e_entry_sd = evas_object_smart_data_get(object)))
-     return;
-         
+     return;   
 }
 
 static void _e_entry_smart_raise(Evas_Object *object)
@@ -133,7 +132,9 @@
    E_Entry_Smart_Data *e_entry_sd;
       
    if (!object || !(e_entry_sd = evas_object_smart_data_get(object)))
-     return;   
+     return;
+   
+   evas_object_raise(e_entry_sd->edje_object);   
 }
 
 static void _e_entry_smart_lower(Evas_Object *object)
@@ -141,7 +142,9 @@
    E_Entry_Smart_Data *e_entry_sd;
       
    if (!object || !(e_entry_sd = evas_object_smart_data_get(object)))
-     return;   
+     return;
+   
+   evas_object_lower(e_entry_sd->edje_object);
 }
 
 static void _e_entry_smart_stack_above(Evas_Object *object, Evas_Object *above)
@@ -150,6 +153,8 @@
       
    if (!object || !(e_entry_sd = evas_object_smart_data_get(object)))
      return;   
+   
+   evas_object_stack_above(e_entry_sd->edje_object, above);
 }
 
 static void _e_entry_smart_stack_below(Evas_Object *object, Evas_Object *below)
@@ -157,7 +162,9 @@
    E_Entry_Smart_Data *e_entry_sd;
       
    if (!object || !(e_entry_sd = evas_object_smart_data_get(object)))
-     return;   
+     return;
+   
+   evas_object_stack_below(e_entry_sd->edje_object, below);
 }
 
 static void _e_entry_smart_move(Evas_Object *object, Evas_Coord x, Evas_Coord 
y)
@@ -196,6 +203,8 @@
       
    if (!object || !(e_entry_sd = evas_object_smart_data_get(object)))
      return;   
+   
+   evas_object_hide (e_entry_sd->edje_object);
 }
 
 /* Called when the user presses a key */
@@ -226,9 +235,6 @@
      e_editable_text_insert(obj, key_event->string);
 }
 
-
-
-
 Evas_Object *e_editable_text_add(Evas *evas)
 {
    Evas_Object *o;




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to