summaryrefslogtreecommitdiff
path: root/2.3-wearable/widgets/label.edc
diff options
context:
space:
mode:
Diffstat (limited to '2.3-wearable/widgets/label.edc')
-rw-r--r--2.3-wearable/widgets/label.edc888
1 files changed, 888 insertions, 0 deletions
diff --git a/2.3-wearable/widgets/label.edc b/2.3-wearable/widgets/label.edc
new file mode 100644
index 00000000..816c5ce4
--- /dev/null
+++ b/2.3-wearable/widgets/label.edc
@@ -0,0 +1,888 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define SLIDE_SPEED_WEIGHT 0.5
+#define SLIDE_TEXT_GAP 60
+
+ styles {
+ style { name: "textblock_style";
+ base: "font=Tizen:style=Regular font_size="LABEL_FONT_SIZE_INC" color=#ffffff color_class=T122 text_class=T122";
+ tag: "br" "\n";
+ tag: "ps" "ps";
+ tag: "hilight" "+ font_weight=Bold";
+ tag: "b" "+ font_weight=Bold";
+ tag: "tab" "\t";
+ }
+ /* label doesn't use it */
+ style { name: "textblock_charwrap_style";
+base: "font=Tizen:style=Regular font_size="LABEL_FONT_SIZE_INC" color=#ffffff color_class=T122 text_class=T122";
+ tag: "br" "\n";
+ tag: "ps" "ps";
+ tag: "hilight" "+ font_weight=Bold";
+ tag: "b" "+ font_weight=Bold";
+ tag: "tab" "\t";
+ }
+ }
+
+ group { name: "elm/label/base/default";
+ parts {
+ part { name: "label.text.clip";
+ type: RECT;
+ description { state: "default" 0.0;
+ }
+ }
+ part { name: "elm.text";
+ type: TEXTBLOCK;
+ scale: 1;
+ clip_to: "label.text.clip";
+ description { state: "default" 0.0;
+ text {
+ style: "textblock_style";
+ min: 0 1;
+ align: 0.0 0.0;
+ }
+ }
+ }
+ }
+ }
+
+ /* default label doesn't use it */
+ group { name: "elm/label/base_wrap/default";
+ parts {
+ part { name: "elm.text";
+ type: TEXTBLOCK;
+ scale: 1;
+ multiline: 1;
+ description { state: "default" 0.0;
+ text {
+ style: "textblock_style";
+ min: 0 1;
+ align: 0.0 0.0;
+ }
+ }
+ description { state: "charwrap_mode" 0.0;
+ text {
+ style: "textblock_charwrap_style";
+ min: 0 1;
+ align: 0.0 0.0;
+ }
+ }
+ }
+ }
+ programs {
+ program { name: "default_on";
+ signal: "elm,state,default";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.text";
+ }
+ program { name: "charwrap_on";
+ signal: "elm,state,charwrap";
+ source: "elm";
+ action: STATE_SET "charwrap_mode" 0.0;
+ target: "elm.text";
+ }
+ } // end programs
+ } // end group
+
+ /* default label doesn't use it */
+ group { name: "elm/label/base_wrap_ellipsis/default";
+ parts {
+ part { name: "elm.text";
+ type: TEXTBLOCK;
+ scale: 1;
+ multiline: 1;
+ description { state: "default" 0.0;
+ // FIXME : fixed for multiline ellipsis.
+ // does it need to make another ellipsis style?
+ fixed: 0 1;
+ text {
+ style: "textblock_style";
+ min: 0 1;
+ align: 0.0 0.0;
+ }
+ }
+ description { state: "charwrap_mode" 0.0;
+ // FIXME : fixed for multiline ellipsis.
+ // does it need to make another ellipsis style?
+ fixed: 0 1;
+ text {
+ style: "textblock_charwrap_style";
+ min: 0 1;
+ align: 0.0 0.0;
+ }
+ }
+ }
+ }
+ programs {
+ program { name: "default_on";
+ signal: "elm,state,default";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "elm.text";
+ }
+ program { name: "charwrap_on";
+ signal: "elm,state,charwrap";
+ source: "elm";
+ action: STATE_SET "charwrap_mode" 0.0;
+ target: "elm.text";
+ }
+ } // end programs
+ } // end group
+
+ group { name: "elm/label/base/marker";
+ styles {
+ style { name: "textblock_style2";
+ base: "font=Tizen:style=Bold font_size=14 align=center color=#fff wrap=word text_class=tizen";
+ tag: "br" "\n";
+ tag: "ps" "ps";
+ tag: "hilight" "+ color=#ffff";
+ tag: "b" "+ color=#ffff";
+ tag: "tab" "\t";
+ }
+ }
+ parts {
+ part { name: "elm.text";
+ type: TEXTBLOCK;
+ scale: 1;
+ description { state: "default" 0.0;
+ text {
+ style: "textblock_style2";
+ min: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ }
+ }
+ }
+
+ /* default label doesn't use it */
+ group { name: "elm/label/base_wrap/marker";
+ parts {
+ part { name: "elm.text";
+ type: TEXTBLOCK;
+ scale: 1;
+ multiline: 1;
+ description { state: "default" 0.0;
+ text {
+ style: "textblock_style2";
+ min: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ }
+ }
+ }
+
+ /* actionbar title textblock */
+ group { name: "elm/label/base/actionbar_title";
+ images {
+ image: "tw_action_text_fadeout_left_holo_dark.png" COMP;
+ image: "tw_action_text_fadeout_right_holo_dark.png" COMP;
+ }
+ script {
+ public g_mirrored = 0; //Mirrored on/off status
+
+ public title_text_fade_out() {
+ new x, y, w, h, w2;
+ get_geometry(PART:"elm.text", x, y, w, h);
+ get_geometry(PART:"base", x, y, w2, h);
+
+ if (w > w2) {
+ if (g_mirrored)
+ set_state(PART:"title_text_fade_out_effect_right", "show_mirrored", 0.0);
+ else
+ set_state(PART:"title_text_fade_out_effect_right", "show", 0.0);
+ }
+ else
+ set_state(PART:"title_text_fade_out_effect_right", "default", 0.0);
+ }
+ }
+ parts {
+ part { name: "base";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ }
+ }
+ part { name: "elm.text";
+ type: TEXTBLOCK;
+ scale: 1;
+ description { state: "default" 0.0;
+ text {
+ style: "action_bar_title";
+ }
+ rel1.to: "base";
+ rel2.to: "base";
+ }
+ }
+ part { name: "title_text_fade_out_effect_right";
+ type: IMAGE;
+ scale: 1;
+ description { state: "default" 0.0;
+ min: 0 0;
+ max: 0 -1;
+ align: 1.0 0.5;
+ fixed: 1 0;
+ visible: 0;
+ rel1 { relative: 0.0 0.0; to: "base"; }
+ rel2 { relative: 0.0 1.0; to: "base"; }
+ color_class: "B0511";
+ image.normal: "tw_action_text_fadeout_right_holo_dark.png";
+ }
+ description { state: "show" 0.0;
+ inherit: "default" 0.0;
+ min: ACTIONBAR_FADE_WIDTH ACTIONBAR_HEIGHT;
+ max: ACTIONBAR_FADE_WIDTH ACTIONBAR_HEIGHT;
+ visible: 1;
+ }
+ description { state: "show_mirrored" 0.0;
+ inherit: "default" 0.0;
+ min: ACTIONBAR_FADE_WIDTH ACTIONBAR_HEIGHT;
+ max: ACTIONBAR_FADE_WIDTH ACTIONBAR_HEIGHT;
+ visible: 1;
+ image.normal: "tw_action_text_fadeout_left_holo_dark.png";
+ }
+ }
+ }
+ programs {
+ program {
+ name: "mirrored_on";
+ signal: "edje,state,rtl";
+ source: "edje";
+ script {
+ set_int(g_mirrored, 1);
+ title_text_fade_out();
+ }
+ }
+ program {
+ name: "mirrored_off";
+ signal: "edje,state,ltr";
+ source: "edje";
+ script {
+ set_int(g_mirrored, 0);
+ title_text_fade_out();
+ }
+ }
+ }
+ }
+
+ group { name: "elm/label/base/slide_long";
+ script {
+ public g_duration = 0, g_stopslide, g_timer_id, g_anim_id;
+
+ public message(Msg_Type:type, id, ...) {
+ if (type == MSG_FLOAT_SET) {
+ new Float:duration;
+ duration = getfarg(2);
+ if (id == 0)
+ set_float(g_duration, duration);
+ else
+ set_float(g_duration, duration / LABEL_FONT_SIZE_INC * SLIDE_SPEED_WEIGHT);
+ }
+ }
+ public slide_to_end_anim(val, Float:pos) {
+ new stopflag;
+ new id;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1) return;
+ set_tween_state(PART:"elm.text", pos, "slide_begin", 0.0, "slide_end", 0.0);
+ if (pos >= 1.0) {
+ id = timer(0.5, "slide_to_begin", 1);
+ set_int(g_timer_id, id);
+ }
+ }
+ public slide_to_end() {
+ new stopflag;
+ new id;
+ new Float:duration;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1) return;
+ duration = get_float(g_duration);
+ id = anim(duration, "slide_to_end_anim", 1);
+ set_int(g_anim_id, id);
+ }
+ public slide_to_begin() {
+ new stopflag;
+ new id;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1) return;
+ set_state(PART:"elm.text", "slide_begin", 0.0);
+ id = timer(0.5, "slide_to_end", 1);
+ set_int(g_timer_id, id);
+ }
+ public start_slide() {
+ set_int(g_stopslide, 0);
+ set_state(PART:"elm.text", "slide_begin", 0.0);
+ slide_to_end();
+ }
+ public stop_slide() {
+ new id;
+ set_int(g_stopslide, 1);
+ id = get_int(g_anim_id);
+ cancel_anim(id);
+ id = get_int(g_timer_id);
+ cancel_timer(id);
+ set_state(PART:"elm.text", "default", 0.0);
+ }
+ }
+
+ parts {
+ part { name: "label.text.clip";
+ type: RECT;
+ description { state: "default" 0.0;
+ }
+ }
+ part { name: "elm.text";
+ type: TEXTBLOCK;
+ scale: 1;
+ clip_to: "label.text.clip";
+ description { state: "default" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 1.0 1.0;
+ align: 0.0 0.0;
+ text {
+ style: "textblock_style";
+ min: 0 1;
+ align: 0.0 0.0;
+ }
+ }
+ description { state: "slide_end" 0.0;
+ inherit: "default" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 0.0 1.0;
+ align: 1.0 0.0;
+ text {
+ style: "textblock_style";
+ min: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ description { state: "slide_begin" 0.0;
+ inherit: "default" 0.0;
+ rel1.relative: 1.0 0.0;
+ rel2.relative: 1.0 1.0;
+ align: 0.0 0.0;
+ text {
+ style: "textblock_style";
+ min: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ }
+ }
+ programs {
+ program { name: "start_slide";
+ source: "elm";
+ signal: "elm,state,slide,start";
+ script {
+ start_slide();
+ }
+ }
+ program { name: "stop_slide";
+ source: "elm";
+ signal: "elm,state,slide,stop";
+ script {
+ stop_slide();
+ }
+ }
+ }
+ }
+ group { name: "elm/label/base/slide_roll";
+ script {
+ public g_duration = 0;
+ public g_stopslide = 0;
+ public g_timer_id = 0;
+ public g_anim_id = 0;
+ public g_tb_w = 0;
+ public g_tb_h = 0;
+ public org_text = 0;
+ public message(Msg_Type:type, id, ...) {
+ if (type == MSG_FLOAT_SET) {
+ new Float:duration;
+ duration = getfarg(2);
+ if (id == 0)
+ set_float(g_duration, duration);
+ else
+ set_float(g_duration, duration / LABEL_FONT_SIZE_INC * SLIDE_SPEED_WEIGHT);
+ }
+ }
+ public get_tb_width() {
+ new x, y, w, h;
+ set_state(PART:"elm.text", "no_ellipsis", 0.0);
+ get_geometry(PART:"elm.text", x, y, w, h);
+ set_int(g_tb_w, w);
+ set_int(g_tb_h, h);
+ set_state(PART:"text_clip", "default", 0.0);
+ get_geometry(PART:"text_clip", x, y, w, h);
+ set_int(org_text, w);
+ }
+ public slide_to_end_anim(val, Float:pos) {
+ if (get_int(g_stopslide)) return;
+ set_tween_state(PART:"elm.text.slide", pos, "slide_begin", 0.0, "slide_end", 0.0);
+ set_tween_state(PART:"elm.text.slide2", pos, "slide_begin", 0.0, "slide_end", 0.0);
+ if (pos >= 1.0) {
+ set_int(g_timer_id, timer(1.5, "start_slide", 0));
+ }
+ }
+ public slide_to_end() {
+ if (get_int(g_stopslide)) return;
+ set_int(g_anim_id, anim(get_float(g_duration), "slide_to_end_anim", 0));
+ }
+ public start_slide(val) {
+ new Float:len;
+ new buf[1024];
+ set_int(g_stopslide, 0);
+ get_tb_width();
+ if (!get_float(g_duration)) {
+ len = get_int(g_tb_w) + SLIDE_TEXT_GAP;
+ set_float(g_duration, len / get_int(g_tb_h) * SLIDE_SPEED_WEIGHT);
+ }
+ if(get_int(g_tb_w) > get_int(org_text)) {
+ set_state(PART:"elm.text.slide", "slide_begin", 0.0);
+ set_state(PART:"elm.text.slide2", "slide_begin", 0.0);
+ get_text(PART:"elm.text", buf, 1024);
+ set_text(PART:"elm.text.slide", buf);
+ set_text(PART:"elm.text.slide2", buf);
+ set_state(PART:"text_clip", "hide", 0.0);
+ set_state(PART:"slide_text_clip", "show", 0.0);
+ slide_to_end();
+ }
+ }
+ public stop_slide() {
+ new slide_start_timer;
+ new slide_anim_id;
+ set_int(g_stopslide, 1);
+ slide_start_timer = get_int(g_timer_id);
+ if (slide_start_timer) {
+ cancel_timer(slide_start_timer);
+ set_int(g_timer_id, 0);
+ }
+ slide_anim_id = get_int(g_anim_id);
+ if (slide_anim_id) {
+ cancel_anim(slide_anim_id);
+ set_int(g_anim_id, 0);
+ }
+ set_text(PART:"elm.text.slide", "");
+ set_text(PART:"elm.text.slide2", "");
+ set_state(PART:"elm.text", "default", 0.0);
+ set_state(PART:"elm.text.slide", "default", 0.0);
+ set_state(PART:"elm.text.slide2", "default", 0.0);
+ set_state(PART:"text_clip", "default", 0.0);
+ set_state(PART:"slide_text_clip", "default", 0.0);
+ }
+ }
+ parts {
+ part { name: "label.text.clip";
+ type: RECT;
+ description { state: "default" 0.0;
+ }
+ }
+ part { name: "text_clip";
+ type: RECT;
+ mouse_events: 0;
+ clip_to: "label.text.clip";
+ description { state: "default" 0.0;
+ }
+ description { state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part { name: "elm.text";
+ type: TEXTBLOCK;
+ scale: 1;
+ clip_to: "text_clip";
+ description { state: "default" 0.0;
+ align: 0.0 0.5;
+ text {
+ style: "textblock_style";
+ min: 0 1;
+ }
+ }
+ description { state: "no_ellipsis" 0.0;
+ inherit: "default" 0.0;
+ text.min: 1 1;
+ }
+ }
+ part { name: "slide_text_clip";
+ type: RECT;
+ mouse_events: 0;
+ clip_to: "label.text.clip";
+ description { state: "default" 0.0;
+ visible: 0;
+ }
+ description { state: "show" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ }
+ part { name: "slide_text_gap";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 0;
+ min: SLIDE_TEXT_GAP 0;
+ max: SLIDE_TEXT_GAP -1;
+ align: 1.0 0.5;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 0.0 1.0;
+ }
+ }
+ part { name: "elm.text.slide";
+ type: TEXTBLOCK;
+ scale: 1;
+ clip_to: "slide_text_clip";
+ description { state: "default" 0.0;
+ align: 0.0 0.5;
+ text {
+ style: "textblock_style";
+ min: 0 1;
+ }
+ }
+ description { state: "slide_begin" 0.0;
+ inherit: "default" 0.0;
+ text.min: 1 1;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 0.0 1.0;
+ }
+ description { state: "slide_end" 0.0;
+ inherit: "default" 0.0;
+ align: 1.0 0.5;
+ text.min: 1 1;
+ text.align: 1.0 0.5;
+ rel1 { relative: 0.0 0.0; to: "slide_text_gap"; }
+ rel2 { relative: 0.0 1.0; to: "slide_text_gap"; }
+ }
+ }
+ part { name: "slide_text_gap2";
+ type: SPACER;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 1 0;
+ min: SLIDE_TEXT_GAP 0;
+ max: SLIDE_TEXT_GAP -1;
+ align: 0.0 0.5;
+ rel1 { relative: 1.0 0.0; to: "elm.text"; }
+ rel2 { relative: 1.0 1.0; to: "elm.text"; }
+ }
+ }
+ part { name: "elm.text.slide2";
+ type: TEXTBLOCK;
+ scale: 1;
+ clip_to: "slide_text_clip";
+ description { state: "default" 0.0;
+ align: 0.0 0.5;
+ text {
+ style: "textblock_style";
+ min: 1 1;
+ }
+ }
+ description { state: "slide_begin" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: 1.0 0.0; to: "slide_text_gap2"; }
+ rel2 { relative: 1.0 1.0; to: "slide_text_gap2"; }
+ }
+ description { state: "slide_end" 0.0;
+ inherit: "default" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 0.0 1.0;
+ }
+ }
+ }
+ programs {
+ program { name: "start_slide";
+ source: "elm";
+ signal: "elm,state,slide,start";
+ script {
+ run_program(PROGRAM:"stop_slide");
+ set_int(g_timer_id, timer(1.5, "start_slide", 0));
+ }
+ }
+ program { name: "stop_slide";
+ source: "elm";
+ signal: "elm,state,slide,stop";
+ script {
+ stop_slide();
+ }
+ }
+ }
+ }
+ group { name: "elm/label/base/slide_short";
+ script {
+ public g_duration = 0, g_stopslide, g_timer_id, g_anim_id;
+
+ public message(Msg_Type:type, id, ...) {
+ if (type == MSG_FLOAT_SET) {
+ new Float:duration;
+ duration = getfarg(2);
+ if (id == 0)
+ set_float(g_duration, duration);
+ else
+ set_float(g_duration, duration / LABEL_FONT_SIZE_INC * SLIDE_SPEED_WEIGHT);
+ }
+ }
+ public slide_to_end_anim(val, Float:pos) {
+ new stopflag;
+ new id;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1) return;
+ set_tween_state(PART:"elm.text", pos, "slide_begin", 0.0, "slide_end", 0.0);
+ if (pos >= 1.0) {
+ id = timer(0.5, "slide_to_begin", 1);
+ set_int(g_timer_id, id);
+ }
+ }
+ public slide_to_end() {
+ new stopflag;
+ new id;
+ new Float:duration;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1) return;
+ duration = get_float(g_duration);
+ id = anim(duration, "slide_to_end_anim", 1);
+ set_int(g_anim_id, id);
+ }
+ public slide_to_begin() {
+ new stopflag;
+ new id;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1) return;
+ set_state(PART:"elm.text", "slide_begin", 0.0);
+ id = timer(0.5, "slide_to_end", 1);
+ set_int(g_timer_id, id);
+ }
+ public start_slide() {
+ set_int(g_stopslide, 0);
+ set_state(PART:"elm.text", "slide_begin", 0.0);
+ slide_to_end();
+ }
+ public stop_slide() {
+ new id;
+ set_int(g_stopslide, 1);
+ id = get_int(g_anim_id);
+ cancel_anim(id);
+ id = get_int(g_timer_id);
+ cancel_timer(id);
+ set_state(PART:"elm.text", "default", 0.0);
+ }
+ }
+
+ parts {
+ part { name: "label.text.clip";
+ type: RECT;
+ description { state: "default" 0.0;
+ }
+ }
+ part { name: "elm.text";
+ type: TEXTBLOCK;
+ scale: 1;
+ clip_to: "label.text.clip";
+ description { state: "default" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 1.0 1.0;
+ align: 0.0 0.0;
+ text {
+ style: "textblock_style";
+ min: 0 1;
+ align: 0.0 0.0;
+ }
+ }
+ description { state: "slide_end" 0.0;
+ inherit: "default" 0.0;
+ rel1.relative: 1.0 0.0;
+ rel2.relative: 1.0 1.0;
+ align: 1.0 0.0;
+ text {
+ style: "textblock_style";
+ min: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ description { state: "slide_begin" 0.0;
+ inherit: "default" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 0.0 1.0;
+ align: 0.0 0.0;
+ text {
+ style: "textblock_style";
+ min: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ }
+ }
+ programs {
+ program { name: "start_slide";
+ source: "elm";
+ signal: "elm,state,slide,start";
+ script {
+ start_slide();
+ }
+ }
+ program { name: "stop_slide";
+ source: "elm";
+ signal: "elm,state,slide,stop";
+ script {
+ stop_slide();
+ }
+ }
+ }
+ }
+
+ group { name: "elm/label/base/slide_bounce";
+ script {
+ public g_duration = 0, g_stopslide, g_timer_id, g_anim_id;
+
+ public message(Msg_Type:type, id, ...) {
+ if (type == MSG_FLOAT_SET) {
+ new Float:duration;
+ duration = getfarg(2);
+ if (id == 0)
+ set_float(g_duration, duration);
+ else
+ set_float(g_duration, duration / LABEL_FONT_SIZE_INC * SLIDE_SPEED_WEIGHT);
+ }
+ }
+ public slide_to_end_anim(val, Float:pos) {
+ new stopflag;
+ new id;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1) return;
+ set_tween_state(PART:"elm.text", pos, "slide_begin", 0.0, "slide_end", 0.0);
+ if (pos >= 1.0) {
+ id = timer(0.5, "slide_to_begin", 1);
+ set_int(g_timer_id, id);
+ }
+ }
+ public slide_to_end() {
+ new stopflag;
+ new id;
+ new Float:duration;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1) return;
+ duration = get_float(g_duration);
+ id = anim(duration, "slide_to_end_anim", 1);
+ set_int(g_anim_id, id);
+ }
+ public slide_to_begin_anim(val, Float:pos) {
+ new stopflag;
+ new id;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1) return;
+ set_tween_state(PART:"elm.text", pos, "slide_end", 0.0, "slide_begin", 0.0);
+ if (pos >= 1.0) {
+ id = timer(0.5, "slide_to_end", 1);
+ set_int(g_timer_id, id);
+ }
+ }
+ public slide_to_begin() {
+ new stopflag;
+ new id;
+ new Float:duration;
+ stopflag = get_int(g_stopslide);
+ if (stopflag == 1) return;
+ duration = get_float(g_duration);
+ id = anim(duration, "slide_to_begin_anim", 1);
+ set_int(g_anim_id, id);
+ }
+ public start_slide() {
+ set_int(g_stopslide, 0);
+ set_state(PART:"elm.text", "slide_begin", 0.0);
+ slide_to_end();
+ }
+ public stop_slide() {
+ new id;
+ set_int(g_stopslide, 1);
+ id = get_int(g_anim_id);
+ cancel_anim(id);
+ id = get_int(g_timer_id);
+ cancel_timer(id);
+ set_state(PART:"elm.text", "default", 0.0);
+ }
+ }
+
+ parts {
+ part { name: "label.text.clip";
+ type: RECT;
+ description { state: "default" 0.0;
+ }
+ }
+ part { name: "elm.text";
+ type: TEXTBLOCK;
+ scale: 1;
+ clip_to: "label.text.clip";
+ description { state: "default" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 1.0 1.0;
+ align: 0.0 0.0;
+ text {
+ style: "textblock_style";
+ min: 0 1;
+ align: 0.0 0.0;
+ }
+ }
+ description { state: "slide_end" 0.0;
+ inherit: "default" 0.0;
+ rel1.relative: 1.0 0.0;
+ rel2.relative: 1.0 1.0;
+ align: 1.0 0.0;
+ text {
+ style: "textblock_style";
+ min: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ description { state: "slide_begin" 0.0;
+ inherit: "default" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 0.0 1.0;
+ align: 0.0 0.0;
+ text {
+ style: "textblock_style";
+ min: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ }
+ }
+ programs {
+ program { name: "start_slide";
+ source: "elm";
+ signal: "elm,state,slide,start";
+ script {
+ start_slide();
+ }
+ }
+ program { name: "stop_slide";
+ source: "elm";
+ signal: "elm,state,slide,stop";
+ script {
+ stop_slide();
+ }
+ }
+ }
+ }