Make illume-kbd-toggle from e_button to edje
SVN revision: 49920
This commit is contained in:
parent
2e8beb1798
commit
21e6cc0488
|
@ -35347,6 +35347,174 @@ collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
/*** MOD: ILLUME-KBD-TOGGLE ***/
|
||||||
|
|
||||||
|
group {
|
||||||
|
name: "e/modules/illume_kbd_toggle/main";
|
||||||
|
images.image: "illume-kbd.png" COMP;
|
||||||
|
images.image: "illume-kbd-on.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: "enable";
|
||||||
|
signal: "mouse,clicked,1";
|
||||||
|
source: "button_image";
|
||||||
|
action: SIGNAL_EMIT "e,action,vkbd,enable" "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part {
|
||||||
|
name: "icon";
|
||||||
|
mouse_events: 0;
|
||||||
|
description {
|
||||||
|
state: "default" 0.0;
|
||||||
|
aspect: 1.0 1.0;
|
||||||
|
aspect_preference: BOTH;
|
||||||
|
image.normal: "illume-kbd.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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
description { state: "on" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
image.normal: "illume-kbd-on.png";
|
||||||
|
}
|
||||||
|
program { name: "state_on";
|
||||||
|
signal: "e,state,vkbd,on";
|
||||||
|
source: "e";
|
||||||
|
action: STATE_SET "on" 0.0;
|
||||||
|
target: "icon";
|
||||||
|
target: "on";
|
||||||
|
}
|
||||||
|
program { name: "state_off";
|
||||||
|
signal: "e,state,vkbd,off";
|
||||||
|
source: "e";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
target: "icon";
|
||||||
|
target: "on";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "on";
|
||||||
|
type: RECT;
|
||||||
|
mouse_events: 1;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
visible: 0;
|
||||||
|
color: 0 0 0 0;
|
||||||
|
rel1.to: "button_image";
|
||||||
|
rel2.to: "button_image";
|
||||||
|
}
|
||||||
|
description { state: "on" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
program { name: "disable";
|
||||||
|
signal: "mouse,clicked,1";
|
||||||
|
source: "on";
|
||||||
|
action: SIGNAL_EMIT "e,action,vkbd,disable" "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 ***/
|
/*** MOD: COMP ***/
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
@ -6,7 +6,7 @@ typedef struct _Instance Instance;
|
||||||
struct _Instance
|
struct _Instance
|
||||||
{
|
{
|
||||||
E_Gadcon_Client *gcc;
|
E_Gadcon_Client *gcc;
|
||||||
Evas_Object *o_btn;
|
Evas_Object *o_toggle;
|
||||||
Eina_List *handlers;
|
Eina_List *handlers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,7 +17,8 @@ static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
|
||||||
static char *_gc_label(E_Gadcon_Client_Class *cc);
|
static char *_gc_label(E_Gadcon_Client_Class *cc);
|
||||||
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *cc, Evas *evas);
|
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *cc, Evas *evas);
|
||||||
static const char *_gc_id_new(E_Gadcon_Client_Class *cc);
|
static const char *_gc_id_new(E_Gadcon_Client_Class *cc);
|
||||||
static void _cb_btn_click(void *data, void *data2);
|
static void _cb_action_vkbd_enable(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||||
|
static void _cb_action_vkbd_disable(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||||
static Eina_Bool _cb_border_focus_in(void *data, int type __UNUSED__, void *event);
|
static Eina_Bool _cb_border_focus_in(void *data, int type __UNUSED__, void *event);
|
||||||
static Eina_Bool _cb_border_remove(void *data, int type __UNUSED__, void *event);
|
static Eina_Bool _cb_border_remove(void *data, int type __UNUSED__, void *event);
|
||||||
static Eina_Bool _cb_border_property(void *data, int type __UNUSED__, void *event);
|
static Eina_Bool _cb_border_property(void *data, int type __UNUSED__, void *event);
|
||||||
|
@ -65,17 +66,20 @@ e_modapi_save(E_Module *m)
|
||||||
static E_Gadcon_Client *
|
static E_Gadcon_Client *
|
||||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
{
|
{
|
||||||
Instance *inst;
|
Instance *inst = E_NEW(Instance, 1);
|
||||||
|
|
||||||
inst = E_NEW(Instance, 1);
|
inst->o_toggle = edje_object_add(gc->evas);
|
||||||
|
e_theme_edje_object_set(inst->o_toggle, "base/theme/modules/illume_kbd_toggle",
|
||||||
|
"e/modules/illume_kbd_toggle/main");
|
||||||
|
|
||||||
inst->o_btn = e_widget_button_add(gc->evas, NULL, NULL,
|
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_toggle);
|
||||||
_cb_btn_click, inst, NULL);
|
|
||||||
_set_btn_icon(inst->o_btn, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
|
|
||||||
|
|
||||||
inst->gcc = e_gadcon_client_new(gc, name, id, style, inst->o_btn);
|
|
||||||
inst->gcc->data = inst;
|
inst->gcc->data = inst;
|
||||||
|
|
||||||
|
edje_object_signal_callback_add(inst->o_toggle, "e,action,vkbd,enable", "",
|
||||||
|
_cb_action_vkbd_enable, inst);
|
||||||
|
edje_object_signal_callback_add(inst->o_toggle, "e,action,vkbd,disable", "",
|
||||||
|
_cb_action_vkbd_disable, inst);
|
||||||
|
|
||||||
inst->handlers =
|
inst->handlers =
|
||||||
eina_list_append(inst->handlers,
|
eina_list_append(inst->handlers,
|
||||||
ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN,
|
ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN,
|
||||||
|
@ -101,7 +105,7 @@ _gc_shutdown(E_Gadcon_Client *gcc)
|
||||||
|
|
||||||
if (!(inst = gcc->data)) return;
|
if (!(inst = gcc->data)) return;
|
||||||
instances = eina_list_remove(instances, inst);
|
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);
|
||||||
EINA_LIST_FREE(inst->handlers, handler)
|
EINA_LIST_FREE(inst->handlers, handler)
|
||||||
ecore_event_handler_del(handler);
|
ecore_event_handler_del(handler);
|
||||||
E_FREE(inst);
|
E_FREE(inst);
|
||||||
|
@ -142,8 +146,8 @@ _gc_id_new(E_Gadcon_Client_Class *cc)
|
||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_btn_click(void *data, void *data2)
|
_cb_action_vkbd_enable(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||||
{
|
{
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
E_Border *bd;
|
E_Border *bd;
|
||||||
|
@ -151,13 +155,25 @@ _cb_btn_click(void *data, void *data2)
|
||||||
if (!(inst = data)) return;
|
if (!(inst = data)) return;
|
||||||
if (!(bd = e_border_focused_get())) return;
|
if (!(bd = e_border_focused_get())) return;
|
||||||
if (bd->zone != inst->gcc->gadcon->zone) return;
|
if (bd->zone != inst->gcc->gadcon->zone) return;
|
||||||
|
if (bd->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ON) return;
|
||||||
|
|
||||||
if (bd->client.vkbd.state <= ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
|
ecore_x_e_virtual_keyboard_state_set(bd->client.win,
|
||||||
ecore_x_e_virtual_keyboard_state_set(bd->client.win,
|
ECORE_X_VIRTUAL_KEYBOARD_STATE_ON);
|
||||||
ECORE_X_VIRTUAL_KEYBOARD_STATE_ON);
|
}
|
||||||
else
|
|
||||||
ecore_x_e_virtual_keyboard_state_set(bd->client.win,
|
static void
|
||||||
ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
|
_cb_action_vkbd_disable(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||||
|
{
|
||||||
|
Instance *inst;
|
||||||
|
E_Border *bd;
|
||||||
|
|
||||||
|
if (!(inst = data)) return;
|
||||||
|
if (!(bd = e_border_focused_get())) return;
|
||||||
|
if (bd->zone != inst->gcc->gadcon->zone) return;
|
||||||
|
if (bd->client.vkbd.state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) return;
|
||||||
|
|
||||||
|
ecore_x_e_virtual_keyboard_state_set(bd->client.win,
|
||||||
|
ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -172,7 +188,7 @@ _cb_border_focus_in(void *data, int type __UNUSED__, void *event)
|
||||||
if (ev->border->stolen) return ECORE_CALLBACK_PASS_ON;
|
if (ev->border->stolen) return ECORE_CALLBACK_PASS_ON;
|
||||||
if (!(bd = ev->border)) return ECORE_CALLBACK_PASS_ON;
|
if (!(bd = ev->border)) return ECORE_CALLBACK_PASS_ON;
|
||||||
if (bd->zone != inst->gcc->gadcon->zone) return ECORE_CALLBACK_PASS_ON;
|
if (bd->zone != inst->gcc->gadcon->zone) return ECORE_CALLBACK_PASS_ON;
|
||||||
_set_btn_icon(inst->o_btn, bd->client.vkbd.state);
|
_set_btn_icon(inst->o_toggle, bd->client.vkbd.state);
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +198,7 @@ _cb_border_remove(void *data, int type __UNUSED__, void *event)
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
|
|
||||||
if (!(inst = data)) return ECORE_CALLBACK_PASS_ON;
|
if (!(inst = data)) return ECORE_CALLBACK_PASS_ON;
|
||||||
_set_btn_icon(inst->o_btn, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
|
_set_btn_icon(inst->o_toggle, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,22 +215,15 @@ _cb_border_property(void *data, int type __UNUSED__, void *event)
|
||||||
if (!bd->focused) return ECORE_CALLBACK_PASS_ON;
|
if (!bd->focused) return ECORE_CALLBACK_PASS_ON;
|
||||||
if (!(inst = data)) return ECORE_CALLBACK_PASS_ON;
|
if (!(inst = data)) return ECORE_CALLBACK_PASS_ON;
|
||||||
if (bd->zone != inst->gcc->gadcon->zone) return ECORE_CALLBACK_PASS_ON;
|
if (bd->zone != inst->gcc->gadcon->zone) return ECORE_CALLBACK_PASS_ON;
|
||||||
_set_btn_icon(inst->o_btn, bd->client.vkbd.state);
|
_set_btn_icon(inst->o_toggle, bd->client.vkbd.state);
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_set_btn_icon(Evas_Object *obj, Ecore_X_Virtual_Keyboard_State state)
|
_set_btn_icon(Evas_Object *obj, Ecore_X_Virtual_Keyboard_State state)
|
||||||
{
|
{
|
||||||
Evas_Object *icon;
|
if (state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ON)
|
||||||
char buff[PATH_MAX];
|
edje_object_signal_emit(obj, "e,state,vkbd,on", "e");
|
||||||
|
else
|
||||||
snprintf(buff, sizeof(buff), "%s/e-module-illume-kbd-toggle.edj", mod_dir);
|
edje_object_signal_emit(obj, "e,state,vkbd,off", "e");
|
||||||
|
|
||||||
icon = e_icon_add(evas_object_evas_get(obj));
|
|
||||||
if (state <= ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF)
|
|
||||||
e_icon_file_edje_set(icon, buff, "icon");
|
|
||||||
else
|
|
||||||
e_icon_file_edje_set(icon, buff, "btn_icon");
|
|
||||||
e_widget_button_icon_set(obj, icon);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue