}
}
}
-
-group { name: "elm/button/base/toolbar/default";
- images {
- image: "toolbar_sel.png" COMP;
- }
- data.item: "transition_animation_on" "1";
- parts {
- part { name: "label2";
- type: TEXT;
- mouse_events: 0;
- scale: 1;
- clip_to: "elm.text.clipper";
- description { state: "default" 0.0;
- align: 0.5 1.0;
- fixed: 0 1;
- rel1.to: "elm.text";
- rel2.to: "elm.text";
- color: 0 0 0 255;
- text {
- font: "Sans";
- text_source: "elm.text";
- size: 10;
- min: 1 1;
- align: 0.5 0.5;
- text_class: "toolbar_item";
- }
- }
- description { state: "selected" 0.0;
- inherit: "default" 0.0;
- visible: 0;
- }
- 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: "label2_new";
- type: TEXT;
- mouse_events: 0;
- scale: 1;
- clip_to: "elm.text_new.clipper";
- description { state: "default" 0.0;
- align: 0.5 1.0;
- fixed: 0 1;
- rel1.to: "elm.text_new";
- rel2.to: "elm.text_new";
- color: 0 0 0 255;
- text {
- font: "Sans";
- text_source: "elm.text_new";
- size: 10;
- min: 1 1;
- align: 0.5 0.5;
- text_class: "toolbar_item";
- }
- }
- description { state: "selected" 0.0;
- inherit: "default" 0.0;
- visible: 0;
- }
- 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: "bg";
- mouse_events: 0;
- description { state: "default" 0.0;
- visible: 0;
- color: 255 255 255 0;
- image {
- normal: "toolbar_sel.png";
- border: 3 3 0 0;
- }
- image.middle: SOLID;
- fill.smooth: 0;
- }
- description { state: "selected" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- color: 255 255 255 255;
- }
- description { state: "disabled" 0.0;
- inherit: "default" 0.0;
- visible: 0;
- color: 255 255 255 0;
- }
- }
- part { name: "elm.swallow.content";
- type: SWALLOW;
- clip_to: "elm.icon.clipper";
- description { state: "default" 0.0;
- align: 0.5 0.5;
- fixed: 0 0;
- rel1 {
- relative: 0.0 0.0;
- offset: 2 2;
- }
- rel2 {
- to_y: "elm.text";
- relative: 1.0 0.0;
- offset: -3 -1;
- }
- color: 0 0 0 0;
- }
- }
- part { name: "elm.swallow.content_new";
- type: SWALLOW;
- clip_to: "elm.icon_new.clipper";
- description { state: "default" 0.0;
- align: 0.5 0.5;
- fixed: 0 0;
- rel1 {
- relative: 0.0 0.0;
- offset: 2 2;
- }
- rel2 {
- to_y: "elm.text_new";
- relative: 1.0 0.0;
- offset: -3 -1;
- }
- color: 0 0 0 0;
- }
- }
- part { name: "elm.text";
- type: TEXT;
- effect: SOFT_SHADOW;
- mouse_events: 0;
- scale: 1;
- clip_to: "elm.text.clipper";
- description { state: "default" 0.0;
- align: 0.5 1.0;
- fixed: 0 1;
- rel1 {
- relative: 0.0 1.0;
- offset: 0 -1;
- }
- rel2 {
- relative: 1.0 1.0;
- offset: -1 -1;
- }
- visible: 0;
- color: 224 224 224 255;
- color3: 0 0 0 32;
- text {
- font: "Sans:style=Bold";
- size: 10;
- min: 1 1;
- align: 0.5 0.5;
- text_class: "toolbar_item";
- }
- }
- description { state: "selected" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 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: "elm.text_new";
- type: TEXT;
- effect: SOFT_SHADOW;
- mouse_events: 0;
- clip_to: "elm.text_new.clipper";
- scale: 1;
- description { state: "default" 0.0;
- align: 0.5 1.0;
- fixed: 0 1;
- rel1 {
- relative: 0.0 1.0;
- offset: 0 -1;
- }
- rel2 {
- relative: 1.0 1.0;
- offset: -1 -1;
- }
- visible: 0;
- color: 224 224 224 255;
- color3: 0 0 0 32;
- text {
- font: "Sans:style=Bold";
- size: 10;
- min: 1 1;
- align: 0.5 0.5;
- text_class: "toolbar_item";
- }
- }
- description { state: "selected" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 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: "elm.text.clipper";
- type: RECT;
- description { state: "default" 0.0;
- color: 255 255 255 255;
- }
- description { state: "animation" 0.0;
- color: 255 255 255 0;
- }
- }
- part { name: "elm.text_new.clipper";
- type: RECT;
- description { state: "default" 0.0;
- color: 255 255 255 0;
- }
- description { state: "animation" 0.0;
- color: 255 255 255 255;
- }
- }
- part { name: "elm.icon.clipper";
- type: RECT;
- description { state: "default" 0.0;
- color: 255 255 255 255;
- }
- description { state: "animation" 0.0;
- color: 255 255 255 0;
- }
- }
- part { name: "elm.icon_new.clipper";
- type: RECT;
- description { state: "default" 0.0;
- color: 255 255 255 0;
- }
- description { state: "animation" 0.0;
- color: 255 255 255 255;
- }
- }
- part { name: "event";
- type: RECT;
- mouse_events: 1;
- ignore_flags: ON_HOLD;
- description { state: "default" 0.0;
- color: 0 0 0 0;
- }
- }
- }
- programs {
- program { name: "go_active";
- signal: "elm,state,selected";
- source: "elm";
- action: STATE_SET "selected" 0.0;
- target: "bg";
- target: "elm.text";
- target: "label2";
- target: "elm.text_new";
- target: "label2_new";
- transition: LINEAR 0.2;
- }
- program { name: "go_passive";
- signal: "elm,state,unselected";
- source: "elm";
- action: STATE_SET "default" 0.0;
- target: "bg";
- target: "elm.text";
- target: "label2";
- target: "elm.text_new";
- target: "label2_new";
- transition: LINEAR 0.1;
- }
- program { name: "go";
- signal: "mouse,up,1";
- source: "event";
- action: SIGNAL_EMIT "elm,action,click" "elm";
- }
- program { name: "mouse,in";
- signal: "mouse,in";
- source: "event";
- action: SIGNAL_EMIT "elm,mouse,in" "elm";
- }
- program { name: "mouse,out";
- signal: "mouse,out";
- source: "event";
- action: SIGNAL_EMIT "elm,mouse,out" "elm";
- }
- program { name: "disable";
- signal: "elm,state,disabled";
- source: "elm";
- action: STATE_SET "disabled" 0.0;
- target: "label2";
- target: "label2_new";
- target: "bg";
- 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);
- set_state(PART:"elm.text_new", "disabled_visible", 0.0);
- }
- else
- {
- set_state(PART:"elm.text", "disabled", 0.0);
- set_state(PART:"elm.text_new", "disabled", 0.0);
- }
- }
- }
- program { name: "enable";
- signal: "elm,state,enabled";
- source: "elm";
- action: STATE_SET "default" 0.0;
- target: "label2";
- target: "label2_new";
- target: "bg";
- 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);
- set_state(PART:"elm.text_new", "visible", 0.0);
- }
- else
- {
- set_state(PART:"elm.text", "default", 0.0);
- set_state(PART:"elm.text_new", "default", 0.0);
- }
- }
- }
- program { name: "label_set,animation,forward";
- signal: "elm,state,label_set,forward";
- source: "elm";
- after: "label_set,animation";
- }
- program { name: "label_set,animation,backward";
- signal: "elm,state,label_set,backward";
- source: "elm";
- after: "label_set,animation";
- }
- program { name: "label_set,animation";
- signal: "elm,state,label_set";
- source: "elm";
- action: STATE_SET "animation" 0.0;
- target: "elm.text.clipper";
- target: "elm.text_new.clipper";
- transition: LINEAR 0.2;
- after: "label_set,animation,done";
- }
- program { name: "label_set,animation,done";
- action: SIGNAL_EMIT "elm,state,label_set,done" "elm";
- }
- program { name: "label,reset";
- signal: "elm,state,label,reset";
- source: "elm";
- action: STATE_SET "default" 0.0;
- target: "elm.text.clipper";
- target: "elm.text_new.clipper";
- }
- program { name: "icon_set,animation,forward";
- signal: "elm,state,icon_set,forward";
- source: "elm";
- after: "icon_set,animation";
- }
- program { name: "icon_set,animation,backward";
- signal: "elm,state,icon_set,backward";
- source: "elm";
- after: "icon_set,animation";
- }
- program { name: "icon_set,animation";
- signal: "elm,state,icon_set";
- source: "elm";
- action: STATE_SET "animation" 0.0;
- target: "elm.icon.clipper";
- target: "elm.icon_new.clipper";
- transition: LINEAR 0.2;
- after: "icon_set,animation,done";
- }
- program { name: "icon_set,animation,done";
- action: SIGNAL_EMIT "elm,state,icon_set,done" "elm";
- }
- program { name: "icon,reset";
- signal: "elm,state,icon,reset";
- source: "elm";
- action: STATE_SET "default" 0.0;
- target: "elm.icon.clipper";
- target: "elm.icon_new.clipper";
- }
- }
-}
-
-group { name: "elm/button/base/toolbar/item_horizontal";
- inherit: "elm/button/base/toolbar/default";
- parts {
- part { name: "elm.swallow.content";
- description { state: "default" 0.0;
- fixed: 1 1;
- aspect: 1 1;
- aspect_preference: VERTICAL;
- align: 0.0 0.5;
- rel1.offset: 3 3;
- rel1.relative: 0 0;
- rel2.offset: 3 -4;
- rel2.relative: 0 1;
- color: 0 0 0 0;
- }
- }
- part { name: "elm.swallow.content_new";
- description { state: "default" 0.0;
- fixed: 1 1;
- }
- }
- part { name: "elm.text";
- description { state: "default" 0.0;
- align: 1 0.5;
- min: 0 1;
- rel1.offset: 1 0;
- rel1.relative: 1.0 0.0;
- rel1.to_x: "elm.swallow.content";
- rel2.relative: 1.0 1.0;
- text.align: 0 0.5;
- }
- description { state: "selected" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 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: "elm.text_new";
- description { state: "default" 0.0;
- align: 1 0.5;
- min: 0 1;
- rel1.offset: 1 0;
- rel1.relative: 1.0 0.0;
- rel1.to_x: "elm.swallow.content";
- rel2.relative: 1.0 1.0;
- text.align: 0 0.5;
- }
- description { state: "selected" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 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;
- }
- }
- }
-}
-
}
static void
-_content_set_update(void *data)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (wd->icon)
- {
- elm_widget_sub_object_add(data, wd->icon);
- edje_object_part_swallow(wd->btn, "elm.swallow.content", wd->icon);
- edje_object_signal_emit(wd->btn, "elm,state,icon,visible", "elm");
- edje_object_message_signal_process(wd->btn);
- }
- _sizing_eval(data);
-}
-
-static void
-_content_set_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Evas_Object *old_icon = edje_object_part_swallow_get(wd->btn, "elm.swallow.content");
- if ((old_icon) && (wd->icon != old_icon))
- {
- evas_object_event_callback_del_full(old_icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_part_unswallow(wd->btn, old_icon);
- elm_widget_sub_object_del(data, old_icon);
- evas_object_del(old_icon);
- }
- _content_set_update(data);
- edje_object_signal_callback_del(obj, emission, source, _content_set_cb);
- edje_object_signal_emit(wd->btn, "elm,state,icon,reset", "elm");
-}
-
-static void
_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
{
- const char *s;
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (part && strcmp(part, "icon")) return;
if (wd->icon == content) return;
+ if (wd->icon) evas_object_del(wd->icon);
wd->icon = content;
-
- if(wd->icon)
- evas_object_event_callback_add(wd->icon,
+ if (content)
+ {
+ elm_widget_sub_object_add(obj, content);
+ evas_object_event_callback_add(content,
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
-
- s = edje_object_data_get(wd->btn, "transition_animation_on");
- if ((s) && (atoi(s)))
- {
- edje_object_part_swallow(wd->btn, "elm.swallow.content_new", wd->icon);
- edje_object_signal_emit(wd->btn, "elm,state,icon_set", "elm");
- edje_object_signal_callback_add(wd->btn,
- "elm,state,icon_set,done", "elm",
- _content_set_cb, obj);
+ edje_object_part_swallow(wd->btn, "elm.swallow.content", content);
+ edje_object_signal_emit(wd->btn, "elm,state,icon,visible", "elm");
+ edje_object_message_signal_process(wd->btn);
}
- else
- _content_set_update(obj);
+ _sizing_eval(obj);
}
static Evas_Object *
}
static void
-_elm_button_label_update(void *data)
-{
- Widget_Data *wd = elm_widget_data_get(data);
-
- if (wd->label)
- edje_object_signal_emit(wd->btn, "elm,state,text,visible", "elm");
- else
- edje_object_signal_emit(wd->btn, "elm,state,text,hidden", "elm");
- edje_object_message_signal_process(wd->btn);
- edje_object_part_text_set(wd->btn, "elm.text", wd->label);
- _sizing_eval(data);
-}
-
-static void
-_elm_button_label_set_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- _elm_button_label_update(data);
- edje_object_signal_callback_del(obj, emission, source,
- _elm_button_label_set_cb);
- edje_object_signal_emit(wd->btn, "elm,state,label,reset", "elm");
-}
-
-static void
_elm_button_label_set(Evas_Object *obj, const char *item, const char *label)
{
- const char *s;
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (item && strcmp(item, "default")) return;
if (!wd) return;
- if ((label) && ((wd->label) && (!strcmp(label, wd->label)))) return;
eina_stringshare_replace(&wd->label, label);
- s = edje_object_data_get(wd->btn, "transition_animation_on");
- if ((s) && (atoi(s)))
- {
- edje_object_part_text_set(wd->btn, "elm.text_new", wd->label);
- edje_object_signal_emit(wd->btn, "elm,state,label_set", "elm");
- edje_object_signal_callback_add(wd->btn,
- "elm,state,label_set,done", "elm",
- _elm_button_label_set_cb, obj);
- }
+ if (label)
+ edje_object_signal_emit(wd->btn, "elm,state,text,visible", "elm");
else
- _elm_button_label_update(obj);
+ edje_object_signal_emit(wd->btn, "elm,state,text,hidden", "elm");
+ edje_object_message_signal_process(wd->btn);
+ edje_object_part_text_set(wd->btn, "elm.text", label);
+ _sizing_eval(obj);
}
static const char *