efl_ui_tab_bar: implement select key bindings. 44/187244/1
authorBowon Ryu <bowon.ryu@samsung.com>
Tue, 21 Aug 2018 06:31:49 +0000 (15:31 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Tue, 21 Aug 2018 07:24:26 +0000 (16:24 +0900)
Summary:
by key bindings..
now we can select TAB with the Return/Space key.

Test Plan: elementary_test -to efl.ui.tab_pager

Reviewers: Jaehyun_Cho, Hermet

Reviewed By: Jaehyun_Cho

Subscribers: YOhoho, cedric, #reviewers, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6779

Change-Id: I2f967ebf3307b8a935ce1ce3c2112d1d659953ba

data/elementary/config/default/base.src.in
data/elementary/config/mobile/base.src.in
data/elementary/config/standard/base.src.in
src/lib/elementary/efl_ui_tab_bar.c
src/lib/elementary/efl_ui_tab_bar.eo
src/lib/elementary/elm_priv.h

index 4b35e3a..883cc90 100644 (file)
@@ -1,5 +1,5 @@
 group "Elm_Config" struct {
-  value "config_version" int: 131089;
+  value "config_version" int: 131090;
   value "entry_select_allow" uchar: 1;
   value "engine" string: "";
   value "vsync" uchar: 0;
@@ -2624,6 +2624,29 @@ group "Elm_Config" struct {
         }
      }
      group "Elm_Config_Bindings_Widget" struct {
+        value "name" string: "Efl.Ui.Tab_Bar";
+        group "key_bindings" list {
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "Return";
+              value "action" string: "select";
+              value "params" string: "";
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "KP_Enter";
+              value "action" string: "select";
+              value "params" string: "";
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "space";
+              value "action" string: "select";
+              value "params" string: "";
+           }
+        }
+     }
+     group "Elm_Config_Bindings_Widget" struct {
         value "name" string: "Efl.Ui.Video";
         group "key_bindings" list {
            group "Elm_Config_Binding_Key" struct {
index abccea5..9ea71db 100644 (file)
@@ -1,5 +1,5 @@
 group "Elm_Config" struct {
-  value "config_version" int: 131089;
+  value "config_version" int: 131090;
   value "entry_select_allow" uchar: 1;
   value "engine" string: "";
   value "vsync" uchar: 0;
@@ -2628,6 +2628,29 @@ group "Elm_Config" struct {
         }
      }
      group "Elm_Config_Bindings_Widget" struct {
+        value "name" string: "Efl.Ui.Tab_Bar";
+        group "key_bindings" list {
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "Return";
+              value "action" string: "select";
+              value "params" string: "";
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "KP_Enter";
+              value "action" string: "select";
+              value "params" string: "";
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "space";
+              value "action" string: "select";
+              value "params" string: "";
+           }
+        }
+     }
+     group "Elm_Config_Bindings_Widget" struct {
         value "name" string: "Efl.Ui.Video";
         group "key_bindings" list {
            group "Elm_Config_Binding_Key" struct {
index 8572e2b..f5ae6d8 100644 (file)
@@ -1,5 +1,5 @@
 group "Elm_Config" struct {
-  value "config_version" int: 131089;
+  value "config_version" int: 131090;
   value "entry_select_allow" uchar: 1;
   value "engine" string: "";
   value "vsync" uchar: 0;
@@ -2625,6 +2625,29 @@ group "Elm_Config" struct {
         }
      }
      group "Elm_Config_Bindings_Widget" struct {
+        value "name" string: "Efl.Ui.Tab_Bar";
+        group "key_bindings" list {
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "Return";
+              value "action" string: "select";
+              value "params" string: "";
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "KP_Enter";
+              value "action" string: "select";
+              value "params" string: "";
+           }
+           group "Elm_Config_Binding_Key" struct {
+              value "context" int: 0;
+              value "key" string: "space";
+              value "action" string: "select";
+              value "params" string: "";
+           }
+        }
+     }
+     group "Elm_Config_Bindings_Widget" struct {
         value "name" string: "Efl.Ui.Video";
         group "key_bindings" list {
            group "Elm_Config_Binding_Key" struct {
index f377ff2..eb328e3 100644 (file)
 #include "els_box.h"
 
 #define MY_CLASS EFL_UI_TAB_BAR_CLASS
+#define MY_CLASS_NAME "Efl.Ui.Tab_Bar"
 
 static const char PART_NAME_TAB[] = "tab";
 
 static void _tab_select(Efl_Ui_Tab_Bar_Data *sd, Tab_Info *ti);
 
+static Eina_Bool _key_action_select(Evas_Object *obj, const char *params);
+
+static const Elm_Action key_actions[] = {
+   {"select", _key_action_select},
+   {NULL, NULL}
+};
+
+static Eina_Bool
+_key_action_select(Evas_Object *obj, const char *params EINA_UNUSED)
+{
+   EFL_UI_TAB_BAR_DATA_GET(obj, sd);
+
+   if (!sd->tab_infos) return EINA_FALSE;
+
+   Tab_Info *ti;
+   Eina_List *l, *l_next;
+   EINA_LIST_FOREACH_SAFE(sd->tab_infos, l, l_next, ti)
+     {
+        if (efl_ui_focus_object_focus_get(ti->tab))
+          {
+             _tab_select(sd, ti);
+             return EINA_TRUE;
+          }
+     }
+
+   return EINA_FALSE;
+}
+
 EOLIAN static void
 _efl_ui_tab_bar_current_tab_set(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *sd, int index)
 {
@@ -364,4 +393,8 @@ _efl_ui_tab_bar_efl_object_constructor(Eo *obj, Efl_Ui_Tab_Bar_Data *sd)
    return obj;
 }
 
+/* Standard widget overrides */
+
+ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_tab_bar, Efl_Ui_Tab_Bar_Data)
+
 #include "efl_ui_tab_bar.eo.c"
index ea07a4d..0f1c731 100644 (file)
@@ -38,5 +38,6 @@ class Efl.Ui.Tab_Bar (Efl.Ui.Layout.Object, Efl.Ui.Clickable)
    implements {
       Efl.Object.constructor;
       Efl.Object.destructor;
+      Efl.Ui.Widget.widget_event;
    }
 }
\ No newline at end of file
index a5947b0..a4aef3c 100644 (file)
@@ -162,7 +162,7 @@ struct _Elm_Theme
  * the users config doesn't need to be wiped - simply new values need
  * to be put in
  */
-# define ELM_CONFIG_FILE_GENERATION 0x0011
+# define ELM_CONFIG_FILE_GENERATION 0x0012
 # define ELM_CONFIG_VERSION_EPOCH_OFFSET 16
 # define ELM_CONFIG_VERSION         ((ELM_CONFIG_EPOCH << ELM_CONFIG_VERSION_EPOCH_OFFSET) | \
                                      ELM_CONFIG_FILE_GENERATION)