forked from enlightenment/efl
From: Viktor Kojouharov <vkojouharov@gmail.com>
Hi raster, glad you're back. I'm resending some elm patches your way. the disabled_buttons.diff also needs bt_dis_base.png and bt_dis_hilight.png from e17's b&w theme. SVN revision: 41818
This commit is contained in:
parent
b0bbf7348b
commit
5fb0b1e786
|
@ -23,6 +23,8 @@ bt_sm_base1.png \
|
||||||
bt_sm_base2.png \
|
bt_sm_base2.png \
|
||||||
bt_sm_hilight.png \
|
bt_sm_hilight.png \
|
||||||
bt_sm_shine.png \
|
bt_sm_shine.png \
|
||||||
|
bt_dis_base.png \
|
||||||
|
bt_dis_hilight.png \
|
||||||
dia_botshad.png \
|
dia_botshad.png \
|
||||||
dia_grad.png \
|
dia_grad.png \
|
||||||
dia_topshad.png \
|
dia_topshad.png \
|
||||||
|
|
|
@ -547,6 +547,8 @@ collections {
|
||||||
image: "bt_hilight.png" COMP;
|
image: "bt_hilight.png" COMP;
|
||||||
image: "bt_shine.png" COMP;
|
image: "bt_shine.png" COMP;
|
||||||
image: "bt_glow.png" COMP;
|
image: "bt_glow.png" COMP;
|
||||||
|
image: "bt_dis_base.png" COMP;
|
||||||
|
image: "bt_dis_hilight.png" COMP;
|
||||||
}
|
}
|
||||||
parts {
|
parts {
|
||||||
part { name: "button_image";
|
part { name: "button_image";
|
||||||
|
@ -563,6 +565,13 @@ collections {
|
||||||
image.normal: "bt_base1.png";
|
image.normal: "bt_base1.png";
|
||||||
image.middle: SOLID;
|
image.middle: SOLID;
|
||||||
}
|
}
|
||||||
|
description { state: "disabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
image {
|
||||||
|
normal: "bt_dis_base.png";
|
||||||
|
border: 4 4 4 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
part { name: "elm.swallow.content";
|
part { name: "elm.swallow.content";
|
||||||
type: SWALLOW;
|
type: SWALLOW;
|
||||||
|
@ -619,6 +628,18 @@ collections {
|
||||||
visible: 1;
|
visible: 1;
|
||||||
text.min: 1 1;
|
text.min: 1 1;
|
||||||
}
|
}
|
||||||
|
description { state: "disabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
color: 0 0 0 128;
|
||||||
|
color3: 0 0 0 0;
|
||||||
|
}
|
||||||
|
description { state: "disabled_visible" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
color: 0 0 0 128;
|
||||||
|
color3: 0 0 0 0;
|
||||||
|
visible: 1;
|
||||||
|
text.min: 1 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
part { name: "over1";
|
part { name: "over1";
|
||||||
mouse_events: 0;
|
mouse_events: 0;
|
||||||
|
@ -629,6 +650,13 @@ collections {
|
||||||
border: 7 7 7 0;
|
border: 7 7 7 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
description { state: "disabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
image {
|
||||||
|
normal: "bt_dis_hilight.png";
|
||||||
|
border: 4 4 4 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
part { name: "over2";
|
part { name: "over2";
|
||||||
mouse_events: 1;
|
mouse_events: 1;
|
||||||
|
@ -640,6 +668,10 @@ collections {
|
||||||
border: 7 7 7 7;
|
border: 7 7 7 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
description { state: "disabled" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
visible: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
part { name: "over3";
|
part { name: "over3";
|
||||||
mouse_events: 1;
|
mouse_events: 1;
|
||||||
|
@ -658,6 +690,17 @@ collections {
|
||||||
color: 255 255 255 255;
|
color: 255 255 255 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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 {
|
||||||
program {
|
program {
|
||||||
|
@ -738,6 +781,48 @@ 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: "button_image";
|
||||||
|
target: "over1";
|
||||||
|
target: "over2";
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
program { name: "enable";
|
||||||
|
signal: "elm,state,enabled";
|
||||||
|
source: "elm";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
target: "button_image";
|
||||||
|
target: "over1";
|
||||||
|
target: "over2";
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,29 @@ test_button(void *data, Evas_Object *obj, void *event_info)
|
||||||
evas_object_show(bt);
|
evas_object_show(bt);
|
||||||
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);
|
||||||
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_button_label_set(bt, "Disabled Button");
|
||||||
|
elm_button_icon_set(bt, ic);
|
||||||
|
elm_object_disabled_set(bt, 1);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
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);
|
||||||
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_button_icon_set(bt, ic);
|
||||||
|
elm_object_disabled_set(bt, 1);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
evas_object_show(ic);
|
||||||
|
|
||||||
bt = elm_button_add(win);
|
bt = elm_button_add(win);
|
||||||
elm_button_label_set(bt, "Label Only");
|
elm_button_label_set(bt, "Label Only");
|
||||||
elm_box_pack_end(bx, bt);
|
elm_box_pack_end(bx, bt);
|
||||||
|
|
|
@ -166,6 +166,8 @@ extern "C" {
|
||||||
EAPI double elm_object_scale_get(const Evas_Object *obj);
|
EAPI double elm_object_scale_get(const Evas_Object *obj);
|
||||||
EAPI void elm_object_style_set(Evas_Object *obj, const char *style);
|
EAPI void elm_object_style_set(Evas_Object *obj, const char *style);
|
||||||
EAPI const char *elm_object_style_get(const Evas_Object *obj);
|
EAPI const char *elm_object_style_get(const Evas_Object *obj);
|
||||||
|
EAPI void elm_object_disabled_set(Evas_Object *obj, Eina_Bool disabled);
|
||||||
|
EAPI Eina_Bool elm_object_disabled_get(const Evas_Object *obj);
|
||||||
|
|
||||||
EAPI double elm_scale_get(void);
|
EAPI double elm_scale_get(void);
|
||||||
EAPI void elm_scale_set(double scale);
|
EAPI void elm_scale_set(double scale);
|
||||||
|
|
|
@ -12,6 +12,7 @@ struct _Widget_Data
|
||||||
|
|
||||||
static void _del_hook(Evas_Object *obj);
|
static void _del_hook(Evas_Object *obj);
|
||||||
static void _theme_hook(Evas_Object *obj);
|
static void _theme_hook(Evas_Object *obj);
|
||||||
|
static void _disable_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);
|
||||||
static void _sub_del(void *data, Evas_Object *obj, void *event_info);
|
static void _sub_del(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
@ -48,6 +49,16 @@ _theme_hook(Evas_Object *obj)
|
||||||
_sizing_eval(obj);
|
_sizing_eval(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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->btn, "elm,state,disabled", "elm");
|
||||||
|
else
|
||||||
|
edje_object_signal_emit(wd->btn, "elm,state,enabled", "elm");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_sizing_eval(Evas_Object *obj)
|
_sizing_eval(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
@ -112,6 +123,7 @@ elm_button_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->btn = edje_object_add(e);
|
wd->btn = edje_object_add(e);
|
||||||
_elm_theme_set(wd->btn, "button", "base", "default");
|
_elm_theme_set(wd->btn, "button", "base", "default");
|
||||||
|
|
|
@ -985,6 +985,36 @@ elm_object_style_get(const Evas_Object *obj)
|
||||||
return elm_widget_style_get(obj);
|
return elm_widget_style_get(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the disable state
|
||||||
|
*
|
||||||
|
* This sets the disable state for the widget.
|
||||||
|
*
|
||||||
|
* @param obj The object
|
||||||
|
* @param disabled The state
|
||||||
|
* @ingroup Styles
|
||||||
|
*/
|
||||||
|
EAPI void
|
||||||
|
elm_object_disabled_set(Evas_Object *obj, Eina_Bool disabled)
|
||||||
|
{
|
||||||
|
elm_widget_disabled_set(obj, disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the disable state
|
||||||
|
*
|
||||||
|
* This gets the disable state for the widget.
|
||||||
|
*
|
||||||
|
* @param obj The object
|
||||||
|
* @return True, if the widget is disabled
|
||||||
|
* @ingroup Styles
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool
|
||||||
|
elm_object_disabled_get(const Evas_Object *obj)
|
||||||
|
{
|
||||||
|
return elm_widget_disabled_get(obj);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the global scaling factor
|
* Get the global scaling factor
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue