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 "clock_fwk_view.h"
20 /**********************************************************************
21 ******************define, struct ,typedef, union, enum, global val *************************************
22 ***********************************************************************/
23 #define MAX_VIEWNODE_NUM 15
25 typedef struct _ClkViewNode {
30 /**********************************************************************
31 ******************Global val , static global val*************************************
32 ***********************************************************************/
34 static clk_view *g_cur_view;; //use by 'End Key' process
35 static ClkViewNode g_view_node_table[MAX_VIEWNODE_NUM];
36 static int g_view_node_table_cur_size = 0;
38 /**********************************************************************
39 ******************Global function ref*************************************
40 ***********************************************************************/
42 int clk_view_node_set_cur_view(clk_view * view)
49 int clk_view_node_table_intialize()
52 g_view_node_table_cur_size = 0;
57 int clk_view_node_table_register(clk_view * view, clk_view * topview)
59 if (g_view_node_table_cur_size >= MAX_VIEWNODE_NUM) {
63 g_view_node_table[g_view_node_table_cur_size].view = view;
64 g_view_node_table[g_view_node_table_cur_size].topview = topview;
65 g_view_node_table_cur_size++;
70 int clk_view_cb_at_endKey(void *cb)
73 ClkViewNode *viewnode = NULL;
74 for (; idx < g_view_node_table_cur_size; idx++) {
75 if (g_cur_view == g_view_node_table[idx].view) {
76 viewnode = &(g_view_node_table[idx]);
80 if (viewnode && viewnode->view && viewnode->topview) {
81 clk_view_change(viewnode->view, viewnode->topview, cb);
88 * This function is used to be default cb in the elm_popup when get signle:"response"
89 * @param data[in] pointer to data
90 * @return when success, return SUCCESS or FAILED if error
93 int clk_view_create(clk_view * view, void *cb)
97 CLK_RETVM_IF(!cb, FAILED, "cb==null");
98 CLK_RETVM_IF(!view, FAILED, "view==null");
100 ret = view->create(cb);
108 * This function is used to be default cb in the elm_popup when get signle:"response"
109 * @param data[in] pointer to data
110 * @return when success, return SUCCESS or FAILED if error
113 int clk_view_destroy(clk_view * view, void *cb)
117 CLK_RETVM_IF(!cb, FAILED, "cb==null");
118 CLK_RETVM_IF(!view, FAILED, "view==null");
120 ret = view->destroy(cb);
128 * This function is used to be default cb in the elm_popup when get signle:"response"
129 * @param data[in] pointer to data
130 * @return when success, return SUCCESS or FAILED if error
133 int clk_view_update(clk_view * view, void *cb)
138 CLK_RETVM_IF(!cb, FAILED, "cb==null");
139 CLK_RETVM_IF(!view, FAILED, "view==null");
140 if (view && view->update) {
141 ret = view->update(cb);
150 * This function is used to be default cb in the elm_popup when get signle:"response"
151 * @param data[in] pointer to data
152 * @return when success, return SUCCESS or FAILED if error
155 int clk_view_cleanup(clk_view * view, void *cb)
160 CLK_RETVM_IF(!cb, FAILED, "cb==null");
161 CLK_RETVM_IF(!view, FAILED, "view==null");
163 ret = view->cleanup(cb);
172 * This function is used to be default cb in the elm_popup when get signle:"response"
173 * @param data[in] pointer to data
174 * @return when success, return SUCCESS or FAILED if error
177 int clk_view_change(clk_view * from_view, clk_view * to_view, void *cb)
181 CLK_RETVM_IF(!cb, FAILED, "cb==null");
182 CLK_RETVM_IF(!from_view, FAILED, "from_view==null");
183 CLK_RETVM_IF(!to_view, FAILED, "to_view==null");
185 if (from_view->layer >= to_view->layer) { //high layer->low layer, destroy high layer
186 nErr = clk_view_destroy(from_view, cb);
187 CLK_RETVM_IF(ret != SUCCESS, FAILED, "clk_view_destroy error");
188 } else { //low layer->high layer, clean low layer
189 nErr = clk_view_cleanup(from_view, cb);
190 CLK_RETVM_IF(ret != SUCCESS, FAILED, "clk_view_cleanup error");
192 if (EINA_TRUE == to_view->is_create) {
193 ret = clk_view_update(to_view, cb);
195 ret = clk_view_create(to_view, cb);
197 g_cur_view = to_view; //compute new value of g_cur_view.