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 #ifndef __DEF_WORLDCLOCK_UTIL_H_
20 #define __DEF_WORLDCLOCK_UTIL_H_
22 #include <appcore-efl.h>
23 #include <Elementary.h>
24 #include <unicode/umachine.h>
25 #include "worldclock.h"
28 * Compare the city name of two cities
30 * @param[in] data1 record data of city1
31 * @param[in] data2 record data of city2
33 * @return -1 if city name of city2 is bigger than city1's
34 * 1 if city name of city1 is bigger than city2's
35 * 0 if city name of city2 is equal to city1, or meet error
37 int worldclock_city_compare_cb(const void *data1, const void *data2);
40 * Compare timezone of two cities
42 * @param[in] data1 recorder of city1
43 * @param[in] data2 recorder of city2
45 * @return -1 if timezone of city2 is bigger than city1's
46 * 1 if timezone of city1 is bigger than city2's
47 * 0 if timezone of city2 is equal to city1, or meet error
49 int worldclock_time_compare_cb(const void *data1, const void *data2);
52 * Compare sequence of two cities
54 * @param[in] data1 recorder of city1
55 * @param[in] data2 recorder of city2
57 * @return -1 if sequence of city2 is bigger than city1's
58 * 1 if sequence of city1 is bigger than city2's
59 * 0 if sequence of city2 is equal to city1, or meet error
61 int worldclock_sequence_compare_cb(const void *data1, const void *data2);
64 * Checking whether the count of city list meet the max number
66 * @param[in] city list
68 * @return EINA_TRUE if list full
71 Eina_Bool worldclock_is_city_list_full(Eina_List * eina_list);
74 * Insert given city into given eina list
76 * @param[in] city list
77 * @param[in] cs given city
79 * @return -1 if not exist
81 * list-count if success,
83 int worldclock_append_city_to_list(Eina_List ** p_eina_list, Wcl_CitySet * cs);
86 * Insert given city into given eina list
88 * @param[in] city list
89 * @param[in] cs given city
90 * @param[in] position to insert
92 * @return -1 if not exist
94 * list-count if success,
96 int worldclock_insert_city_to_list(Eina_List ** p_eina_list, Wcl_CitySet * cs,
100 * Remove all items in eina_list
102 * @param[in] glist given eina list
103 * @param[in] is_free_element flag to define if free data in every item is needed
105 * @return EINA_TRUE if remove successfully
107 Eina_Bool worldclock_util_glist_remove_all(Eina_List * glist,
108 Eina_Bool is_free_element);
111 * Creat new popup window, and show it
113 * @param[in] parent Parent for such popup
114 * @param[in] data Data used in this function
115 * @param[in] info String displayed on popup
119 void worldclock_show_popup(Evas_Object * parent, Evas_Object ** p_popup,
123 * Check whether given city exist in given eina_list
125 * @param[in] eina_list given eina list
126 * @param[in] cs record of given city
127 * @return EINA_FALSE if not exist
130 Eina_Bool worldclock_whether_city_exist_in_eina_list(Eina_List * eina_list,
134 * Reset now time of genlist item data
136 * @param[in] eina_list given eina list
140 void worldclock_reset_now_time(Eina_List * eina_list);
143 * Create layout by load edj according group name from edj file
145 * @param[in] parent Parent of new layout
146 * @param[in] file EDJE file
147 * @param[in] group name of group
149 * @return NULL if meet error
150 * Pointer to new layout
152 Evas_Object *worldclock_load_edj(Evas_Object * parent, const char *file,
156 * Search word in string
157 * * Set color on the word if found
158 * * Set max length to aimed string, replace tail with ...
160 * @param[in] string source string for search
161 * @param[in] searchword word which used for search
162 * @param[in] max_len Max length of string which to display
164 * @return string which for displaying
166 const char *worldclock_searchword_in_string(const char *string,
167 char *searchword, int max_len);
170 * This function is used to compute the length of string which displaying on entry
171 * The html flag which could change the actual length of string should be ignored.
173 * @param[in] str source string which got from entry
175 * @return The length of the displaying part about str
177 int worldclock_str_get_displaying_length(const char *str);
180 * This function is used to get the displaying of string which displaying on entry
182 * @param[in] src source string which got from entry
183 * @param[in] dst dest string which write the displaying part to
185 * @return The length of displaying part
187 int worldclock_str_get_displaying_part(const char *src, char *dst);
190 * This function is used to justify whethet html flag exist in string
192 * @param[in] str source string which got from entry
194 * @return EINA_TRUE if contain html
196 Eina_Bool worldclock_str_is_contain_html(const char *str);
199 * This function is used to convert string type from Unicode to UTF8
201 * @param[in] unichars source string whose type is Unicode
203 * @return The result string whose type is UTF8
205 char *worldclock_strToUTF8(const UChar * unichars);
207 int worldclock_dst_get(const Wcl_CitySet * cs);
208 time_t worldclock_genlist_time_get(Wcl_CitySet * cs, void *data);
210 Evas_Object *widget_create_controlbar(Evas_Object * parent, const char *style);
212 #endif /* __DEF_WORLDCLOCK_UTIL_H_ */