2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __DEF_WORLDCLOCK_UTIL_H_
18 #define __DEF_WORLDCLOCK_UTIL_H_
20 #include <appcore-efl.h>
21 #include <Elementary.h>
22 #include <unicode/umachine.h>
23 #include "worldclock.h"
26 * Compare the city name of two cities
28 * @param[in] data1 record data of city1
29 * @param[in] data2 record data of city2
31 * @return -1 if city name of city2 is bigger than city1's
32 * 1 if city name of city1 is bigger than city2's
33 * 0 if city name of city2 is equal to city1, or meet error
35 int worldclock_city_compare_cb(const void *data1, const void *data2);
38 * Compare timezone of two cities
40 * @param[in] data1 recorder of city1
41 * @param[in] data2 recorder of city2
43 * @return -1 if timezone of city2 is bigger than city1's
44 * 1 if timezone of city1 is bigger than city2's
45 * 0 if timezone of city2 is equal to city1, or meet error
47 int worldclock_time_compare_cb(const void *data1, const void *data2);
50 * Compare sequence of two cities
52 * @param[in] data1 recorder of city1
53 * @param[in] data2 recorder of city2
55 * @return -1 if sequence of city2 is bigger than city1's
56 * 1 if sequence of city1 is bigger than city2's
57 * 0 if sequence of city2 is equal to city1, or meet error
59 int worldclock_sequence_compare_cb(const void *data1, const void *data2);
62 * Checking whether the count of city list meet the max number
64 * @param[in] city list
66 * @return EINA_TRUE if list full
69 Eina_Bool worldclock_is_city_list_full(Eina_List *eina_list);
72 * Insert given city into given eina list
74 * @param[in] city list
75 * @param[in] cs given city
77 * @return -1 if not exist
79 * list-count if success,
81 int worldclock_append_city_to_list(Eina_List **p_eina_list, Wcl_CitySet *cs);
84 * Insert given city into given eina list
86 * @param[in] city list
87 * @param[in] cs given city
88 * @param[in] position to insert
90 * @return -1 if not exist
92 * list-count if success,
94 int worldclock_insert_city_to_list(Eina_List **p_eina_list, Wcl_CitySet *cs,
98 * Remove all items in eina_list
100 * @param[in] glist given eina list
101 * @param[in] is_free_element flag to define if free data in every item is needed
103 * @return EINA_TRUE if remove successfully
105 Eina_Bool worldclock_util_glist_remove_all(Eina_List *glist,
106 Eina_Bool is_free_element);
109 * Creat new popup window, and show it
111 * @param[in] parent Parent for such popup
112 * @param[in] data Data used in this function
113 * @param[in] info String displayed on popup
117 void worldclock_show_popup(Evas_Object *parent, Evas_Object **p_popup,
121 * Check whether given city exist in given eina_list
123 * @param[in] eina_list given eina list
124 * @param[in] cs record of given city
125 * @return EINA_FALSE if not exist
128 Eina_Bool worldclock_whether_city_exist_in_eina_list(Eina_List *eina_list,
132 * Reset now time of genlist item data
134 * @param[in] eina_list given eina list
138 void worldclock_reset_now_time(Eina_List *eina_list);
141 * Create layout by load edj according group name from edj file
143 * @param[in] parent Parent of new layout
144 * @param[in] file EDJE file
145 * @param[in] group name of group
147 * @return NULL if meet error
148 * Pointer to new layout
150 Evas_Object *worldclock_load_edj(Evas_Object *parent, const char *file,
154 * Search word in string
155 * * Set color on the word if found
156 * * Set max length to aimed string, replace tail with ...
158 * @param[in] string source string for search
159 * @param[in] searchword word which used for search
160 * @param[in] max_len Max length of string which to display
162 * @return string which for displaying
164 const char *worldclock_searchword_in_string(const char *string,
165 char *searchword, int max_len);
168 * This function is used to compute the length of string which displaying on entry
169 * The html flag which could change the actual length of string should be ignored.
171 * @param[in] str source string which got from entry
173 * @return The length of the displaying part about str
175 int worldclock_str_get_displaying_length(const char *str);
178 * This function is used to get the displaying of string which displaying on entry
180 * @param[in] src source string which got from entry
181 * @param[in] dst dest string which write the displaying part to
183 * @return The length of displaying part
185 int worldclock_str_get_displaying_part(const char *src, char *dst);
188 * This function is used to justify whethet html flag exist in string
190 * @param[in] str source string which got from entry
192 * @return EINA_TRUE if contain html
194 Eina_Bool worldclock_str_is_contain_html(const char *str);
197 * This function is used to convert string type from Unicode to UTF8
199 * @param[in] unichars source string whose type is Unicode
201 * @return The result string whose type is UTF8
203 char *worldclock_strToUTF8(const UChar * unichars);
205 int worldclock_dst_get(const Wcl_CitySet *cs);
206 time_t worldclock_genlist_time_get(Wcl_CitySet *cs, void *data);
208 Evas_Object *widget_create_controlbar(Evas_Object *parent, const char *style);
209 #endif /* __DEF_WORLDCLOCK_UTIL_H_ */