and now all the internal widgets understand keyboard focus and control.


			
			
				devs/princeamd/enlightenment-0.17-elive
			
			
		
Carsten Haitzler 18 years ago
parent 248f977318
commit 03651d0fcb
  1. 45
      data/themes/default_button.edc
  2. 40
      data/themes/default_check.edc
  3. 546
      data/themes/default_dialog.edc
  4. 40
      data/themes/default_radio.edc
  5. BIN
      data/themes/images/focus.png
  6. 257
      src/bin/e_dialog.c
  7. 3
      src/bin/e_dialog.h
  8. 2
      src/bin/e_pan.c
  9. 22
      src/bin/e_test.c
  10. 284
      src/bin/e_widget.c
  11. 18
      src/bin/e_widget.h
  12. 35
      src/bin/e_widget_button.c
  13. 54
      src/bin/e_widget_check.c
  14. 4
      src/bin/e_widget_list.c
  15. 2
      src/bin/e_widget_list.h
  16. 51
      src/bin/e_widget_radio.c

@ -4,6 +4,7 @@ images {
image: "e17_titlebar_glint1.png" COMP;
image: "e17_titlebar_glint2.png" COMP;
image: "e17_titlebar_glint3.png" COMP;
image: "focus.png" COMP;
}
group {
@ -15,6 +16,7 @@ group {
mouse_events: 1;
description {
state: "default" 0.0;
min: 64 16;
image {
normal: "e17_button.png";
border: 8 8 8 8;
@ -37,12 +39,12 @@ group {
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";
}
}
@ -245,6 +247,29 @@ group {
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 {
@ -331,5 +356,21 @@ group {
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";
}
}
}

@ -1,6 +1,7 @@
images {
image: "e17_menu_check1.png" COMP;
image: "e17_menu_check2.png" COMP;
image: "focus.png" COMP;
}
group {
name: "widgets/check";
@ -89,6 +90,29 @@ group {
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 {
@ -124,5 +148,21 @@ group {
}
}
}
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";
}
}
}

@ -1,158 +1,7 @@
#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
@ -178,7 +27,6 @@ group {
rel1 {
relative: 0.0 0.0;
offset: 1 1;
// to_y: "base2";
}
rel2 {
relative: 1.0 1.0;
@ -209,31 +57,6 @@ group {
}
}
}
/*
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;
@ -294,31 +117,6 @@ group {
}
}
}
/*
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;
@ -363,350 +161,6 @@ group {
}
}
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 {

@ -1,6 +1,7 @@
images {
image: "e17_menu_radio1.png" COMP;
image: "e17_menu_radio2.png" COMP;
image: "focus.png" COMP;
}
group {
name: "widgets/radio";
@ -89,6 +90,29 @@ group {
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 {
@ -117,5 +141,21 @@ group {
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";
}
}
}

Binary file not shown.

@ -3,23 +3,12 @@
*/
#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 */
@ -59,14 +48,11 @@ e_dialog_new(E_Container *con)
"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;
@ -83,109 +69,27 @@ e_dialog_new(E_Container *con)
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
@ -226,6 +130,8 @@ e_dialog_icon_set(E_Dialog *dia, char *icon, Evas_Coord size)
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);
@ -246,7 +152,7 @@ e_dialog_show(E_Dialog *dia)
}
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);
@ -256,58 +162,30 @@ e_dialog_show(E_Dialog *dia)
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
@ -318,52 +196,64 @@ _e_dialog_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event)
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);
}
}
@ -375,3 +265,16 @@ _e_dialog_cb_delete(E_Win *win)
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);
}

@ -20,17 +20,16 @@ struct _E_Dialog
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);

@ -4,7 +4,7 @@
#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;

@ -309,7 +309,13 @@ _e_test_internal(E_Container *con)
}
#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)
@ -326,18 +332,18 @@ _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));
@ -350,7 +356,7 @@ _e_test_internal(E_Container *con)
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));

@ -4,18 +4,26 @@
#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 */
@ -54,6 +62,28 @@ e_widget_del_hook_set(Evas_Object *obj, void (*func) (Evas_Object *obj))
sd->del_func = func;
}
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)
{
@ -85,43 +115,261 @@ e_widget_min_size_get(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh)
}
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 */