forked from enlightenment/efl
added a disable state for the toggle. the design could use a more experienced hand though
SVN revision: 42457
This commit is contained in:
parent
972b69bb98
commit
55c5f99b76
|
@ -1310,6 +1310,7 @@ collections {
|
||||||
image: "bt_bases.png" COMP;
|
image: "bt_bases.png" COMP;
|
||||||
image: "bt_hilightw.png" COMP;
|
image: "bt_hilightw.png" COMP;
|
||||||
image: "tog_base.png" COMP;
|
image: "tog_base.png" COMP;
|
||||||
|
image: "tog_dis_base.png" COMP;
|
||||||
}
|
}
|
||||||
parts {
|
parts {
|
||||||
part { name: "bg";
|
part { name: "bg";
|
||||||
|
@ -1407,6 +1408,10 @@ collections {
|
||||||
rel2.to: "offrect";
|
rel2.to: "offrect";
|
||||||
image.normal: "tog_base.png";
|
image.normal: "tog_base.png";
|
||||||
}
|
}
|
||||||
|
description { state: "disabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
image.normal: "tog_dis_base.png";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
part { name: "elm.offtext";
|
part { name: "elm.offtext";
|
||||||
type: TEXT;
|
type: TEXT;
|
||||||
|
@ -1426,6 +1431,10 @@ collections {
|
||||||
text: "OFF";
|
text: "OFF";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
description { state: "disabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
color: 128 128 128 128;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
part { name: "elm.ontext";
|
part { name: "elm.ontext";
|
||||||
type: TEXT;
|
type: TEXT;
|
||||||
|
@ -1449,6 +1458,11 @@ collections {
|
||||||
text: "ON";
|
text: "ON";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
description { state: "disabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
color: 128 128 128 128;
|
||||||
|
color3: 0 0 0 24;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
part { name: "conf_over";
|
part { name: "conf_over";
|
||||||
mouse_events: 0;
|
mouse_events: 0;
|
||||||
|
@ -1527,6 +1541,17 @@ collections {
|
||||||
aspect_preference: VERTICAL;
|
aspect_preference: VERTICAL;
|
||||||
rel2.offset: 4 -5;
|
rel2.offset: 4 -5;
|
||||||
}
|
}
|
||||||
|
description { state: "disabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
color: 128 128 128 128;
|
||||||
|
}
|
||||||
|
description { state: "disabled_visible" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
color: 128 128 128 128;
|
||||||
|
fixed: 1 1;
|
||||||
|
visible: 1;
|
||||||
|
aspect: 1.0 1.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
part { name: "elm.text";
|
part { name: "elm.text";
|
||||||
type: TEXT;
|
type: TEXT;
|
||||||
|
@ -1553,6 +1578,26 @@ collections {
|
||||||
visible: 1;
|
visible: 1;
|
||||||
text.min: 1 1;
|
text.min: 1 1;
|
||||||
}
|
}
|
||||||
|
description { state: "disabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
color: 128 128 128 128;
|
||||||
|
}
|
||||||
|
description { state: "disabled_visible" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
color: 128 128 128 128;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part { name: "disabler";
|
||||||
|
type: RECT;
|
||||||
|
description { state: "default" 0.0;
|
||||||
|
color: 0 0 0 0;
|
||||||
|
visible: 0;
|
||||||
|
}
|
||||||
|
description { state: "disabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
visible: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
programs {
|
programs {
|
||||||
|
@ -1612,6 +1657,57 @@ collections {
|
||||||
action: STATE_SET "default" 0.0;
|
action: STATE_SET "default" 0.0;
|
||||||
target: "elm.swallow.content";
|
target: "elm.swallow.content";
|
||||||
}
|
}
|
||||||
|
program { name: "disable";
|
||||||
|
signal: "elm,state,disabled";
|
||||||
|
source: "elm";
|
||||||
|
action: STATE_SET "disabled" 0.0;
|
||||||
|
target: "togbase";
|
||||||
|
target: "elm.offtext";
|
||||||
|
target: "elm.ontext";
|
||||||
|
target: "disabler";
|
||||||
|
after: "disable_text";
|
||||||
|
}
|
||||||
|
program { name: "disable_text";
|
||||||
|
script {
|
||||||
|
new st[31];
|
||||||
|
new Float:vl;
|
||||||
|
get_state(PART:"elm.text", st, 30, vl);
|
||||||
|
if (!strcmp(st, "visible"))
|
||||||
|
set_state(PART:"elm.text", "disabled_visible", 0.0);
|
||||||
|
else
|
||||||
|
set_state(PART:"elm.text", "disabled", 0.0);
|
||||||
|
|
||||||
|
get_state(PART:"elm.swallow.content", st, 30, vl);
|
||||||
|
if (!strcmp(st, "visible"))
|
||||||
|
set_state(PART:"elm.swallow.content", "disabled_visible", 0.0);
|
||||||
|
else
|
||||||
|
set_state(PART:"elm.swallow.content", "disabled", 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
program { name: "enable";
|
||||||
|
signal: "elm,state,enabled";
|
||||||
|
source: "elm";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
target: "disabler";
|
||||||
|
after: "enable_text";
|
||||||
|
}
|
||||||
|
program { name: "enable_text";
|
||||||
|
script {
|
||||||
|
new st[31];
|
||||||
|
new Float:vl;
|
||||||
|
get_state(PART:"elm.text", st, 30, vl);
|
||||||
|
if (!strcmp(st, "disabled_visible"))
|
||||||
|
set_state(PART:"elm.text", "visible", 0.0);
|
||||||
|
else
|
||||||
|
set_state(PART:"elm.text", "default", 0.0);
|
||||||
|
|
||||||
|
get_state(PART:"elm.swallow.content", st, 30, vl);
|
||||||
|
if (!strcmp(st, "visible"))
|
||||||
|
set_state(PART:"elm.swallow.content", "visible", 0.0);
|
||||||
|
else
|
||||||
|
set_state(PART:"elm.swallow.content", "default", 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11213,7 +11309,9 @@ collections {
|
||||||
description { state: "disabled_visible" 0.0;
|
description { state: "disabled_visible" 0.0;
|
||||||
inherit: "default" 0.0;
|
inherit: "default" 0.0;
|
||||||
color: 128 128 128 128;
|
color: 128 128 128 128;
|
||||||
|
fixed: 1 1;
|
||||||
visible: 1;
|
visible: 1;
|
||||||
|
aspect: 1.0 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
part { name: "elm.text";
|
part { name: "elm.text";
|
||||||
|
|
|
@ -46,6 +46,18 @@ test_toggle(void *data, Evas_Object *obj, void *event_info)
|
||||||
evas_object_show(tg);
|
evas_object_show(tg);
|
||||||
evas_object_show(ic);
|
evas_object_show(ic);
|
||||||
|
|
||||||
|
ic = elm_icon_add(win);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||||
|
elm_icon_file_set(ic, buf, NULL);
|
||||||
|
elm_icon_scale_set(ic, 0, 0);
|
||||||
|
tg = elm_toggle_add(win);
|
||||||
|
elm_toggle_label_set(tg, "Icon no scale");
|
||||||
|
elm_toggle_icon_set(tg, ic);
|
||||||
|
elm_object_disabled_set(tg, 1);
|
||||||
|
elm_box_pack_end(bx, tg);
|
||||||
|
evas_object_show(tg);
|
||||||
|
evas_object_show(ic);
|
||||||
|
|
||||||
tg = elm_toggle_add(win);
|
tg = elm_toggle_add(win);
|
||||||
elm_toggle_label_set(tg, "Label Only");
|
elm_toggle_label_set(tg, "Label Only");
|
||||||
elm_toggle_states_labels_set(tg, "Big long fun times label", "Small long happy fun label");
|
elm_toggle_states_labels_set(tg, "Big long fun times label", "Small long happy fun label");
|
||||||
|
|
|
@ -857,7 +857,7 @@ extern "C" {
|
||||||
// * table doesnt do homogenous properly
|
// * table doesnt do homogenous properly
|
||||||
//
|
//
|
||||||
//// (incomplete - medium priority)
|
//// (incomplete - medium priority)
|
||||||
// * need to add support for disabled in all widgets. Button, toolbar, hoversel, radio, check, spinner and entry are currently done.
|
// * need to add support for disabled in all widgets. Button, toolbar, hoversel, radio, check, toggle, spinner and entry are currently done.
|
||||||
// * on the fly theme changes - test (should work)
|
// * on the fly theme changes - test (should work)
|
||||||
// * hoversel only vertical right now - make horizontal
|
// * hoversel only vertical right now - make horizontal
|
||||||
// * when entries are in a scroller and change size, the scroller shows scrollbars. fix. same for selecting. for 1 line entries in a scroller should only have scroll arrow indicators.
|
// * when entries are in a scroller and change size, the scroller shows scrollbars. fix. same for selecting. for 1 line entries in a scroller should only have scroll arrow indicators.
|
||||||
|
|
|
@ -14,6 +14,7 @@ struct _Widget_Data
|
||||||
};
|
};
|
||||||
|
|
||||||
static void _del_hook(Evas_Object *obj);
|
static void _del_hook(Evas_Object *obj);
|
||||||
|
static void _disable_hook(Evas_Object *obj);
|
||||||
static void _theme_hook(Evas_Object *obj);
|
static void _theme_hook(Evas_Object *obj);
|
||||||
static void _sizing_eval(Evas_Object *obj);
|
static void _sizing_eval(Evas_Object *obj);
|
||||||
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
|
@ -31,6 +32,16 @@ _del_hook(Evas_Object *obj)
|
||||||
free(wd);
|
free(wd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_disable_hook(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
if (elm_widget_disabled_get(obj))
|
||||||
|
edje_object_signal_emit(wd->tgl, "elm,state,disabled", "elm");
|
||||||
|
else
|
||||||
|
edje_object_signal_emit(wd->tgl, "elm,state,enabled", "elm");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_theme_hook(Evas_Object *obj)
|
_theme_hook(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
@ -128,6 +139,7 @@ elm_toggle_add(Evas_Object *parent)
|
||||||
elm_widget_data_set(obj, wd);
|
elm_widget_data_set(obj, wd);
|
||||||
elm_widget_del_hook_set(obj, _del_hook);
|
elm_widget_del_hook_set(obj, _del_hook);
|
||||||
elm_widget_theme_hook_set(obj, _theme_hook);
|
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||||
|
elm_widget_disable_hook_set(obj, _disable_hook);
|
||||||
|
|
||||||
wd->tgl = edje_object_add(e);
|
wd->tgl = edje_object_add(e);
|
||||||
_elm_theme_set(wd->tgl, "toggle", "base", "default");
|
_elm_theme_set(wd->tgl, "toggle", "base", "default");
|
||||||
|
|
Loading…
Reference in New Issue