Buttons are pretty decent looking now, with focus too.

This commit is contained in:
Jaime Thomas 2008-09-20 01:00:13 +00:00
parent 3f29f41400
commit a9e9965cdb
4 changed files with 161 additions and 13 deletions

View File

@ -9,4 +9,5 @@ collections {
#include "groups/window.edc"
#include "groups/welcome_page.edc"
#include "groups/button.edc"
#include "groups/icons.edc"
}

View File

@ -0,0 +1,127 @@
group {
name: "ecdb/burn_data";
min: 32 32;
parts {
part {
name: "image";
type: IMAGE;
description {
state: "default" 0.0;
min: 32 32;
max: 32 32;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
image {
normal: "drive_optical.png";
}
}
}
}
}
group {
name: "ecdb/burn_audio";
min: 32 32;
parts {
part {
name: "image";
type: IMAGE;
description {
state: "default" 0.0;
min: 32 32;
max: 32 32;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
image {
normal: "audio.png";
}
}
}
}
}
group {
name: "ecdb/erase";
min: 32 32;
parts {
part {
name: "image";
type: IMAGE;
description {
state: "default" 0.0;
min: 32 32;
max: 32 32;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
image {
normal: "clear.png";
}
}
}
}
}
group {
name: "ecdb/burn_image";
min: 32 32;
parts {
part {
name: "image";
type: IMAGE;
description {
state: "default" 0.0;
min: 32 32;
max: 32 32;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
image {
normal: "iso.png";
}
}
}
}
}

View File

@ -120,7 +120,11 @@ _cb_filelist_key_down(void *data, Evas *e __UNUSED__,
else if ((ek->keyname) && (*ek->keyname) && (!ek->key[1]))
append = ek->keyname;
else
{
if (text)
free(text);
return;
}
if (!text)
text = strdup(append);
@ -202,7 +206,7 @@ ecdb_create_main_gui(void)
edje_object_part_geometry_get(gui, "filelist", &x, &y, &w, &h);
evas_object_move(swallow, x, y);
evas_object_resize(swallow, x, y);
evas_object_resize(swallow, w, h);
edje_object_part_swallow(gui, "filelist", swallow);
evas_object_event_callback_add(swallow, EVAS_CALLBACK_MOUSE_DOWN,
_cb_filelist_mouse_down, gui);
@ -229,23 +233,24 @@ ecdb_create_main_gui(void)
int i;
char *names[] = {"b1","b2","b3","b4"};
char *labels[] = {"Burn Data CD", "Burn Audio CD", "Copy Disc",
"Erase Re-writable disc"};
char *icons[] = {"drive_optical.png", "audio.png", "iso.png",
"clear.png"};
"Erase Re-writable Disc"};
char *icons[] = {"ecdb/burn_data", "ecdb/burn_audio", "ecdb/burn_image",
"ecdb/erase"};
for (i = 0; i < 4; i++)
{
b = edje_object_add(ecore_evas_get(em->main_win_ee));
evas_object_name_set(b, names[i]);
edje_object_file_set(b, em->theme_path, "ecdb/button");
edje_object_part_geometry_get(welcome_page, names[i],
&x, &y, &w, &h);
edje_object_part_geometry_get(welcome_page, names[i], &x, &y, &w, &h);
edje_object_part_text_set(b, "label", labels[i]);
ecdb_button_icon_swallow(ecore_evas_get(em->main_win_ee), b,
icons[i]);
evas_object_move(b, x, y);
evas_object_resize(b, w, h);
edje_object_part_swallow(welcome_page, names[i], b);
evas_object_show(b);
/* Place this after */
ecdb_button_icon_swallow(ecore_evas_get(em->main_win_ee), b,
icons[i]);
}
return TRUE;
@ -393,6 +398,17 @@ static void
ecdb_cb_welcome_page(void *data, Evas_Object *o, const char *emission,
const char *source)
{
printf("callback from %s\n", source);
printf("callback %s\n", emission);
static char *old_source;
Evas_Object *unsel;
if ((old_source) && (strcmp(old_source, source)))
{
unsel = evas_object_name_find(ecore_evas_get(em->main_win_ee),
old_source);
edje_object_signal_emit(unsel, "ecdb,button,focus,out", "ecdb");
free(old_source);
old_source = strdup(source);
}
else if (!old_source)
old_source = strdup(source);
}

View File

@ -127,11 +127,15 @@ void
ecdb_button_icon_swallow(Evas *e, Evas_Object *b, const char *iname)
{
Evas_Object *icon;
Evas_Coord x, y, w, h;
icon = evas_object_image_add(e);
evas_object_image_file_set(icon, em->theme_path, iname);
icon = edje_object_add(e);
edje_object_file_set(icon, em->theme_path, iname);
edje_object_part_geometry_get(b, "icon", &x, &y, &w, &h);
evas_object_move(icon, x, y);
evas_object_resize(icon, w, h);
edje_object_part_swallow(b, "icon", icon);
evas_object_show(icon);
}