summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2017-11-10 15:26:33 +0100
committerMarcel Hollerbach <marcel@osg.samsung.com>2017-11-11 20:21:56 +0100
commit53052abaa69de163066ab506f26fe32ba744abf0 (patch)
treeb67582d2018dc11e4d2f589cfd4dd0ca5863cdae /src
parentc075b7caaac0c6cf8c1043312041afaf5d4a7cb9 (diff)
elm_widget_item: refactor logic from gengrid into seperated class
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Elementary.am2
-rw-r--r--src/lib/elementary/elm_gengrid_item.eo2
-rw-r--r--src/lib/elementary/elm_priv.h1
-rw-r--r--src/lib/elementary/elm_widget_item_static_focus.c39
-rw-r--r--src/lib/elementary/elm_widget_item_static_focus.eo7
5 files changed, 50 insertions, 1 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 1c41f580f7..4c79dc8007 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -148,6 +148,7 @@ elm_legacy_eolian_files = \
148 lib/elementary/elm_menu_item.eo \ 148 lib/elementary/elm_menu_item.eo \
149 lib/elementary/elm_ctxpopup_item.eo \ 149 lib/elementary/elm_ctxpopup_item.eo \
150 lib/elementary/elm_index_item.eo \ 150 lib/elementary/elm_index_item.eo \
151 lib/elementary/elm_widget_item_static_focus.eo \
151 lib/elementary/elm_genlist_item.eo \ 152 lib/elementary/elm_genlist_item.eo \
152 lib/elementary/elm_gengrid_item.eo \ 153 lib/elementary/elm_gengrid_item.eo \
153 lib/elementary/elm_list_item.eo \ 154 lib/elementary/elm_list_item.eo \
@@ -700,6 +701,7 @@ lib_elementary_libelementary_la_SOURCES = \
700 lib/elementary/efl_ui_focus_parent_provider.c \ 701 lib/elementary/efl_ui_focus_parent_provider.c \
701 lib/elementary/efl_ui_focus_parent_provider_standard.c \ 702 lib/elementary/efl_ui_focus_parent_provider_standard.c \
702 lib/elementary/efl_ui_focus_parent_provider_gen.c \ 703 lib/elementary/efl_ui_focus_parent_provider_gen.c \
704 lib/elementary/elm_widget_item_static_focus.c \
703 $(NULL) 705 $(NULL)
704 706
705 707
diff --git a/src/lib/elementary/elm_gengrid_item.eo b/src/lib/elementary/elm_gengrid_item.eo
index 3f0e73663c..8a0cb65220 100644
--- a/src/lib/elementary/elm_gengrid_item.eo
+++ b/src/lib/elementary/elm_gengrid_item.eo
@@ -25,7 +25,7 @@ enum Elm.Gengrid.Item.Field_Type
25} 25}
26 26
27 27
28class Elm.Gengrid.Item(Elm.Widget.Item, Efl.Ui.Focus.Object) 28class Elm.Gengrid.Item(Elm.Widget.Item.Static_Focus, Efl.Ui.Focus.Object)
29{ 29{
30 [[Elementary gengrid item class]] 30 [[Elementary gengrid item class]]
31 legacy_prefix: elm_gengrid_item; 31 legacy_prefix: elm_gengrid_item;
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index c5a631f4d9..802938458b 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -55,6 +55,7 @@
55#include "elm_code_private.h" 55#include "elm_code_private.h"
56#include "efl_ui_focus_parent_provider.eo.h" 56#include "efl_ui_focus_parent_provider.eo.h"
57#include "efl_ui_focus_parent_provider_standard.eo.h" 57#include "efl_ui_focus_parent_provider_standard.eo.h"
58#include "elm_widget_item_static_focus.eo.h"
58 59
59#ifdef HAVE_LANGINFO_H 60#ifdef HAVE_LANGINFO_H
60# include <langinfo.h> 61# include <langinfo.h>
diff --git a/src/lib/elementary/elm_widget_item_static_focus.c b/src/lib/elementary/elm_widget_item_static_focus.c
new file mode 100644
index 0000000000..905bc264ec
--- /dev/null
+++ b/src/lib/elementary/elm_widget_item_static_focus.c
@@ -0,0 +1,39 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define ELM_WIDGET_ITEM_PROTECTED
6
7#include <Elementary.h>
8#include "elm_priv.h"
9#include "efl_ui_focus_composition_adapter.eo.h"
10
11typedef struct {
12 Eo *adapter;
13} Elm_Widget_Item_Static_Focus_Data;
14
15EOLIAN static void
16_elm_widget_item_static_focus_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Widget_Item_Static_Focus_Data *pd EINA_UNUSED)
17{
18 Elm_Widget_Item_Data *wpd = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
19
20 efl_ui_focus_object_prepare_logical(efl_super(obj, ELM_WIDGET_ITEM_STATIC_FOCUS_CLASS));
21
22 if (!efl_ui_focus_manager_request_subchild(wpd->widget, obj))
23 {
24 if (!pd->adapter)
25 {
26 pd->adapter = efl_add(EFL_UI_FOCUS_COMPOSITION_ADAPTER_CLASS, obj, efl_ui_focus_composition_adapter_canvas_object_set(efl_added, wpd->view));
27 efl_wref_add(pd->adapter, &pd->adapter);
28 efl_ui_focus_manager_calc_register(wpd->widget, pd->adapter, obj, NULL);
29 }
30 }
31 else if (pd->adapter)
32 {
33 efl_ui_focus_manager_calc_unregister(wpd->widget, pd->adapter);
34 efl_del(pd->adapter);
35 pd->adapter = NULL;
36 }
37}
38
39#include "elm_widget_item_static_focus.eo.c"
diff --git a/src/lib/elementary/elm_widget_item_static_focus.eo b/src/lib/elementary/elm_widget_item_static_focus.eo
new file mode 100644
index 0000000000..874466c99e
--- /dev/null
+++ b/src/lib/elementary/elm_widget_item_static_focus.eo
@@ -0,0 +1,7 @@
1class Elm.Widget.Item.Static_Focus (Elm.Widget.Item, Efl.Ui.Focus.Object)
2{
3 [[A class that ensures that at least ONE focusable target is behind this widget item. If there is none registered to it after a prepare call it will register the view of the item as item.]]
4 implements {
5 Efl.Ui.Focus.Object.prepare_logical;
6 }
7}