add label theme file 47/41447/1
authorSoohye Shin <soohye.shin@samsung.com>
Mon, 15 Jun 2015 11:09:36 +0000 (20:09 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Mon, 15 Jun 2015 11:10:44 +0000 (20:10 +0900)
Change-Id: I7440a3ddf721743869d17a00c97e01c50c24fc10
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
CMakeLists.txt
edje/CMakeLists.txt
edje/home-theme.edc [new file with mode: 0644]
edje/widget/label.edc [new file with mode: 0644]
include/defs.h
src/main.c

index d4aee44..5697dff 100644 (file)
@@ -39,6 +39,7 @@ ENDIF(NOT DEFINED MANIFESTDIR)
 
 SET(TARGET_EDJ "${PROJECT_NAME}.edj")
 SET(DEFCONFIG "${PROJECT_NAME}.json")
+SET(THEME_EDJ "${PROJECT_NAME}-theme.edj")
 SET(SRCS
                src/main.c
                src/view/view_recent.c
@@ -47,6 +48,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
 ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE_NAME}\"")
 ADD_DEFINITIONS("-DEDJEDIR=\"${EDJEDIR}\"")
 ADD_DEFINITIONS("-DEDJEFILE=\"${EDJEDIR}/${TARGET_EDJ}\"")
+ADD_DEFINITIONS("-DTHEMEFILE=\"${EDJEDIR}/${THEME_EDJ}\"")
 ADD_DEFINITIONS("-DIMAGEDIR=\"${IMAGEDIR}\"")
 ADD_DEFINITIONS("-DDEFCONFIG=\"${CFGDIR}/${DEFCONFIG}\"")
 
index 42622bb..0cd5335 100644 (file)
@@ -6,3 +6,12 @@ ADD_CUSTOM_TARGET(${TARGET_EDJ}
 )
 ADD_DEPENDENCIES(${PROJECT_NAME} ${TARGET_EDJ})
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EDJ} DESTINATION ${EDJEDIR})
+
+ADD_CUSTOM_TARGET(${THEME_EDJ}
+               COMMAND edje_cc -id images
+               ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-theme.edc
+               ${CMAKE_CURRENT_BINARY_DIR}/${THEME_EDJ}
+               DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}-theme.edc
+)
+ADD_DEPENDENCIES(${PROJECT_NAME} ${THEME_EDJ})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${THEME_EDJ} DESTINATION ${EDJEDIR})
diff --git a/edje/home-theme.edc b/edje/home-theme.edc
new file mode 100644 (file)
index 0000000..bc4bc11
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../include/defs.h"
+
+collections {
+       #include "widget/label.edc"
+}
diff --git a/edje/widget/label.edc b/edje/widget/label.edc
new file mode 100644 (file)
index 0000000..5c9c825
--- /dev/null
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+styles {
+       style {
+               name, "home_label_title";
+               base, "font=TizenSans font_size=22 color=#686868 align=center";
+       }
+       style {
+               name, "home_label_title_focus";
+               base, "font=TizenSans font_size=22 color=#ffffff align=center";
+       }
+}
+
+group {
+       name, "elm/label/base/slide_home_title";
+       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);
+                               set_float(g_duration, duration);
+                       }
+               }
+               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.5;
+                               text {
+                                       style, "home_label_title";
+                                       align, 0.0 1.0;
+                                       min, 0 1;
+                               }
+                       }
+                       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.5;
+                               text {
+                                       style, "home_label_title";
+                                       align, 0.0 0.0;
+                                       min, 1 1;
+                                       ellipsis, -1.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.5;
+                               text {
+                                       style, "home_label_title";
+                                       align, 0.0 0.0;
+                                       min, 1 1;
+                                       ellipsis, -1.0;
+                               }
+                       }
+               }
+       }
+       programs {
+               program {
+                       name, "start_slide";
+                       signal, "elm,state,slide,start";
+                       source, "elm";
+                       script {
+                               start_slide();
+                       }
+               }
+               program {
+                       name, "stop_slide";
+                       signal, "elm,state,slide,stop";
+                       source, "elm";
+                       script {
+                               stop_slide();
+                       }
+               }
+       }
+}
+
+group {
+       name, "elm/label/base/slide_home_title_focus";
+       inherit, "elm/label/base/slide_home_title";
+       parts {
+               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.5;
+                               text {
+                                       style, "home_label_title_focus";
+                                       align, 0.0 1.0;
+                                       min, 0 1;
+                               }
+                       }
+                       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.5;
+                               text {
+                                       style, "home_label_title_focus";
+                                       align, 0.0 0.0;
+                                       min, 1 1;
+                                       ellipsis, -1.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.5;
+                               text {
+                                       style, "home_label_title_focus";
+                                       align, 0.0 0.0;
+                                       min, 1 1;
+                                       ellipsis, -1.0;
+                               }
+                       }
+               }
+       }
+}
index de86aea..1d5578a 100644 (file)
@@ -54,4 +54,7 @@
 #define SIG_SHOW_RECENT "sig.show.recent"
 #define SIG_HIDE_RECENT "sig.hide.recent"
 
+#define STYLE_LABEL_TITLE "slide_home_title"
+#define STYLE_LABEL_TITLE_FOCUS "slide_home_title_focus"
+
 #endif /* __AIR_HOME_DEFS_H__ */
index 23eb860..c4e1027 100644 (file)
@@ -57,6 +57,7 @@ static bool _create(void *user_data)
 
        ad = user_data;
 
+       elm_theme_overlay_add(NULL, THEMEFILE);
        elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK);
 
        win = _add_win(ad->name);