Adding focus cycle hook to pager, bubble and flip.
authorTiago Rezende Campos Falcao <developer@tiagofalcao.com>
Fri, 1 Oct 2010 19:03:02 +0000 (19:03 +0000)
committerTiago Rezende Campos Falcao <developer@tiagofalcao.com>
Fri, 1 Oct 2010 19:03:02 +0000 (19:03 +0000)
SVN revision: 52961

src/bin/test_flip.c
src/bin/test_focus.c
src/bin/test_pager.c
src/lib/elm_bubble.c
src/lib/elm_flip.c
src/lib/elm_frame.c
src/lib/elm_pager.c

index fc437d796170c9905846df1499a506bd5af89f73..2a54fa0d26de1e66371252ac0356337e08c3e488 100644 (file)
@@ -65,6 +65,7 @@ test_flip(void *data, Evas_Object *obj, void *event_info)
    
    win = elm_win_add(NULL, "flip", ELM_WIN_BASIC);
    elm_win_title_set(win, "Flip");
+   elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
    elm_win_autodel_set(win, 1);
 
    bg = elm_bg_add(win);
index cfa0ca547613165b2eeff9c6e8f36c58139ed704..2b6988b670d5fd9855d4b3f390d1029e439cf458 100644 (file)
@@ -277,8 +277,37 @@ test_focus(void *data, Evas_Object *obj, void *event_info)
                   evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                   elm_frame_content_set(fr, tb);
                   my_show(tb);
-                  for (j = 0; j < 3; j++)
-                    for (i = 0; i < 3; i++)
+                  for (j = 0; j < 1; j++)
+                    for (i = 0; i < 2; i++)
+                      {
+                         Evas_Object *bt;
+                         bt = elm_button_add(win);
+                         elm_button_label_set(bt, "Table");
+                         evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
+                                                         EVAS_HINT_FILL);
+                         evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+                         elm_table_pack(tb, bt, i, j, 1, 1);
+                         my_show(bt);
+                      }
+               }
+          }
+
+          {
+             Evas_Object *fr = elm_bubble_add(win);
+             elm_bubble_label_set(fr, "Bubble");
+             evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+             evas_object_size_hint_align_set(fr, EVAS_HINT_FILL,
+                                             EVAS_HINT_FILL);
+             elm_box_pack_end(bx, fr);
+             evas_object_show(fr);
+
+               {
+                  Evas_Object *tb = elm_table_add(win);
+                  evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+                  elm_bubble_content_set(fr, tb);
+                  my_show(tb);
+                  for (j = 0; j < 2; j++)
+                    for (i = 0; i < 1; i++)
                       {
                          Evas_Object *bt;
                          bt = elm_button_add(win);
index 26481e6078b746af83138fbb54e9f632956e2f20..c84781659ddc4cff9466aa3ab471f45d2f0fa77e 100644 (file)
@@ -43,6 +43,7 @@ test_pager(void *data, Evas_Object *obj, void *event_info)
 
    win = elm_win_add(NULL, "pager", ELM_WIN_BASIC);
    elm_win_title_set(win, "Pager");
+   elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
    elm_win_autodel_set(win, 1);
    info.win = win;
 
@@ -190,6 +191,7 @@ test_pager_slide(void *data, Evas_Object *obj, void *event_info)
 
    win = elm_win_add(NULL, "pager", ELM_WIN_BASIC);
    elm_win_title_set(win, "Pager Slide");
+   elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
    elm_win_autodel_set(win, 1);
    info.win = win;
 
index a2584d1b2b518b01bf53258664597cca847d8aa1..3700e5747ab4c9a7ebcfb881191eaf60ff3c4ca8 100644 (file)
@@ -54,6 +54,21 @@ _theme_hook(Evas_Object *obj)
    _sizing_eval(obj);
 }
 
+static Eina_Bool
+_elm_bubble_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool circular)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   Evas_Object *cur;
+
+   if ((!wd) || (!wd->content))
+     return EINA_FALSE;
+
+   cur = wd->content;
+
+   /* Try Focus cycle in subitem */
+   return elm_widget_focus_cycle(cur, dir, circular);
+}
+
 static void
 _sizing_eval(Evas_Object *obj)
 {
@@ -117,6 +132,7 @@ elm_bubble_add(Evas_Object *parent)
    elm_widget_data_set(obj, wd);
    elm_widget_del_hook_set(obj, _del_hook);
    elm_widget_theme_hook_set(obj, _theme_hook);
+   elm_widget_focus_cycle_hook_set(obj, _elm_bubble_focus_cycle_hook);
    elm_widget_can_focus_set(obj, EINA_FALSE);
 
    wd->bbl = edje_object_add(e);
index bc836b100b961ef5b60fcb67a45f9227ae050fb3..07f4f5260af06118b1a1e2da8d15076193a5d845 100644 (file)
@@ -58,6 +58,22 @@ _theme_hook(Evas_Object *obj)
    _sizing_eval(obj);
 }
 
