dialog now uses internal widgets for buttons.
SVN revision: 17464
image: "e17_titlebar_glint1.png" COMP;
image: "e17_titlebar_glint2.png" COMP;
image: "e17_titlebar_glint3.png" COMP;
+ image: "focus.png" COMP;
}
group {
mouse_events: 1;
description {
state: "default" 0.0;
+ min: 64 16;
image {
normal: "e17_button.png";
border: 8 8 8 8;
color: 0 0 0 0;
rel1 {
relative: 0.0 0.0;
- offset: 0 11;
+ offset: 7 11;
to: "button_image";
}
rel2 {
relative: 0.0 1.0;
- offset: 0 -12;
+ offset: 6 -12;
to: "button_image";
}
}
color: 255 255 255 255;
}
}
+ part {
+ name: "focus";
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ color: 255 255 255 0;
+ image {
+ normal: "focus.png";
+ border: 7 7 7 7;
+ middle: 0;
+ }
+ fill {
+ smooth: 0;
+ }
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ color: 255 255 255 255;
+ }
+ }
}
programs {
program {
target: "glint2";
target: "glint3";
}
+ program {
+ name: "focus_in";
+ signal: "focus_in";
+ source: "";
+ action: STATE_SET "focused" 0.0;
+ transition: DECELERATE 0.2;
+ target: "focus";
+ }
+ program {
+ name: "focus_out";
+ signal: "focus_out";
+ source: "";
+ action: STATE_SET "default" 0.0;
+ transition: ACCELERATE 0.5;
+ target: "focus";
+ }
}
}
images {
image: "e17_menu_check1.png" COMP;
image: "e17_menu_check2.png" COMP;
+ image: "focus.png" COMP;
}
group {
name: "widgets/check";
color: 0 0 0 0;
}
}
+ part {
+ name: "focus";
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ color: 255 255 255 0;
+ image {
+ normal: "focus.png";
+ border: 7 7 7 7;
+ middle: 0;
+ }
+ fill {
+ smooth: 0;
+ }
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ color: 255 255 255 255;
+ }
+ }
}
programs {
program {
}
}
}
+ program {
+ name: "focus_in";
+ signal: "focus_in";
+ source: "";
+ action: STATE_SET "focused" 0.0;
+ transition: DECELERATE 0.2;
+ target: "focus";
+ }
+ program {
+ name: "focus_out";
+ signal: "focus_out";
+ source: "";
+ action: STATE_SET "default" 0.0;
+ transition: ACCELERATE 0.5;
+ target: "focus";
+ }
}
}
-#define FOCUS_COLOR 255 255 255 200
-
-#define FOCUS_RECT(x1, y1, x2, y2, offx1, offy1, offx2, offy2) \
-part { \
- name: "focus_rect_top"; \
- mouse_events: 0; \
- description { \
- state: "default" 0.0; \
- visible: 0; \
- color: FOCUS_COLOR; \
- rel1 { \
- relative: x1 y1; \
- offset: offx1 offy1; \
- } \
- rel2 { \
- relative: x2 y1; \
- offset: offx2 offy1; \
- } \
- image { \
- normal: "focus.png"; \
- } \
- fill { \
- smooth: 0; \
- size { \
- relative: 0 0; \
- offset: 32 32; \
- } \
- } \
- } \
- description { \
- state: "focused" 0.0; \
- inherit: "default" 0.0; \
- visible: 1; \
- } \
-} \
-part { \
- name: "focus_rect_bottom"; \
- mouse_events: 0; \
- description { \
- state: "default" 0.0; \
- visible: 0; \
- color: FOCUS_COLOR; \
- rel1 { \
- relative: x1 y2; \
- offset: offx1 offy2; \
- } \
- rel2 { \
- relative: x2 y2; \
- offset: offx2 offy2; \
- } \
- image { \
- normal: "focus.png"; \
- } \
- fill { \
- smooth: 0; \
- size { \
- relative: 0 0; \
- offset: 32 32; \
- } \
- } \
- } \
- description { \
- state: "focused" 0.0; \
- inherit: "default" 0.0; \
- visible: 1; \
- } \
-} \
-part { \
- name: "focus_rect_left"; \
- mouse_events: 0; \
- description { \
- state: "default" 0.0; \
- visible: 0; \
- color: FOCUS_COLOR; \
- rel1 { \
- relative: x1 y1; \
- offset: offx1 (offy1 + 1); \
- } \
- rel2 { \
- relative: x1 y2; \
- offset: offx1 (offy2 - 1); \
- } \
- image { \
- normal: "focus.png"; \
- } \
- fill { \
- smooth: 0; \
- size { \
- relative: 0 0; \
- offset: 32 32; \
- } \
- } \
- } \
- description { \
- state: "focused" 0.0; \
- inherit: "default" 0.0; \
- visible: 1; \
- } \
-} \
-part { \
- name: "focus_rect_right"; \
- mouse_events: 0; \
- description { \
- state: "default" 0.0; \
- visible: 0; \
- color: FOCUS_COLOR; \
- rel1 { \
- relative: x2 y1; \
- offset: offx2 (offy1 + 1); \
- } \
- rel2 { \
- relative: x2 y2; \
- offset: offx2 (offy2 - 1); \
- } \
- image { \
- normal: "focus.png"; \
- } \
- fill { \
- smooth: 0; \
- size { \
- relative: 0 0; \
- offset: 32 32; \
- } \
- } \
- } \
- description { \
- state: "focused" 0.0; \
- inherit: "default" 0.0; \
- visible: 1; \
- } \
-}
-
-#define FOCUS_ACTION \
-action: STATE_SET "focused" 0.0; \
-target: "focus_rect_top"; \
-target: "focus_rect_bottom"; \
-target: "focus_rect_left"; \
-target: "focus_rect_right";
-
-#define UNFOCUS_ACTION \
-action: STATE_SET "default" 0.0; \
-target: "focus_rect_top"; \
-target: "focus_rect_bottom"; \
-target: "focus_rect_left"; \
-target: "focus_rect_right";
-
images {
image: "e17_menu_bg_border.png" COMP;
-// image: "e17_menu_bg.png" COMP;
-// image: "e17_winlist_top.png" COMP;
image: "e17_winlist_bottom.png" COMP;
- image: "e17_button2.png" COMP;
- image: "e17_button.png" COMP;
image: "e17_dialog_watermark.png" COMP;
- image: "focus.png" COMP;
}
styles
rel1 {
relative: 0.0 0.0;
offset: 1 1;
-// to_y: "base2";
}
rel2 {
relative: 1.0 1.0;
}
}
}
- /*
- part {
- name: "base2";
- mouse_events: 0;
- description {
- state: "default" 0.0;
- max: 99999 48;
- align: 0.5 0.0;
- rel1 {
- relative: 0.0 0.0;
- offset: 1 1;
- }
- rel2 {
- relative: 1.0 1.0;
- offset: -2 -2;
- }
- image {
- normal: "e17_menu_bg.png";
- }
- fill {
- smooth: 0;
- }
- }
- }
- */
part {
name: "base3";
mouse_events: 0;
}
}
}
-/*
- part {
- name: "top";
- mouse_events: 0;
- description {
- state: "default" 0.0;
- rel1 {
- relative: 0.0 0.0;
- offset: 1 1;
- }
- rel2 {
- relative: 1.0 0.0;
- offset: -2 16;
- to_y: "content_swallow";
- }
- image {
- normal: "e17_winlist_top.png";
- border: 0 0 0 19;
- }
- fill {
- smooth: 0;
- }
- }
- }
- */
part {
name: "bottom";
mouse_events: 0;
}
group {
- name: "widgets/dialog/button";
- parts {
- part {
- name: "button_image";
- type: IMAGE;
- mouse_events: 1;
- description {
- state: "default" 0.0;
- min: 64 32;
- image {
- normal: "e17_button.png";
- border: 8 8 8 8;
- }
- }
- description {
- state: "clicked" 0.0;
- min: 64 32;
- image {
- normal: "e17_button2.png";
- border: 8 8 8 8;
- }
- }
- }
- part {
- name: "icon_swallow";
- type: SWALLOW;
- description {
- state: "default" 0.0;
- align: 0.0 0.5;
- color: 0 0 0 0;
- rel1 {
- relative: 0.0 0.0;
- offset: 0 0;
- to: "button_image";
- }
- rel2 {
- relative: 0.0 1.0;
- offset: 0 -7;
- to: "button_image";
- }
- }
- description {
- state: "visible" 0.0;
- inherit: "default" 0.0;
- aspect: 1.0 1.0;
- aspect_preference: VERTICAL;
- align: 0.0 0.5;
- color: 0 0 0 0;
- rel1 {
- relative: 0.0 0.0;
- offset: 6 6;
- to: "button_image";
- }
- rel2 {
- relative: 0.0 1.0;
- offset: 5 -7;
- to: "button_image";
- }
- }
- }
- part {
- name: "button_text";
- type: TEXT;
- effect: SHADOW;
- mouse_events: 0;
- description {
- state: "default" 0.0;
- rel1 {
- relative: 1.0 0.0;
- offset: 6 6;
- to_x: "icon_swallow";
- to_y: "button_image";
- }
- rel2 {
- relative: 1.0 1.0;
- offset: -7 -7;
- to: "button_image";
- }
- color: 0 0 0 255;
- color3: 255 255 255 128;
- text {
- text: "OK";
- font: "Edje-Vera";
- size: 10;
- min: 1 1;
- align: 0.5 0.5;
- }
- }
- }
- part {
- name: "glint_clip";
- type: RECT;
- mouse_events: 0;
- description {
- state: "default" 0.0;
- color: 255 255 255 255;
- rel1 {
- relative: 0.0 0.0;
- offset: 3 3;
- }
- rel2 {
- relative: 1.0 1.0;
- offset: -4 -4;
- }
- }
- }
- part {
- name: "glint1";
- mouse_events: 0;
- description {
- state: "default" 0.0;
- visible: 0;
- color: 255 255 255 0;
- align: 0.0 0.0;
- max: 34 13;
- rel1 {
- relative: 0.0 0.0;
- offset: 2 2;
- }
- rel2 {
- relative: 1.0 1.0;
- offset: -3 -3;
- }
- image {
- normal: "e17_titlebar_glint1.png";
- border: 5 0 5 0;
- }
- fill {
- smooth: 0;
- }
- }
- description {
- state: "active" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- color: 255 255 255 255;
- }
- }
- part {
- name: "glint2";
- mouse_events: 0;
- clip_to: "glint_clip";
- description {
- state: "default" 0.0;
- visible: 0;
- color: 255 255 255 0;
- align: 1.0 0.5;
- max: 0 0;
- rel1 {
- relative: 0.0 0.0;
- offset: 3 3;
- }
- rel2 {
- relative: 0.0 1.0;
- offset: 3 -4;
- }
- image {
- normal: "e17_titlebar_glint2.png";
- border: 0 0 5 5;
- }
- fill {
- smooth: 0;
- }
- }
- description {
- state: "active" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- color: 255 255 255 255;
- max: 169 9999;
- min: 169 8;
- align: 0.5 0.5;
- }
- description {
- state: "active2" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- color: 255 255 255 128;
- max: 169 9999;
- min: 169 8;
- align: 0.5 0.5;
- rel1 {
- relative: 1.0 0.0;
- offset: -4 3;
- }
- rel2 {
- relative: 1.0 1.0;
- offset: -4 -4;
- }
- }
- description {
- state: "active3" 0.0;
- inherit: "default" 0.0;
- visible: 0;
- color: 255 255 255 0;
- max: 169 9999;
- min: 169 8;
- align: 0.0 0.5;
- rel1 {
- relative: 1.0 0.0;
- offset: -4 3;
- }
- rel2 {
- relative: 1.0 1.0;
- offset: -4 -4;
- }
- }
- }
- part {
- name: "glint3";
- mouse_events: 0;
- description {
- state: "default" 0.0;
- visible: 0;
- color: 255 255 255 0;
- align: 1.0 1.0;
- max: 34 13;
- rel1 {
- relative: 0.0 0.0;
- offset: 2 2;
- }
- rel2 {
- relative: 1.0 1.0;
- offset: -3 -3;
- }
- image {
- normal: "e17_titlebar_glint3.png";
- border: 0 5 0 5;
- }
- fill {
- smooth: 0;
- }
- }
- description {
- state: "active" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- color: 255 255 255 255;
- }
- }
-
- FOCUS_RECT(0.0, 0.0, 1.0, 1.0, 7, 7, -8, -8)
- }
- programs {
- program {
- name: "button_click";
- signal: "mouse,down,1";
- source: "button_image";
- action: STATE_SET "clicked" 0.0;
- target: "button_image";
- }
- program {
- name: "button_unclick";
- signal: "mouse,up,1";
- source: "button_image";
- action: STATE_SET "default" 0.0;
- target: "button_image";
- }
- program {
- name: "button_unclick2";
- signal: "mouse,clicked,1";
- source: "button_image";
- action: SIGNAL_EMIT "click" "";
- }
- program {
- name: "icon_visible";
- signal: "icon_visible";
- source: "";
- action: STATE_SET "visible" 0.0;
- target: "icon_swallow";
- }
- program {
- name: "button_in";
- signal: "mouse,in";
- source: "button_image";
- action: SIGNAL_EMIT "enter" "";
- }
- program {
- name: "button_enter";
- signal: "enter";
- source: "";
- script {
- run_program(PROGRAM:"go_active");
- }
- }
- program {
- name: "go_active";
- action: STATE_SET "active" 0.0;
- target: "glint1";
- target: "glint2";
- transition: LINEAR 0.05;
- after: "go_active2";
- after: "go_active2b";
- }
- program {
- name: "go_active2";
- action: STATE_SET "active2" 0.0;
- target: "glint2";
- transition: LINEAR 0.2;
- after: "go_active3";
- after: "go_active3b";
- }
- program {
- name: "go_active2b";
- action: STATE_SET "active" 0.0;
- target: "glint3";
- transition: LINEAR 0.2;
- }
- program {
- name: "go_active3";
- action: STATE_SET "active3" 0.0;
- target: "glint2";
- transition: LINEAR 0.05;
- }
- program {
- name: "go_active3b";
- action: STATE_SET "default" 0.0;
- target: "glint3";
- transition: LINEAR 0.1;
- after: "go_active4";
- }
- program {
- name: "go_active4";
- action: STATE_SET "default" 0.0;
- target: "glint1";
- target: "glint2";
- target: "glint3";
- }
- program {
- name: "button_focus";
- signal: "focus";
- source: "";
- FOCUS_ACTION
- }
- program {
- name: "button_unfocus";
- signal: "unfocus";
- source: "";
- UNFOCUS_ACTION
- }
- }
-}
-
-group {
name: "widgets/dialog/text";
parts {
part {
images {
image: "e17_menu_radio1.png" COMP;
image: "e17_menu_radio2.png" COMP;
+ image: "focus.png" COMP;
}
group {
name: "widgets/radio";
color: 0 0 0 0;
}
}
+ part {
+ name: "focus";
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ visible: 0;
+ color: 255 255 255 0;
+ image {
+ normal: "focus.png";
+ border: 7 7 7 7;
+ middle: 0;
+ }
+ fill {
+ smooth: 0;
+ }
+ }
+ description {
+ state: "focused" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ color: 255 255 255 255;
+ }
+ }
}
programs {
program {
name: "click2";
action: SIGNAL_EMIT "toggled" "on";
}
+ program {
+ name: "focus_in";
+ signal: "focus_in";
+ source: "";
+ action: STATE_SET "focused" 0.0;
+ transition: DECELERATE 0.2;
+ target: "focus";
+ }
+ program {
+ name: "focus_out";
+ signal: "focus_out";
+ source: "";
+ action: STATE_SET "default" 0.0;
+ transition: ACCELERATE 0.5;
+ target: "focus";
+ }
}
}
*/
#include "e.h"
-struct _E_Dialog_Button
-{
- E_Dialog *dialog;
- Evas_Object *obj, *obj_icon;
- char *label;
- char *icon;
- void (*func) (void *data, E_Dialog *dia);
- void *data;
-};
-
/* local subsystem functions */
static void _e_dialog_free(E_Dialog *dia);
-static void _e_dialog_cb_button_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
-static void _e_dialog_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event);
+static void _e_dialog_del_func_cb(void *data, E_Dialog *dia);
static void _e_dialog_cb_delete(E_Win *win);
static void _e_dialog_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event);
-
+static void _e_dialog_cb_wid_on_focus(void *data, Evas_Object *obj);
/* local subsystem globals */
"widgets/dialog/main");
evas_object_move(o, 0, 0);
evas_object_show(o);
-
- o = e_box_add(e_win_evas_get(dia->win));
+
+ o = e_widget_list_add(e_win_evas_get(dia->win), 1, 1);
+ e_widget_on_focus_hook_set(o, _e_dialog_cb_wid_on_focus, dia);
dia->box_object = o;
- e_box_orientation_set(o, 1);
- e_box_homogenous_set(o, 1);
- e_box_align_set(o, 0.5, 0.5);
edje_object_part_swallow(dia->bg_object, "buttons_swallow", o);
- evas_object_show(o);
o = evas_object_rectangle_add(e_win_evas_get(dia->win));
dia->event_object = o;
evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, _e_dialog_cb_key_down, dia);
- dia->focused = NULL;
-
return dia;
}
void
e_dialog_button_add(E_Dialog *dia, char *label, char *icon, void (*func) (void *data, E_Dialog *dia), void *data)
{
- E_Dialog_Button *db;
- Evas_Coord mw, mh;
-
- db = E_NEW(E_Dialog_Button, 1);
- db->dialog = dia;
- if (label) db->label = strdup(label);
- if (icon) db->icon = strdup(icon);
- db->func = func;
- db->data = data;
- db->obj = edje_object_add(e_win_evas_get(dia->win));
- e_theme_edje_object_set(db->obj, "base/theme/dialog",
- "widgets/dialog/button");
- edje_object_signal_callback_add(db->obj, "click", "",
- _e_dialog_cb_button_clicked, db);
- edje_object_part_text_set(db->obj, "button_text", db->label);
-
- evas_object_event_callback_add(db->obj, EVAS_CALLBACK_MOUSE_DOWN, _e_dialog_button_cb_mouse_down, db);
-
- if (icon)
- {
- db->obj_icon = edje_object_add(e_win_evas_get(dia->win));
- e_util_edje_icon_set(db->obj_icon, icon);
- edje_object_part_swallow(db->obj, "icon_swallow", db->obj_icon);
- edje_object_signal_emit(db->obj, "icon_visible", "");
- edje_object_message_signal_process(db->obj);
- evas_object_show(db->obj_icon);
- }
- edje_object_size_min_calc(db->obj, &mw, &mh);
- e_box_pack_end(dia->box_object, db->obj);
- e_box_pack_options_set(db->obj,
- 1, 1, /* fill */
- 0, 1, /* expand */
- 0.5, 0.5, /* align */
- mw, mh, /* min */
- 9999, mh /* max */
- );
- evas_object_show(db->obj);
-
- dia->buttons = evas_list_append(dia->buttons, db);
-}
-
-int
-e_dialog_button_focus_num(E_Dialog *dia, int button)
-{
- E_Dialog_Button *db = NULL;
-
- if (button < 0)
- return 0;
-
- db = evas_list_nth(dia->buttons, button);
-
- if (!db)
- return 0;
-
- if (dia->focused)
- {
- E_Dialog_Button *focused;
-
- focused = dia->focused->data;
- if (focused)
- edje_object_signal_emit(focused->obj, "unfocus", "");
- }
-
- dia->focused = evas_list_nth_list(dia->buttons, button);
- edje_object_signal_emit(db->obj, "focus", "");
+ Evas_Object *o;
- return 1;
+ if (!func) func = _e_dialog_del_func_cb;
+ o = e_widget_button_add(e_win_evas_get(dia->win), label, icon, func, data, dia);
+ e_widget_list_object_append(dia->box_object, o, 1, 1, 0.5);
+ dia->buttons = evas_list_append(dia->buttons, o);
}
int
-e_dialog_button_focus_button(E_Dialog *dia, E_Dialog_Button *button)
+e_dialog_button_focus_num(E_Dialog *dia, int button)
{
- E_Dialog_Button *db = NULL;
-
- if (!button)
- return 0;
-
- db = evas_list_find(dia->buttons, button);
-
- if (!db)
- return 0;
+ Evas_Object *o;
- if (dia->focused)
- {
- E_Dialog_Button *focused;
-
- focused = dia->focused->data;
- if (focused)
- edje_object_signal_emit(focused->obj, "unfocus", "");
- }
-
- dia->focused = evas_list_find_list(dia->buttons, button);
- edje_object_signal_emit(db->obj, "focus", "");
-
- return 1;
+ o = evas_list_nth(dia->buttons, button);
+ if (o) e_widget_focus_steal(o);
}
void
void
e_dialog_content_set(E_Dialog *dia, Evas_Object *obj, Evas_Coord minw, Evas_Coord minh)
{
+ dia->content_object = obj;
+ e_widget_on_focus_hook_set(obj, _e_dialog_cb_wid_on_focus, dia);
edje_extern_object_min_size_set(obj, minw, minh);
edje_object_part_swallow(dia->bg_object, "content_swallow", obj);
evas_object_show(obj);
}
o = dia->box_object;
- e_box_min_size_get(o, &mw, &mh);
+ e_widget_min_size_get(o, &mw, &mh);
edje_extern_object_min_size_set(o, mw, mh);
edje_object_part_swallow(dia->bg_object, "buttons_swallow", o);
e_win_size_min_set(dia->win, mw, mh);
e_win_size_max_set(dia->win, mw, mh);
e_win_show(dia->win);
+
+ if (!e_widget_focus_get(dia->box_object))
+ e_widget_focus_set(dia->box_object, 1);
}
/* local subsystem functions */
static void
_e_dialog_free(E_Dialog *dia)
{
- while (dia->buttons)
- {
- E_Dialog_Button *db;
-
- db = dia->buttons->data;
- dia->buttons = evas_list_remove_list(dia->buttons, dia->buttons);
- E_FREE(db->label);
- E_FREE(db->icon);
- evas_object_del(db->obj);
- if (db->obj_icon) evas_object_del(db->obj_icon);
- free(db);
- }
+ if (dia->buttons) evas_list_free(dia->buttons);
if (dia->text_object) evas_object_del(dia->text_object);
if (dia->icon_object) evas_object_del(dia->icon_object);
if (dia->box_object) evas_object_del(dia->box_object);
if (dia->bg_object) evas_object_del(dia->bg_object);
+ if (dia->content_object) evas_object_del(dia->content_object);
if (dia->event_object) evas_object_del(dia->event_object);
e_object_del(E_OBJECT(dia->win));
free(dia);
}
static void
-_e_dialog_cb_button_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
+_e_dialog_del_func_cb(void *data, E_Dialog *dia)
{
- E_Dialog_Button *db;
-
- db = data;
- if (db->func)
- {
- edje_object_signal_emit(db->obj, "focus", "");
- db->func(db->data, db->dialog);
- }
- else
- e_object_del(E_OBJECT(db->dialog));
-}
-
-static void
-_e_dialog_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event)
-{
- E_Dialog *dia;
- E_Dialog_Button *db;
-
- db = data;
- dia = db->dialog;
-
- e_dialog_button_focus_button(dia, db);
+ e_object_del(E_OBJECT(dia));
}
static void
ev = event;
dia = data;
-
if (!strcmp(ev->keyname, "Tab"))
{
- if ((dia->focused) && (dia->buttons))
+ if (evas_key_modifier_is_set(evas_key_modifier_get(e_win_evas_get(dia->win)), "Shift"))
{
- E_Dialog_Button *db, *ndb;
-
- db = dia->focused->data;
- if (evas_key_modifier_is_set(evas_key_modifier_get(e_win_evas_get(dia->win)), "Shift"))
+ if (e_widget_focus_get(dia->box_object))
{
- if (dia->focused->prev) dia->focused = dia->focused->prev;
- else dia->focused = evas_list_last(dia->buttons);
+ if (!e_widget_focus_jump(dia->box_object, 0))
+ {
+ if (dia->text_object)
+ e_widget_focus_set(dia->box_object, 0);
+ else
+ {
+ e_widget_focus_set(dia->content_object, 0);
+ if (!e_widget_focus_get(dia->content_object))
+ e_widget_focus_set(dia->box_object, 0);
+ }
+ }
}
else
{
- if (dia->focused->next) dia->focused = dia->focused->next;
- else dia->focused = dia->buttons;
- }
- ndb = dia->focused->data;
- if (ndb != db)
- {
- edje_object_signal_emit(db->obj, "unfocus", "");
- edje_object_signal_emit(ndb->obj, "focus", "");
- edje_object_signal_emit(ndb->obj, "enter", "");
+ if (!e_widget_focus_jump(dia->content_object, 0))
+ e_widget_focus_set(dia->box_object, 0);
}
-
}
- else
+ else
{
- E_Dialog_Button *db;
-
- dia->focused = dia->buttons;
-
- db = dia->focused->data;
- edje_object_signal_emit(db->obj, "focus", "");
- edje_object_signal_emit(db->obj, "enter", "");
+ if (e_widget_focus_get(dia->box_object))
+ {
+ if (!e_widget_focus_jump(dia->box_object, 1))
+ {
+ if (dia->text_object)
+ e_widget_focus_set(dia->box_object, 1);
+ else
+ {
+ e_widget_focus_set(dia->content_object, 1);
+ if (!e_widget_focus_get(dia->content_object))
+ e_widget_focus_set(dia->box_object, 1);
+ }
+ }
+ }
+ else
+ {
+ if (!e_widget_focus_jump(dia->content_object, 1))
+ e_widget_focus_set(dia->box_object, 1);
+ }
}
}
else if (((!strcmp(ev->keyname, "Return")) ||
(!strcmp(ev->keyname, "KP_Enter")) ||
- (!strcmp(ev->keyname, "space"))) && dia->focused)
+ (!strcmp(ev->keyname, "space"))))
{
- E_Dialog_Button *db;
-
- db = evas_list_data(dia->focused);
- edje_object_signal_emit(db->obj, "click", "");
+ Evas_Object *o = NULL;
+
+ if ((dia->content_object) && (e_widget_focus_get(dia->content_object)))
+ o = e_widget_focused_object_get(dia->content_object);
+ else
+ o = e_widget_focused_object_get(dia->box_object);
+ if (o) e_widget_activate(o);
}
}
dia = win->data;
e_object_del(E_OBJECT(dia));
}
+
+static void
+_e_dialog_cb_wid_on_focus(void *data, Evas_Object *obj)
+{
+ E_Dialog *dia;
+
+ dia = data;
+ if (obj == dia->content_object)
+ e_widget_focused_object_clear(dia->box_object);
+ else if (dia->content_object)
+ e_widget_focused_object_clear(dia->content_object);
+}
+
Evas_Object *bg_object;
Evas_Object *box_object;
Evas_Object *text_object;
+ Evas_Object *content_object;
Evas_Object *icon_object;
Evas_Object *event_object;
Evas_List *buttons;
- Evas_List *focused;
void *data;
};
EAPI E_Dialog *e_dialog_new (E_Container *con);
EAPI void e_dialog_button_add (E_Dialog *dia, char *label, char *icon, void (*func) (void *data, E_Dialog *dia), void *data);
EAPI int e_dialog_button_focus_num (E_Dialog *dia, int button);
-EAPI int e_dialog_button_focus_button (E_Dialog *dia, E_Dialog_Button *button);
EAPI void e_dialog_title_set (E_Dialog *dia, char *title);
EAPI void e_dialog_text_set (E_Dialog *dia, char *text);
EAPI void e_dialog_icon_set (E_Dialog *dia, char *icon, Evas_Coord size);
#include "e.h"
#define SMART_NAME "e_pan"
-#define API_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd)
+#define API_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
#define INTERNAL_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
typedef struct _E_Smart_Data E_Smart_Data;
}
#elif 0
static int my_val = 0;
+static int my_val2 = 0;
+static int my_val3 = 0;
+static int my_val4 = 0;
+static int my_val5 = 0;
+static int my_val6 = 0;
static int my_rval = 1;
+static int my_rval2 = 1;
static void
_e_test_internal(E_Container *con)
e = e_win_evas_get(dia->win);
- ol = e_widget_list_add(e, 0);
+ ol = e_widget_list_add(e, 0, 0);
- hb = e_widget_list_add(e, 1);
+ hb = e_widget_list_add(e, 1, 1);
o = e_widget_framelist_add(e, "My Checklist", 0);
e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox 1", &my_val));
- e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox 2", &my_val));
- e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox 3", &my_val));
- e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox and some long text", &my_val));
- e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox 7", &my_val));
- e_widget_framelist_object_append(o, e_widget_check_add(e, "Koneko", &my_val));
+ e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox 2", &my_val2));
+ e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox 3", &my_val3));
+ e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox and some long text", &my_val4));
+ e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox 7", &my_val5));
+ e_widget_framelist_object_append(o, e_widget_check_add(e, "Koneko", &my_val6));
rg = e_widget_radio_group_new(&my_rval);
e_widget_framelist_object_append(o, e_widget_radio_add(e, "Rad 0", 0, rg));
o = e_widget_framelist_add(e, "My Checklist on the right", 0);
- rg = e_widget_radio_group_new(&my_rval);
+ rg = e_widget_radio_group_new(&my_rval2);
e_widget_framelist_object_append(o, e_widget_radio_add(e, "Rad 0", 0, rg));
e_widget_framelist_object_append(o, e_widget_radio_add(e, "Rad 1", 1, rg));
e_widget_framelist_object_append(o, e_widget_radio_add(e, "Rad 2", 2, rg));
#include "e.h"
#define SMART_NAME "e_widget"
-#define API_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd)
+#define API_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
#define INTERNAL_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
typedef struct _E_Smart_Data E_Smart_Data;
struct _E_Smart_Data
{
+ Evas_Object *parent_obj;
Evas_Coord x, y, w, h;
- Evas_Coord minw, minh, maxw, maxh;
+ Evas_Coord minw, minh;
Evas_List *subobjs;
Evas_Object *resize_obj;
void (*del_func) (Evas_Object *obj);
+ void (*focus_func) (Evas_Object *obj);
+ void (*activate_func) (Evas_Object *obj);
+ void (*on_focus_func) (void *data, Evas_Object *obj);
+ void *on_focus_data;
void *data;
+ unsigned char can_focus : 1;
+ unsigned char child_can_focus : 1;
+ unsigned char focused : 1;
};
/* local subsystem functions */
}
void
+e_widget_focus_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
+{
+ API_ENTRY return;
+ sd->focus_func = func;
+}
+
+void
+e_widget_activate_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
+{
+ API_ENTRY return;
+ sd->activate_func = func;
+}
+
+void
+e_widget_on_focus_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data)
+{
+ API_ENTRY return;
+ sd->on_focus_func = func;
+ sd->on_focus_data = data;
+}
+
+void
e_widget_data_set(Evas_Object *obj, void *data)
{
API_ENTRY return;
}
void
-e_widget_max_size_set(Evas_Object *obj, Evas_Coord maxw, Evas_Coord maxh)
+e_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj)
{
API_ENTRY return;
- sd->minw = maxw;
- sd->maxh = maxh;
+ sd->subobjs = evas_list_append(sd->subobjs, sobj);
+ if (!sd->child_can_focus)
+ {
+ if (e_widget_can_focus_get(sobj)) sd->child_can_focus = 1;
+ }
+ if (!strcmp(evas_object_type_get(sobj), SMART_NAME))
+ {
+ sd = evas_object_smart_data_get(sobj);
+ if (sd) sd->parent_obj = obj;
+ }
}
void
-e_widget_max_size_get(Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh)
+e_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj)
{
API_ENTRY return;
- if (maxw) *maxw = sd->maxw;
- if (maxh) *maxh = sd->maxh;
+ if (sd->resize_obj) evas_object_smart_member_del(sd->resize_obj);
+ sd->resize_obj = sobj;
+ evas_object_smart_member_add(obj, sobj);
+ _e_smart_reconfigure(sd);
}
void
-e_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj)
+e_widget_can_focus_set(Evas_Object *obj, int can_focus)
{
API_ENTRY return;
- sd->subobjs = evas_list_append(sd->subobjs, sobj);
+ sd->can_focus = can_focus;
+}
+
+int
+e_widget_can_focus_get(Evas_Object *obj)
+{
+ API_ENTRY return 0;
+ if (sd->can_focus) return 1;
+ if (sd->child_can_focus) return 1;
+ return 0;
+}
+
+int
+e_widget_focus_get(Evas_Object *obj)
+{
+ API_ENTRY return 0;
+ return sd->focused;
+}
+
+Evas_Object *
+e_widget_focused_object_get(Evas_Object *obj)
+{
+ Evas_List *l;
+ API_ENTRY return NULL;
+ if (!sd->focused) return NULL;
+ for (l = sd->subobjs; l; l = l->next)
+ {
+ Evas_Object *fobj;
+
+ fobj = e_widget_focused_object_get(l->data);
+ if (fobj) return fobj;
+ }
+ return obj;
+}
+
+int
+e_widget_focus_jump(Evas_Object *obj, int forward)
+{
+ API_ENTRY return 0;
+ if (!e_widget_can_focus_get(obj)) return 0;
+ /* if it has a focus func its an end-point widget like a button */
+ if (sd->focus_func)
+ {
+ if (!sd->focused) sd->focused = 1;
+ else sd->focused = 0;
+ sd->focus_func(obj);
+ if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
+ return sd->focused;
+ }
+ /* its some container */
+ else
+ {
+ Evas_List *l;
+ int focus_next;
+
+ focus_next = 0;
+ if (!sd->focused)
+ {
+ e_widget_focus_set(obj, forward);
+ sd->focused = 1;
+ if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
+ return 1;
+ }
+ else
+ {
+ if (forward)
+ {
+ for (l = sd->subobjs; l; l = l->next)
+ {
+ if (e_widget_can_focus_get(l->data))
+ {
+ if (focus_next)
+ {
+ /* the previous focused item was unfocused - so focus
+ * the next one (that can be focused) */
+ if (e_widget_focus_jump(l->data, forward)) return 1;
+ else break;
+ }
+ else
+ {
+ if (e_widget_focus_get(l->data))
+ {
+ /* jump to the next focused item or focus this item */
+ if (e_widget_focus_jump(l->data, forward)) return 1;
+ /* it returned 0 - it got to the last item and is past it */
+ focus_next = 1;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ for (l = evas_list_last(sd->subobjs); l; l = l->prev)
+ {
+ if (e_widget_can_focus_get(l->data))
+ {
+ if (focus_next)
+ {
+ /* the previous focused item was unfocused - so focus
+ * the next one (that can be focused) */
+ if (e_widget_focus_jump(l->data, forward)) return 1;
+ else break;
+ }
+ else
+ {
+ if (e_widget_focus_get(l->data))
+ {
+ /* jump to the next focused item or focus this item */
+ if (e_widget_focus_jump(l->data, forward)) return 1;
+ /* it returned 0 - it got to the last item and is past it */
+ focus_next = 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ /* no next item can be focused */
+ sd->focused = 0;
+ return 0;
}
void
-e_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj)
+e_widget_focus_set(Evas_Object *obj, int first)
{
API_ENTRY return;
- sd->subobjs = evas_list_remove(sd->subobjs, sobj);
+ if (!sd->focused)
+ {
+ sd->focused = 1;
+ if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
+ }
+ if (sd->focus_func)
+ {
+ sd->focus_func(obj);
+ return;
+ }
+ else
+ {
+ Evas_List *l;
+
+ if (first)
+ {
+ for (l = sd->subobjs; l; l = l->next)
+ {
+ if (e_widget_can_focus_get(l->data))
+ {
+ e_widget_focus_set(l->data, first);
+ break;
+ }
+ }
+ }
+ else
+ {
+ for (l = evas_list_last(sd->subobjs); l; l = l->prev)
+ {
+ if (e_widget_can_focus_get(l->data))
+ {
+ e_widget_focus_set(l->data, first);
+ break;
+ }
+ }
+ }
+ }
+}
+
+Evas_Object *
+e_widget_parent_get(Evas_Object *obj)
+{
+ API_ENTRY return NULL;
+ return sd->parent_obj;
}
void
-e_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj)
+e_widget_focused_object_clear(Evas_Object *obj)
{
+ Evas_List *l;
API_ENTRY return;
- if (sd->resize_obj) evas_object_smart_member_del(sd->resize_obj);
- sd->resize_obj = sobj;
- evas_object_smart_member_add(obj, sobj);
- _e_smart_reconfigure(sd);
+ if (!sd->focused) return;
+ sd->focused = 0;
+ for (l = sd->subobjs; l; l = l->next)
+ {
+ if (e_widget_focus_get(l->data))
+ {
+ e_widget_focused_object_clear(l->data);
+ break;
+ }
+ }
+ if (sd->focus_func) sd->focus_func(obj);
+}
+
+void
+e_widget_focus_steal(Evas_Object *obj)
+{
+ Evas_Object *parent, *o;
+ API_ENTRY return;
+ if (sd->focused) return;
+ parent = obj;
+ for (;;)
+ {
+ o = e_widget_parent_get(parent);
+ if (!o) break;
+ parent = o;
+ }
+ e_widget_focused_object_clear(parent);
+ parent = obj;
+ for (;;)
+ {
+ sd = evas_object_smart_data_get(parent);
+ sd->focused = 1;
+ if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, parent);
+ o = e_widget_parent_get(parent);
+ if (!o) break;
+ parent = o;
+ }
+ sd = evas_object_smart_data_get(obj);
+ if (sd->focus_func) sd->focus_func(obj);
+ return;
+}
+
+void
+e_widget_activate(Evas_Object *obj)
+{
+ API_ENTRY return;
+ if (sd->activate_func) sd->activate_func(obj);
}
/* local subsystem functions */
sd->y = 0;
sd->w = 0;
sd->h = 0;
+ sd->can_focus = 1;
evas_object_smart_data_set(obj, sd);
}
_e_smart_show, _e_smart_hide, _e_smart_color_set,
_e_smart_clip_set, _e_smart_clip_unset, NULL);
}
-
EAPI Evas_Object *e_widget_add(Evas *evas);
EAPI void e_widget_del_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
+EAPI void e_widget_focus_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
+EAPI void e_widget_activate_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj));
+EAPI void e_widget_on_focus_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data);
EAPI void e_widget_data_set(Evas_Object *obj, void *data);
EAPI void *e_widget_data_get(Evas_Object *obj);
EAPI void e_widget_min_size_set(Evas_Object *obj, Evas_Coord minw, Evas_Coord minh);
EAPI void e_widget_min_size_get(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh);
-EAPI void e_widget_max_size_set(Evas_Object *obj, Evas_Coord maxw, Evas_Coord maxh);
-EAPI void e_widget_max_size_get(Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh);
EAPI void e_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj);
-EAPI void e_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj);
EAPI void e_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj);
-
+EAPI void e_widget_can_focus_set(Evas_Object *obj, int can_focus);
+EAPI int e_widget_can_focus_get(Evas_Object *obj);
+EAPI int e_widget_focus_get(Evas_Object *obj);
+EAPI Evas_Object *e_widget_focused_object_get(Evas_Object *obj);
+EAPI int e_widget_focus_jump(Evas_Object *obj, int forward);
+EAPI void e_widget_focus_set(Evas_Object *obj, int first);
+EAPI void e_widget_focused_object_clear(Evas_Object *obj);
+EAPI Evas_Object *e_widget_parent_get(Evas_Object *obj);
+EAPI void e_widget_focus_steal(Evas_Object *obj);
+EAPI void e_widget_activate(Evas_Object *obj);
+
#endif
#endif
};
static void _e_wid_del_hook(Evas_Object *obj);
+static void _e_wid_focus_hook(Evas_Object *obj);
+static void _e_wid_activate_hook(Evas_Object *obj);
static void _e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info);
/* local subsystem functions */
/* externally accessible functions */
obj = e_widget_add(evas);
e_widget_del_hook_set(obj, _e_wid_del_hook);
+ e_widget_focus_hook_set(obj, _e_wid_focus_hook);
+ e_widget_activate_hook_set(obj, _e_wid_activate_hook);
wd = calloc(1, sizeof(E_Widget_Data));
wd->func = func;
wd->data = data;
evas_object_show(o);
e_widget_sub_object_add(obj, o);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
e_widget_resize_object_set(obj, o);
if (icon)
}
static void
-_e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source)
+_e_wid_focus_hook(Evas_Object *obj)
{
E_Widget_Data *wd;
- wd = e_widget_data_get(data);
+ wd = e_widget_data_get(obj);
+ if (e_widget_focus_get(obj))
+ edje_object_signal_emit(wd->o_button, "focus_in", "");
+ else
+ edje_object_signal_emit(wd->o_button, "focus_out", "");
+}
+
+static void
+_e_wid_activate_hook(Evas_Object *obj)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
if (wd->func) wd->func(wd->data, wd->data2);
}
+
+static void
+_e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ e_widget_focus_steal(data);
+ _e_wid_activate_hook(data);
+}
+
+static void
+_e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ e_widget_focus_steal(data);
+}
typedef struct _E_Widget_Data E_Widget_Data;
struct _E_Widget_Data
{
+ Evas_Object *o_check;
int *valptr;
};
static void _e_wid_del_hook(Evas_Object *obj);
+static void _e_wid_focus_hook(Evas_Object *obj);
+static void _e_wid_do(Evas_Object *obj);
+static void _e_wid_activate_hook(Evas_Object *obj);
static void _e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info);
+
/* local subsystem functions */
/* externally accessible functions */
obj = e_widget_add(evas);
e_widget_del_hook_set(obj, _e_wid_del_hook);
+ e_widget_focus_hook_set(obj, _e_wid_focus_hook);
+ e_widget_activate_hook_set(obj, _e_wid_activate_hook);
wd = calloc(1, sizeof(E_Widget_Data));
wd->valptr = val;
e_widget_data_set(obj, wd);
o = edje_object_add(evas);
+ wd->o_check = o;
e_theme_edje_object_set(o, "base/theme/widgets",
"widgets/check");
edje_object_signal_callback_add(o, "toggled", "*", _e_wid_signal_cb1, obj);
}
e_widget_sub_object_add(obj, o);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
e_widget_resize_object_set(obj, o);
return obj;
}
static void
-_e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source)
+_e_wid_focus_hook(Evas_Object *obj)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ if (e_widget_focus_get(obj))
+ edje_object_signal_emit(wd->o_check, "focus_in", "");
+ else
+ edje_object_signal_emit(wd->o_check, "focus_out", "");
+}
+
+static void
+_e_wid_do(Evas_Object *obj)
{
E_Widget_Data *wd;
- wd = e_widget_data_get(data);
+ wd = e_widget_data_get(obj);
if (wd->valptr)
{
- if (!strcmp(source, "on")) *(wd->valptr) = 1;
+ if (*(wd->valptr) == 0) *(wd->valptr) = 1;
else *(wd->valptr) = 0;
}
}
+
+static void
+_e_wid_activate_hook(Evas_Object *obj)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ _e_wid_do(obj);
+ if (wd->valptr)
+ {
+ if (*(wd->valptr)) edje_object_signal_emit(wd->o_check, "toggle_on", "");
+ else edje_object_signal_emit(wd->o_check, "toggle_off", "");
+ }
+}
+
+static void
+_e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ _e_wid_do(data);
+}
+
+static void
+_e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ e_widget_focus_steal(data);
+}
/* externally accessible functions */
Evas_Object *
-e_widget_list_add(Evas *evas, int horiz)
+e_widget_list_add(Evas *evas, int homogenous, int horiz)
{
Evas_Object *obj, *o;
E_Widget_Data *wd;
o = e_box_add(evas);
wd->o_box = o;
e_box_orientation_set(o, horiz);
- e_box_homogenous_set(o, 0);
+ e_box_homogenous_set(o, homogenous);
evas_object_show(o);
e_widget_sub_object_add(obj, o);
e_widget_resize_object_set(obj, o);
#ifndef E_WIDGET_LIST_H
#define E_WIDGET_LIST_H
-EAPI Evas_Object *e_widget_list_add(Evas *evas, int horiz);
+EAPI Evas_Object *e_widget_list_add(Evas *evas, int homogenous, int horiz);
EAPI void e_widget_list_object_append(Evas_Object *obj, Evas_Object *sobj, int fill, int expand, double align);
};
static void _e_wid_del_hook(Evas_Object *obj);
+static void _e_wid_focus_hook(Evas_Object *obj);
+static void _e_wid_do(Evas_Object *obj);
+static void _e_wid_activate_hook(Evas_Object *obj);
static void _e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info);
/* local subsystem functions */
/* externally accessible functions */
obj = e_widget_add(evas);
e_widget_del_hook_set(obj, _e_wid_del_hook);
+ e_widget_focus_hook_set(obj, _e_wid_focus_hook);
+ e_widget_activate_hook_set(obj, _e_wid_activate_hook);
wd = calloc(1, sizeof(E_Widget_Data));
wd->group = group;
wd->valnum = valnum;
}
e_widget_sub_object_add(obj, o);
+ evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
e_widget_resize_object_set(obj, o);
return obj;
}
static void
-_e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source)
+_e_wid_focus_hook(Evas_Object *obj)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ if (e_widget_focus_get(obj))
+ edje_object_signal_emit(wd->o_radio, "focus_in", "");
+ else
+ edje_object_signal_emit(wd->o_radio, "focus_out", "");
+}
+
+static void
+_e_wid_do(Evas_Object *obj)
{
E_Widget_Data *wd;
- wd = e_widget_data_get(data);
+ wd = e_widget_data_get(obj);
if ((wd->group) && (wd->group->valptr))
{
Evas_List *l;
for (l = wd->group->radios; l; l = l->next)
{
wd = e_widget_data_get(l->data);
- if (l->data != data)
+ if (l->data != obj)
{
wd = e_widget_data_get(l->data);
if (wd->valnum == *(wd->group->valptr))
}
}
if (!toggled) return;
- wd = e_widget_data_get(data);
- if (!strcmp(source, "on")) *(wd->group->valptr) = wd->valnum;
+ wd = e_widget_data_get(obj);
+ *(wd->group->valptr) = wd->valnum;
}
}
+
+static void
+_e_wid_activate_hook(Evas_Object *obj)
+{
+ E_Widget_Data *wd;
+
+ wd = e_widget_data_get(obj);
+ _e_wid_do(obj);
+ edje_object_signal_emit(wd->o_radio, "toggle_on", "");
+}
+
+static void
+_e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ _e_wid_do(data);
+}
+
+static void
+_e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ e_widget_focus_steal(data);
+}