3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.tizenopensource.org/license
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #include "stopwatch_lib.h"
20 #include "stopwatch_main.h"
21 #include "stopwatch_vconf.h"
22 #include "stopwatch_util.h"
23 /**********************************************************************
24 ******************Global val , static global val*************************************
25 ***********************************************************************/
26 static struct appdata *g_ad;
28 /**********************************************************************
29 ******************Local function ref*************************************
30 ***********************************************************************/
33 * Debug function: to free all objects in the view going to be distroyed
34 * This function requires data as parameters
36 * stopwatch_view_add()
37 * @param[in] parent Pointer to the parent in which the new add layout will be placed
38 * @param[in] cb a Eina_Bool value to indicate whether the controlbar should be displayed
40 * @return Evas_Object*, the new created layout
42 EAPI Evas_Object *stopwatch_view_add(Evas_Object *parent, Evas_Object *win,
43 stopwatch_controlbar_visible cb)
45 retvm_if(!parent, NULL, "parent null");
47 (struct appdata *)calloc(1, sizeof(struct appdata));
48 bindtextdomain(PACKAGE, LOCALEDIR);
51 stw_create_main_view(ad);
52 stw_util_pm_state_set(EINA_TRUE);
54 ad->controlbar_cb = cb;
56 ad->controlbar_cb(EINA_TRUE);
58 return ad->layout_main;
62 * Debug function: to free all objects in the view going to be distroyed
63 * This function requires data as parameters
65 * stopwatch_view_free()
66 * @param[in] obj Pointer to view which will be distroyed
70 EAPI void stopwatch_view_free(Evas_Object *obj)
72 retm_if(!g_ad, "a_ad is null");
73 stw_util_pm_state_set(EINA_FALSE);
75 ECORE_TIMER_DELIF(g_ad->timer);
76 EVAS_OBJECT_DELIF(g_ad->gl);
77 EVAS_OBJECT_DELIF(g_ad->ly_main);
78 EVAS_OBJECT_DELIF(g_ad->navi_bar);
79 EVAS_OBJECT_DELIF(g_ad->layout_main);
84 * Debug function: to add control logic to KEY_POWER when stopwatch view is shown
85 * This function requires data as parameters
87 * stopwatch_view_reload()
91 EAPI void stopwatch_view_reload()
93 retm_if(!g_ad, "a_ad is null");
94 stw_util_pm_state_set(EINA_TRUE);
96 g_ad->controlbar_cb(EINA_TRUE);
100 * Debug function: to remove control logic to KEY_POWER when stopwatch view is hidden
101 * This function requires data as parameters
103 * stopwatch_view_unload()
107 EAPI void stopwatch_view_unload()
109 retm_if(!g_ad, "a_ad is null");
110 stw_util_pm_state_set(EINA_FALSE);
114 EAPI void stopwatch_app_pause()
116 retm_if(!g_ad, "a_ad is null");
117 stopwatch_view_unload();
118 struct appdata *ad = g_ad;
119 if (IS_EQUAL(ad->cur_state, STW_STATE_TYPE_START) && ad->timer) {
120 ecore_timer_freeze(ad->timer);
124 EAPI void stopwatch_app_resume(Eina_Bool bCurrentView)
126 retm_if(!g_ad, "a_ad is null");
128 stopwatch_view_reload();
130 struct appdata *ad = g_ad;
131 if (IS_EQUAL(ad->cur_state, STW_STATE_TYPE_START) && ad->timer) {
132 ecore_timer_thaw(ad->timer);