diff --git a/data/themes/default.edc b/data/themes/default.edc index 1f4ecae9b..f60bf4065 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -35217,6 +35217,136 @@ collections { } } +///////////////////////////////////////////////////////////////////////////// +/*** MOD: ILLUME-HOME-TOGGLE ***/ + + group { + name: "e/modules/illume_home_toggle/main"; + images.image: "illume-home.png" COMP; + images { + image: "bt_base1.png" COMP; + image: "bt_base2.png" COMP; + image: "bt_hilight.png" COMP; + image: "bt_shine.png" COMP; + image: "bt_glow.png" COMP; + } + min: 16 16; + max: 128 128; + parts { + part { + name: "button_image"; + mouse_events: 1; + scale: 1; + description { + state: "default" 0.0; + fixed: 1 1; + align: 0.5 0.5; + min: 32 16; + image { + normal: "bt_base2.png"; + border: 7 7 7 7; + } + } + description { + state: "clicked" 0.0; + inherit: "default" 0.0; + image.normal: "bt_base1.png"; + } + program { + name: "button_down"; + signal: "mouse,down,1"; + source: "button_image"; + action: STATE_SET "clicked" 0.0; + target: "button_image"; + target: "over3"; + } + program { + name: "button_up"; + signal: "mouse,up,1"; + source: "button_image"; + action: STATE_SET "default" 0.0; + target: "button_image"; + target: "over3"; + } + program { + name: "button_click"; + signal: "mouse,clicked,1"; + source: "button_image"; + action: SIGNAL_EMIT "e,action,home" ""; + } + } + part { + name: "icon"; + mouse_events: 0; + description { + state: "default" 0.0; + aspect: 1.0 1.0; + aspect_preference: BOTH; + image.normal: "illume-home.png"; + rel1 { + to: "button_image"; + relative: 0.0 0.0; + offset: 3 3; + } + rel2 { + relative: 1.0 1.0; + offset: -4 -4; + to: "button_image"; + } + } + } + part { + name: "over1"; + mouse_events: 0; + description { + state: "default" 0.0; + rel1.to: "button_image"; + rel2.to: "button_image"; + rel2.relative: 1.0 0.5; + image { + normal: "bt_hilight.png"; + border: 7 7 7 0; + } + } + } + part { + name: "over2"; + mouse_events: 0; + description { + state: "default" 0.0; + rel1.to: "button_image"; + rel2.to: "button_image"; + image { + normal: "bt_shine.png"; + border: 7 7 7 7; + } + } + } + part { + name: "over3"; + mouse_events: 0; + description { + state: "default" 0.0; + rel1.to: "button_image"; + rel2.to: "button_image"; + visible: 0; + color: 255 255 255 0; + image { + normal: "bt_glow.png"; + border: 12 12 12 12; + } + fill.smooth : 0; + } + description { + state: "clicked" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + } + } + ///////////////////////////////////////////////////////////////////////////// /*** MOD: COMP ***/ diff --git a/src/modules/illume-home-toggle/e_mod_main.c b/src/modules/illume-home-toggle/e_mod_main.c index 8bc709f03..68420e052 100644 --- a/src/modules/illume-home-toggle/e_mod_main.c +++ b/src/modules/illume-home-toggle/e_mod_main.c @@ -5,7 +5,7 @@ typedef struct _Instance Instance; struct _Instance { E_Gadcon_Client *gcc; - Evas_Object *o_btn; + Evas_Object *o_toggle; }; /* local function prototypes */ @@ -15,7 +15,7 @@ static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient); static char *_gc_label(E_Gadcon_Client_Class *cc); static Evas_Object *_gc_icon(E_Gadcon_Client_Class *cc, Evas *evas); static const char *_gc_id_new(E_Gadcon_Client_Class *cc); -static void _cb_btn_click(void *data, void *data2); +static void _cb_action_home(void *data, Evas_Object *obj, const char *emission, const char *source); /* local variables */ static Eina_List *instances = NULL; @@ -59,22 +59,18 @@ e_modapi_save(E_Module *m) static E_Gadcon_Client * _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) { - Instance *inst; - Evas_Object *icon; - char buff[PATH_MAX]; + Instance *inst = E_NEW(Instance, 1); - snprintf(buff, sizeof(buff), "%s/e-module-illume-home-toggle.edj", mod_dir); + inst->o_toggle = edje_object_add(gc->evas); + e_theme_edje_object_set(inst->o_toggle, "base/theme/modules/illume_home_toggle", + "e/modules/illume_home_toggle/main"); - inst = E_NEW(Instance, 1); - inst->o_btn = e_widget_button_add(gc->evas, NULL, NULL, - _cb_btn_click, inst, NULL); - icon = e_icon_add(evas_object_evas_get(inst->o_btn)); - e_icon_file_edje_set(icon, buff, "icon"); - e_widget_button_icon_set(inst->o_btn, icon); - - inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_btn); + inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_toggle); inst->gcc->data = inst; + edje_object_signal_callback_add(inst->o_toggle, "e,action,home", "", + _cb_action_home, inst); + instances = eina_list_append(instances, inst); return inst->gcc; } @@ -86,7 +82,7 @@ _gc_shutdown(E_Gadcon_Client *gcc) if (!(inst = gcc->data)) return; instances = eina_list_remove(instances, inst); - if (inst->o_btn) evas_object_del(inst->o_btn); + if (inst->o_toggle) evas_object_del(inst->o_toggle); E_FREE(inst); } @@ -126,12 +122,11 @@ _gc_id_new(E_Gadcon_Client_Class *cc) } static void -_cb_btn_click(void *data, void *data2) +_cb_action_home(void *data, Evas_Object *obj, const char *emission, const char *source) { - Instance *inst; + Instance *inst = (Instance *) data; E_Zone *zone; - if (!(inst = data)) return; zone = inst->gcc->gadcon->zone; ecore_x_e_illume_focus_home_send(zone->black_win); }