tizen 2.3 release
[apps/home/settings.git] / setting-common / include / setting-common-view.h
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 /**
22  *@defgroup setting-common-view
23  *each UG is able to have multiple views.
24  */
25 #ifndef __SETTING_COMMON_VIEW_H__
26 #define __SETTING_COMMON_VIEW_H__
27
28 #define EXPORT_PUBLIC __attribute__ ((visibility ("default")))
29
30 typedef struct _setting_view {
31         int (*create) (void *cb);
32         int (*destroy) (void *cb);
33         int (*update) (void *cb);
34         int (*cleanup) (void *cb);
35         int (*langchanged) (void *cb);
36
37         int is_create;          /*  1:exist */
38
39 } setting_view;
40 /**
41  * @brief Set current loaded view
42  *
43  * @param view The view to set
44  * @return #0 on success, else on failed
45  */
46 int setting_view_node_set_cur_view(setting_view *view);
47
48 /**
49  * @brief Get current loaded view
50  *
51  * @return current view
52  */
53 setting_view *setting_view_node_get_cur_view();
54
55 /**
56  * @brief intialize the node table
57  *
58  * @return #0 on success, else on failed
59  */
60 int setting_view_node_table_intialize();
61
62 /**
63  * @brief Register a node for a viwe and its top view
64  *
65  * @param view The current view
66  * @param view The top view of current view
67  * @return #0 on success, else on failed
68  */
69 int setting_view_node_table_register(setting_view *view,
70                                      setting_view *topview);
71
72 /**
73  * @brief callback invoked when pressed hard end key
74  *
75  * @Deprecated
76  */
77 int setting_view_cb_at_endKey(void *cb);
78
79 /**
80  * @brief Get top view of certain view
81  *
82  * @param view The certain view
83  * @return #view's top view on success, else NULL on failed
84  */
85 setting_view *setting_view_get_topview(setting_view *view);
86
87 /**
88  * @brief Replace top view of the certain view
89  *
90  * @param view The certain view
91  * @param topview The new top view
92  */
93 extern void setting_view_update_topview(setting_view *view, setting_view *topview);
94
95 /**
96  * @brief Callback of view creating
97  *
98  * @param view The created view
99  * @param cb The view data passed between all callbacks
100  * @return #0 on success, else on failed
101  */
102 extern int setting_view_create(setting_view *view, void *cb);
103
104 /**
105  * @brief Callback of view updating
106  *
107  * @param view The view being updated
108  * @param cb The view data passed between all callbacks
109  * @return #0 on success, else on failed
110  * @warning the function should be invoked on the view which will be toppest view
111  */
112 extern int setting_view_update(setting_view *view, void *cb);
113
114 /**
115  * @brief Callback of view destroying
116  *
117  * @param view The view being destroyed
118  * @param cb The view data passed between all callbacks
119  * @return #0 on success, else on failed
120  */
121 extern int setting_view_destroy(setting_view *view, void *cb);
122
123 /**
124  * @brief Callback of view cleanuping
125  *
126  * @param view The view being cleanuped
127  * @param cb The view data passed between all callbacks
128  * @return #0 on success, else on failed
129  * @warning the function should be invoked on the view which will be covered
130  */
131 extern int setting_view_cleanup(setting_view *view, void *cb);
132
133 /**
134  * @brief Callback of view changing
135  *
136  * @param from_view The view being covered
137  * @param to_view The view go to cover
138  * @param cb The view data passed between all callbacks
139  * @return #0 on success, else on failed
140  * @warning the function should be invoked to change views
141  */
142 extern int setting_view_change(setting_view *from_view, setting_view *to_view,
143                                void *cb);
144
145 #endif                          /* __SETTING_COMMON_VIEW_H__ */