+static Eina_Bool
+_elm_flip_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool circular)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+
+   if (!wd)
+     return EINA_FALSE;
+
+   /* Try Focus cycle in subitem */
+   if (wd->state)
+     return elm_widget_focus_cycle(wd->front.content, dir, circular);
+   else
+     return elm_widget_focus_cycle(wd->back.content, dir, circular);
+
+}
+
 static void
 _sizing_eval(Evas_Object *obj)
 {
@@ -398,6 +414,7 @@ elm_flip_add(Evas_Object *parent)
    elm_widget_data_set(obj, wd);
    elm_widget_del_hook_set(obj, _del_hook);
    elm_widget_theme_hook_set(obj, _theme_hook);
+   elm_widget_focus_cycle_hook_set(obj, _elm_flip_focus_cycle_hook);
    elm_widget_can_focus_set(obj, EINA_FALSE);
 
    wd->clip = evas_object_rectangle_add(e);
index 7d4e8567f40a7860acad884e96217d452496ab17..fdb93740762595701dc4acf404dde616dc504eed 100644 (file)
@@ -58,19 +58,7 @@ _elm_frame_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool
    cur = wd->content;
 
    /* Try Focus cycle in subitem */
-   if (elm_widget_focus_cycle(cur, dir, circular))
-     return EINA_TRUE;
-   /* Ignore focused subitem */
-   if (elm_widget_focus_get(cur) && (!circular))
-     return EINA_FALSE;
-   /* Try give the focus to sub item*/
-   if (elm_widget_can_focus_get(cur))
-     {
-        elm_widget_focus_steal(cur);
-        return EINA_TRUE;
-     }
-
-   return EINA_FALSE;
+   return elm_widget_focus_cycle(cur, dir, circular);
 }
 
 static void
index 30c2573cbd45b0facfab622b043784cd02ed99a9..3a4e1fdbde018ecb64639b321c78e372d72d505d 100644 (file)
@@ -65,6 +65,21 @@ _theme_hook(Evas_Object *obj)
    _sizing_eval(obj);
 }
 
+static Eina_Bool
+_elm_pager_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool circular)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   Evas_Object *cur;
+
+   if ((!wd) || (!wd->top))
+     return EINA_FALSE;
+
+   cur = wd->top->content;
+
+   /* Try Focus cycle in subitem */
+   return elm_widget_focus_cycle(cur, dir, circular);
+}
+
 static void
 _sizing_eval(Evas_Object *obj)
 {
@@ -224,6 +239,7 @@ elm_pager_add(Evas_Object *parent)
    elm_widget_data_set(obj, wd);
    elm_widget_del_hook_set(obj, _del_hook);
    elm_widget_theme_hook_set(obj, _theme_hook);
+   elm_widget_focus_cycle_hook_set(obj, _elm_pager_focus_cycle_hook);
    elm_widget_can_focus_set(obj, EINA_FALSE);
 
    wd->clip = evas_object_rectangle_add(e);