#define BUTTON_TABLE_ITEM(pname, x, y, w, h) \ item { \ type: GROUP; \ source: pname; \ weight: 0.5 0.5; \ align: -1 -1; \ position: x y; \ span: w h; \ } #define BUTTON(pname, label, emits) \ group { name: "button/"pname; \ images { \ image: "btn_normal.png" COMP; \ image: "btn_pressed.png" COMP; \ } \ parts { \ part { name: "button_image"; \ mouse_events: 1; \ description { state: "default" 0.0; \ rel1.offset: 3 3; \ rel2.offset: -4 -4; \ image { \ normal: "btn_normal.png"; \ border: 7 7 7 7; \ } \ \ } \ description { state: "clicked" 0.0; \ inherit: "default" 0.0; \ image.normal: "btn_pressed.png"; \ image.border: 7 7 7 7; \ } \ } \ \ part { \ name: "elm.text"; \ type: TEXT; \ effect: SHADOW; \ mouse_events: 0; \ scale: 1; \ description { state: "default" 0.0; \ visible: 1; \ rel1.offset: 4 4; \ rel2.offset: -5 -5; \ color: 255 255 255 240; \ color3: 20 20 20 128; \ /* color: 172 179 191 255; */ \ /* color3: 0 0 0 30; */ \ text { \ font: "Sans"; \ size: 25; \ min: 1 1; \ align: 0.5 0.5; \ text_class: "button"; \ text: label; \ } \ } \ } \ part { \ name: "over1"; \ mouse_events: 0; \ type: RECT; \ description { \ state: "default" 0.0; \ rel2.relative: 1.0 0.5; \ color: 0 0 0 0; \ } \ description { state: "disabled" 0.0; \ inherit: "default" 0.0; \ } \ } \ part { name: "over2"; \ mouse_events: 1; \ repeat_events: 1; \ ignore_flags: ON_HOLD; \ type: RECT; \ description { \ state: "default" 0.0; \ color: 0 0 0 0; \ } \ description { \ state: "disabled" 0.0; \ inherit: "default" 0.0; \ visible: 0; \ } \ } \ part { name: "over3"; \ mouse_events: 1; \ repeat_events: 1; \ type: RECT; \ description { state: "default" 0.0; \ color: 255 255 255 0; \ } \ description { state: "clicked" 0.0; \ inherit: "default" 0.0; \ color: 255 255 255 0; \ } \ } \ \ \ } \ programs { \ program { \ name: "button_click"; \ signal: "mouse,down,1"; \ source: "over2"; \ action: STATE_SET "clicked" 0.0; \ target: "button_image"; \ } \ \ program { \ name: "button_unclick"; \ signal: "mouse,up,1"; \ source: "over3"; \ action: STATE_SET "default" 0.0; \ target: "button_image"; \ } \ program { \ name: "button_click2"; \ signal: "mouse,down,1"; \ source: "over3"; \ action: STATE_SET "clicked" 0.0; \ target: "over3"; \ } \ program { \ name: "button_unclick2"; \ signal: "mouse,up,1"; \ source: "over3"; \ action: STATE_SET "default" 0.0; \ transition: DECELERATE 0.5; \ target: "over3"; \ } \ program { \ name: "button_unclick3"; \ signal: "mouse,clicked,1"; \ source: "over2"; \ action: SIGNAL_EMIT emits ""; \ } \ } \ } images { image: "bg.png" COMP; image: "shading.png" COMP; image: "brushed_texture.png" COMP; image: "metalsphere.png" COMP; image: "entry_disabled.png" COMP; image: "entry_light_overlay.png" COMP; } collections { BUTTON("add", "+", "OP_ADD"); BUTTON("min", "-", "OP_SUB"); BUTTON("mul", "*", "OP_MUT"); BUTTON("div", "/", "OP_DIV"); BUTTON("seven", "7", "NUM_7"); BUTTON("height", "8", "NUM_8"); BUTTON("nine", "9", "NUM_9"); BUTTON("clear", "C", "OP_CLR"); BUTTON("four", "4", "NUM_4"); BUTTON("five", "5", "NUM_5"); BUTTON("six", "6", "NUM_6"); BUTTON("obrak", "(", "OP_OBRAK"); BUTTON("one", "1", "NUM_1"); BUTTON("two", "2", "NUM_2"); BUTTON("three", "3", "NUM_3"); BUTTON("cbrak", ")", "OP_CBRAK"); BUTTON("zero", "0", "NUM_0"); BUTTON("point", ".", "OP_DEC"); BUTTON("equal", "=", "OP_EQU"); group { name: "Main"; parts { part { name: "bg"; type: RECT; mouse_events: 0; description { state: "default" 0.0; visible: 1; color: 255 255 255 255; } } part { name: "EquateAnswer"; type: TEXT; mouse_events: 0; description { state: "default" 0.0; visible: 1; rel1 { relative: 0.0 0.0; offset: 2 0; } rel2 { relative: 1.0 0.0; offset: -1 0; } fixed: 1 1; align: 0.5 0; color: 0 0 0 255; color3: 192 192 192 255; text { text: ""; font: "Sans"; size: 30; //fit: 0 0; min: 1 1; align: 1.0 0.5; } } } part { name : "table_description"; type : TABLE; description { state : "default" 0.0; fixed: 0 1; rel1.to: "EquateAnswer"; rel1.relative: 0 1; table { homogeneous: TABLE; padding: 0 0; } } table { items { BUTTON_TABLE_ITEM("button/add", 0, 0, 1, 1); BUTTON_TABLE_ITEM("button/min", 1, 0, 1, 1); BUTTON_TABLE_ITEM("button/mul", 2, 0, 1, 1); BUTTON_TABLE_ITEM("button/div", 3, 0, 1, 1); BUTTON_TABLE_ITEM("button/seven", 0, 1, 1, 1); BUTTON_TABLE_ITEM("button/height", 1, 1, 1, 1); BUTTON_TABLE_ITEM("button/nine", 2, 1, 1, 1); BUTTON_TABLE_ITEM("button/clear", 3, 1, 1, 1); BUTTON_TABLE_ITEM("button/four", 0, 2, 1, 1); BUTTON_TABLE_ITEM("button/five", 1, 2, 1, 1); BUTTON_TABLE_ITEM("button/six", 2, 2, 1, 1); BUTTON_TABLE_ITEM("button/obrak", 3, 2, 1, 1); BUTTON_TABLE_ITEM("button/one", 0, 3, 1, 1); BUTTON_TABLE_ITEM("button/two", 1, 3, 1, 1); BUTTON_TABLE_ITEM("button/three", 2, 3, 1, 1); BUTTON_TABLE_ITEM("button/cbrak", 3, 3, 1, 1); BUTTON_TABLE_ITEM("button/zero", 0, 4, 1, 1); BUTTON_TABLE_ITEM("button/point", 1, 4, 1, 1); BUTTON_TABLE_ITEM("button/equal", 2, 4, 2, 1); } } } } }