#define BACKWARD_ICON_1 "backward_1.png" #define BACKWARD_ICON_2 "backward_2.png" #define BUTTON(button_name, normal_image, press_image, l, r, t, b) \ group { \ name: "elm/button/base/wrt/"#button_name; \ images { \ image: normal_image COMP; \ image: press_image COMP; \ } \ styles { \ style { \ name: #button_name"btn_textblock_style"; \ base: "font=FONT_CONTENT font_size=20 align=center color=#4E4945 wrap=char"; \ tag: "br" "\n"; \ tag: "hilight" "+ font=FONT_CONTENT:style=Bold"; \ tag: "b" "+ font=FONT_CONTENT:style=Bold"; \ tag: "tab" "\t"; \ } \ } \ parts { \ part { \ name: "button_image"; \ mouse_events: 1; \ effect: SOFT_SHADOW; \ description { \ state: "default" 0.0; \ image { \ normal: normal_image; \ border: l r t b; \ } \ } \ description { \ state: "clicked" 0.0; \ inherit: "default" 0.0; \ image.normal: press_image; \ } \ description { \ state: "disabled" 0.0; \ inherit: "default" 0.0; \ image.normal: normal_image; \ } \ } \ part { \ name: "elm.text"; \ type: TEXTBLOCK; \ effect: SHADOW; \ mouse_events: 0; \ scale: 1; \ description { \ state: "default" 0.0; \ visible: 0; \ fixed: 1 1; \ align: 0.5 0.5; \ rel1 { relative: 0.1 0; to: "button_image"; } \ rel2 { relative: 0.9 1; to: "button_image"; } \ color: 0 0 0 255; \ text { \ style: #button_name"btn_textblock_style"; \ min: 0 0; \ max: 0 1; \ } \ } \ description { \ state: "visible" 0.0; \ inherit: "default" 0.0; \ visible: 1; \ min: 1 1; \ } \ description { \ state: "clicked" 0.0; \ inherit: "default" 0.0; \ visible: 1; \ 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; \ min: 1 1; \ } \ } \ part { \ name: "over1"; \ mouse_events: 0; \ description { \ state: "default" 0.0; \ rel2.relative: 1.0 0.5; \ } \ description { \ state: "disabled" 0.0; \ inherit: "default" 0.0; \ } \ } \ part { \ name: "over2"; \ mouse_events: 1; \ repeat_events: 1; \ ignore_flags: ON_HOLD; \ description { \ state: "default" 0.0; \ } \ description { \ state: "disabled" 0.0; \ inherit: "default" 0.0; \ visible: 0; \ } \ } \ part { \ name: "over3"; \ mouse_events: 1; \ repeat_events: 1; \ description { \ state: "default" 0.0; \ color: 255 255 255 0; \ } \ description { \ state: "clicked" 0.0; \ inherit: "default" 0.0; \ visible: 1; \ color: 255 255 255 0; \ } \ } \ 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 { \ program { \ name: "button_click"; \ signal: "mouse,down,1"; \ source: "over2"; \ action: SIGNAL_EMIT "elm,action,press" ""; \ after: "button_click_anim"; \ } \ program { \ name: "button_click_anim"; \ action: STATE_SET "clicked" 0.0; \ target: "button_image"; \ target: "elm.text"; \ } \ program { \ name: "button_unclick"; \ signal: "mouse,up,1"; \ source: "over2"; \ action: SIGNAL_EMIT "elm,action,unpress" ""; \ after: "button_unclick_anim"; \ } \ program { \ name: "button_unclick_anim"; \ action: STATE_SET "default" 0.0; \ target: "button_image"; \ action: STATE_SET "visible" 0.0; \ target: "elm.text"; \ } \ program { \ name: "button_mouseout_clicked"; \ signal: "mouse,out"; \ source: "over2"; \ script { \ new st[31]; \ new Float:vl; \ get_state(PART:"elm.text", st, 30, vl); \ if (!strcmp(st, "clicked")) \ { \ set_state(PART:"elm.text", "visible", 0.0); \ set_state(PART:"button_image", "visible", 0.0); \ } \ } \ } \ program { \ name: "button_click2"; \ signal: "mouse,down,1"; \ source: "over3"; \ action: STATE_SET "clicked" 0.0; \ target: "over3"; \ } \ program { \ name: "button_unclick2"; \ signal: "mouse,clicked,1"; \ source: "over3"; \ action: STATE_SET "default" 0.0; \ target: "over3"; \ } \ program { \ name: "button_unclick3"; \ signal: "mouse,clicked,1"; \ source: "over2"; \ action: SIGNAL_EMIT "elm,action,click" ""; \ } \ program { \ name: "text_show"; \ signal: "elm,state,text,visible"; \ source: "elm"; \ action: STATE_SET "visible" 0.0; \ target: "elm.text"; \ } \ program { \ name: "text_hide"; \ signal: "elm,state,text,hidden"; \ source: "elm"; \ action: STATE_SET "default" 0.0; \ target: "elm.text"; \ } \ 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); \ } \ } \ } \ } collections { BUTTON(backward, BACKWARD_ICON_1, BACKWARD_ICON_2, 0, 0, 0, 0); }