kbd input/fcosu works on inlined wins. wootsors
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 14 Apr 2011 12:47:16 +0000 (12:47 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 14 Apr 2011 12:47:16 +0000 (12:47 +0000)
git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@58664 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/test_win_inline.c
src/lib/elm_widget.c
src/lib/elm_widget.h
src/lib/elm_win.c

index 1ffd916..5c46a20 100644 (file)
@@ -7,7 +7,7 @@
 static void
 fill(Evas_Object *win, Eina_Bool do_bg)
 {
-   Evas_Object *bg, *sc, *bx, *ic, *bb, *av;
+   Evas_Object *bg, *sc, *bx, *ic, *bb, *av, *en;
    char buf[PATH_MAX];
 
    if (do_bg)
@@ -26,6 +26,24 @@ fill(Evas_Object *win, Eina_Bool do_bg)
    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
    evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
+   en = elm_scrolled_entry_add(win);
+   evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
+   elm_scrolled_entry_entry_set(en, "This is a single line");
+   elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+   elm_scrolled_entry_single_line_set(en, 1);
+   evas_object_show(en);
+   elm_box_pack_end(bx, en);
+   
+   en = elm_scrolled_entry_add(win);
+   evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
+   elm_scrolled_entry_entry_set(en, "Entry 2");
+   elm_scrolled_entry_scrollbar_policy_set(en, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+   elm_scrolled_entry_single_line_set(en, 1);
+   evas_object_show(en);
+   elm_box_pack_end(bx, en);
+   
    ic = elm_icon_add(win);
    snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
    elm_icon_file_set(ic, buf, NULL);
index 97d71aa..9df2094 100644 (file)
@@ -215,7 +215,7 @@ _sub_obj_hide(void        *data __UNUSED__,
               Evas_Object *obj,
               void        *event_info __UNUSED__)
 {
-   _if_focused_revert(obj, EINA_TRUE);
+   elm_widget_focus_hide_handle(obj);
 }
 
 static void
@@ -224,16 +224,7 @@ _sub_obj_mouse_down(void        *data __UNUSED__,
                     Evas_Object *obj,
                     void        *event_info __UNUSED__)
 {
-   Evas_Object *o = obj;
-   do
-     {
-        if (_elm_widget_is(o)) break;
-        o = evas_object_smart_parent_get(o);
-     }
-   while (o);
-   if (!o) return;
-   if (!_is_focusable(o)) return;
-   elm_widget_focus_steal(o);
+   elm_widget_focus_mouse_down_handle(obj);
 }
 
 static void
@@ -2224,6 +2215,27 @@ elm_widget_stringlist_free(Eina_List *list)
    EINA_LIST_FREE(list, s) eina_stringshare_del(s);
 }
 
+EAPI void
+elm_widget_focus_hide_handle(Evas_Object *obj)
+{
+   _if_focused_revert(obj, EINA_TRUE);
+}
+
+EAPI void
+elm_widget_focus_mouse_down_handle(Evas_Object *obj)
+{
+   Evas_Object *o = obj;
+   do
+     {
+        if (_elm_widget_is(o)) break;
+        o = evas_object_smart_parent_get(o);
+     }
+   while (o);
+   if (!o) return;
+   if (!_is_focusable(o)) return;
+   elm_widget_focus_steal(o);
+}
+
 /**
  * @internal
  *
@@ -3069,4 +3081,4 @@ elm_widget_tree_dot_dump(const Evas_Object *top,
    (void)top;
    (void)output;
 #endif
-}
\ No newline at end of file
+}
index 324eedb..6a58000 100644 (file)
@@ -306,6 +306,8 @@ EAPI void             elm_widget_type_register(const char **ptr);
 EAPI Eina_Bool        elm_widget_type_check(const Evas_Object *obj, const char *type);
 EAPI Eina_List       *elm_widget_stringlist_get(const char *str);
 EAPI void             elm_widget_stringlist_free(Eina_List *list);
+EAPI void             elm_widget_focus_hide_handle(Evas_Object *obj);
+EAPI void             elm_widget_focus_mouse_down_handle(Evas_Object *obj);
 
 EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size);
 EAPI void             _elm_widget_item_del(Elm_Widget_Item *item);
@@ -556,5 +558,4 @@ Eina_Bool            elm_drop_target_add(Evas_Object *widget, Elm_Sel_Type, Elm_
 Eina_Bool            elm_drop_target_del(Evas_Object *widget);
 Eina_Bool            elm_drag_start(Evas_Object *, Elm_Sel_Format, const char *, void (*)(void *,Evas_Object*),void*);
 
-
 #endif
index 45bfb34..4b459c9 100644 (file)
@@ -192,10 +192,13 @@ _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_O
 static void
 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
 {
-   if (elm_widget_focus_get(obj))
-     evas_object_focus_set(obj, EINA_TRUE);
+   Elm_Win *win = elm_widget_data_get(obj);
+   if (!win) return;
+   
+   if (win->img_obj)
+      evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
    else
-     evas_object_focus_set(obj, EINA_FALSE);
+      evas_object_focus_set(obj, elm_widget_focus_get(obj));
 }
 
 static Eina_Bool
@@ -206,7 +209,7 @@ _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_T
         Evas_Event_Key_Down *ev = event_info;
         if (!strcmp(ev->keyname, "Tab"))
           {
-             if(evas_key_modifier_is_set(ev->modifiers, "Shift"))
+             if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
                elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
              else
                elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
@@ -1049,6 +1052,65 @@ _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, voi
 }
 #endif
 
+static void
+_win_img_hide(void        *data,
+              Evas        *e __UNUSED__,
+              Evas_Object *obj __UNUSED__,
+              void        *event_info __UNUSED__)
+{
+   Elm_Win *win = data;
+   
+   elm_widget_focus_hide_handle(win->win_obj);
+}
+
+static void
+_win_img_mouse_down(void        *data,
+                    Evas        *e __UNUSED__,
+                    Evas_Object *obj __UNUSED__,
+                    void        *event_info __UNUSED__)
+{
+   Elm_Win *win = data;
+   elm_widget_focus_mouse_down_handle(win->win_obj);
+}
+
+static void
+_win_img_focus_in(void        *data,
+                  Evas        *e __UNUSED__,
+                  Evas_Object *obj __UNUSED__,
+                  void        *event_info __UNUSED__)
+{
+   Elm_Win *win = data;
+   elm_widget_focus_steal(win->win_obj);
+}
+
+static void
+_win_img_focus_out(void        *data,
+                   Evas        *e __UNUSED__,
+                   Evas_Object *obj __UNUSED__,
+                   void        *event_info __UNUSED__)
+{
+   Elm_Win *win = data;
+   elm_widget_focused_object_clear(win->win_obj);
+}
+
+static void
+_win_inlined_image_set(Elm_Win *win)
+{
+   evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
+   evas_object_image_filled_set(win->img_obj, EINA_TRUE);
+   evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
+                                  _elm_win_obj_callback_img_obj_del, win);
+   
+   evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
+                                  _win_img_hide, win);
+   evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
+                                  _win_img_mouse_down, win);
+   evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
+                                  _win_img_focus_in, win);
+   evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
+                                  _win_img_focus_out, win);
+}
+
 /**
  * Adds a window object. If this is the first window created, pass NULL as
  * @p parent.
@@ -1108,14 +1170,7 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
                                  win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
                                  if (win->ee)
                                    {
-                                      evas_object_image_alpha_set
-                                         (win->img_obj, EINA_FALSE);
-                                      evas_object_image_filled_set
-                                         (win->img_obj, EINA_TRUE);
-                                      evas_object_event_callback_add
-                                         (win->img_obj, EVAS_CALLBACK_DEL,
-                                             _elm_win_obj_callback_img_obj_del,
-                                             win);
+                                      _win_inlined_image_set(win);
                                    }
                                  else
                                    {