summaryrefslogtreecommitdiff
path: root/src/lib/elm_focuswidget.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2016-02-19 22:55:04 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2016-02-19 22:55:04 +0100
commit0ed61a27dc30e887485c33bcfe37efab454de9e2 (patch)
tree2b6b079339fcf367356715b0143391e20e7d82a7 /src/lib/elm_focuswidget.c
parent017e7bd48411f483ba0b03eee6159606d2db2bbf (diff)
lets make button a focusable widgetdevs/bu5hm4n/focus_overhaul
Diffstat (limited to 'src/lib/elm_focuswidget.c')
-rw-r--r--src/lib/elm_focuswidget.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/lib/elm_focuswidget.c b/src/lib/elm_focuswidget.c
new file mode 100644
index 000000000..0cfc8adc4
--- /dev/null
+++ b/src/lib/elm_focuswidget.c
@@ -0,0 +1,73 @@
1#include <Elementary.h>
2#include "elm_priv.h"
3
4#include "elm_focuswidget.eo.h"
5#include "elm_focusable.eo.h"
6#include "elm_focus_manager.eo.h"
7#include "elm_layout.eo.h"
8typedef struct {
9 Eina_Bool focusable;
10 Eina_Bool focus;
11} Elm_Focuswidget_Data;
12
13
14EOLIAN static void
15_elm_focuswidget_elm_focusable_focus_set(Eo *obj, Elm_Focuswidget_Data *pd, Eina_Bool focus)
16{
17 if (!pd->focusable) return;
18
19 pd->focus = focus;
20
21 eo_do(obj, eo_event_callback_call(pd->focus ? ELM_FOCUSABLE_EVENT_FOCUS_ON : ELM_FOCUSABLE_EVENT_FOCUS_OFF, NULL));
22}
23
24
25EOLIAN static Eina_Bool
26_elm_focuswidget_elm_focusable_focus_get(Eo *obj, Elm_Focuswidget_Data *pd)
27{
28 return pd->focus;
29}
30
31
32EOLIAN static void
33_elm_focuswidget_elm_focusable_focusable_set(Eo *obj, Elm_Focuswidget_Data *pd, Eina_Bool focusable)
34{
35 pd->focusable = focusable;
36
37 if (!focusable)
38 eo_do(obj, elm_focusable_focus_set(EINA_FALSE));
39}
40
41
42EOLIAN static Eina_Bool
43_elm_focuswidget_elm_focusable_focusable_get(Eo *obj, Elm_Focuswidget_Data *pd)
44{
45 return pd->focusable;
46}
47
48EOLIAN static Eo*
49_elm_focuswidget_eo_base_finalize(Eo *obj, Elm_Focuswidget_Data *pd)
50{
51 Eo *eo;
52 Eo *nextParent;
53 eo_do_super(obj, ELM_FOCUSWIDGET_CLASS, eo = eo_finalize());
54
55 eo_do(obj, nextParent = eo_parent_get());
56
57 do {
58 if (eo_isa(nextParent, ELM_FOCUS_MANAGER_INTERFACE))
59 {
60 eo_do(nextParent, elm_focus_manager_register_simple(obj));
61 break;
62 }
63 eo_do(nextParent, nextParent = eo_parent_get());
64 } while (nextParent);
65
66 if (!nextParent)
67 printf("Failed to find the highest focus manager\n");
68
69 return eo;
70}
71
72
73#include "elm_focuswidget.eo.c" \ No newline at end of file