Fix eap, detail view grouping
[apps/native/ug-wifi-efl.git] / sources / libraries / Common / include / common_utils.h
1 /*
2  * Wi-Fi
3  *
4  * Copyright 2012-2013 Samsung Electronics Co., Ltd
5  *
6  * Licensed under the Flora License, Version 1.1 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://floralicense.org/license
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __COMMON_UTILS_H__
21 #define __COMMON_UTILS_H__
22
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27
28 #include <Elementary.h>
29
30 /* Fix build warning (redefine '_()' in appcore-common.h) */
31 #ifdef _
32 #undef _
33 #endif
34 #include <appcore-common.h>
35
36 #include "wlan_manager.h"
37
38 typedef void (*imf_ctxt_panel_cb_t)(void *data, Ecore_IMF_Context *ctx, int value);
39
40 typedef enum {
41         ENTRY_TYPE_USER_ID,
42         ENTRY_TYPE_ANONYMOUS_ID,
43         ENTRY_TYPE_PASSWORD,
44         ENTRY_TYPE_IP_ADDR,
45         ENTRY_TYPE_SUBNET_MASK,
46         ENTRY_TYPE_GATEWAY,
47         ENTRY_TYPE_DNS_1,
48         ENTRY_TYPE_DNS_2,
49         ENTRY_TYPE_PROXY_ADDR,
50         ENTRY_TYPE_PROXY_PORT,
51 } entry_id_type_t;
52
53 typedef enum {
54         GENLIST_ITEM_STYLE_NONE = 0,
55         GENLIST_ITEM_STYLE_TOP,
56         GENLIST_ITEM_STYLE_CENTER,
57         GENLIST_ITEM_STYLE_BOTTOM,
58 }GENLIST_ITEM_STYLE;
59
60 typedef struct {
61         void *cast_data;
62         GENLIST_ITEM_STYLE group_style;
63 } genlist_item_data_t;
64
65 typedef struct {
66         entry_id_type_t entry_id;
67         char *title_txt;
68         char *guide_txt;
69         char *entry_txt;
70         Elm_Object_Item *item;
71         imf_ctxt_panel_cb_t input_panel_cb;
72         void *input_panel_cb_data;
73 } common_utils_entry_info_t;
74
75 typedef struct {
76         char *title_txt;
77         char *info_txt;
78         char *btn1_txt;
79         char *btn2_txt;
80         Evas_Smart_Cb btn1_cb;
81         Evas_Smart_Cb btn2_cb;
82         const void *btn1_data;
83         const void *btn2_data;
84 } popup_btn_info_t;
85
86 typedef struct {
87         wifi_ap_h ap;
88         Elm_Object_Item *pswd_item;
89 }eap_info_list_t;
90
91 typedef struct {
92         char* title;
93         char* description;
94 } _view_detail_description_data_t;
95
96 typedef struct {
97         const char *str_pkg_name;
98         Evas_Object *genlist;
99
100         Elm_Object_Item* ip_toggle_item;
101         Elm_Object_Item* ip_addr_item;
102         Elm_Object_Item* subnet_mask_item;
103         Elm_Object_Item* gateway_addr_item;
104         Elm_Object_Item* dns_1_item;
105         Elm_Object_Item* dns_2_item;
106         Elm_Object_Item* proxy_addr_item;
107         Elm_Object_Item* proxy_port_item;
108
109         imf_ctxt_panel_cb_t input_panel_cb;
110         void *input_panel_cb_data;
111
112         wifi_ap_h ap;
113         wifi_ip_config_type_e ip_type;
114 } ip_info_list_t;
115
116 typedef struct {
117         Evas_Object *win;
118         char *ap_image_path;
119         wifi_ap_h ap;
120         eap_info_list_t *eap_info_list;
121         ip_info_list_t *ip_info_list;
122         Evas_Object *forget_confirm_popup;
123         Evas_Object *view_detail_list;
124 } view_detail_data;
125
126 void* common_util_genlist_item_data_get(void *data);
127
128 Elm_Object_Item *common_utils_add_dialogue_separator(
129                 Evas_Object* genlist, const char *separator_style);
130 char *common_utils_get_ap_security_type_info_txt(
131                 const char *pkg_name, wifi_device_info_t *device_info);
132 void common_utils_get_device_icon(const char *image_path_dir,
133                 wifi_device_info_t *device_info, char **icon_path);
134 char *common_utils_get_rssi_text(
135                 const char *str_pkg_name, int rssi);
136 Evas_Object *common_utils_entry_layout_get_entry(Evas_Object *layout);
137 char *common_utils_entry_layout_get_text(Evas_Object *layout);
138 Evas_Object *common_utils_add_edit_box(Evas_Object *parent,
139                 common_utils_entry_info_t *entry_info);
140 void common_utils_set_edit_box_imf_panel_evnt_cb(Elm_Object_Item *item,
141                 imf_ctxt_panel_cb_t input_panel_cb,     void *user_data);
142 void common_utils_edit_box_focus_set(Elm_Object_Item *item, Eina_Bool focus_set);
143
144 void common_utils_entry_password_set(Evas_Object *layout, Eina_Bool pswd_set);
145 Elm_Object_Item *common_utils_add_2_line_txt_disabled_item(
146                 Evas_Object* view_list, const char *style_name,
147                 const char *line1_txt, const char *line2_txt, GENLIST_ITEM_STYLE style);
148 char *common_utils_get_list_item_entry_txt(Elm_Object_Item *entry_item);
149 Evas_Object *common_utils_create_radio_button(Evas_Object *parent,
150                 const int value);
151 Evas_Object *common_utils_create_layout(Evas_Object *navi_frame);
152 Evas_Object *common_utils_show_info_popup(Evas_Object *win,
153                 popup_btn_info_t *popup_data);
154 Evas_Object *common_utils_show_info_ok_popup(Evas_Object *win,
155                 const char *str_pkg_name, const char *info_txt);
156 Evas_Object *common_utils_show_info_timeout_popup(Evas_Object *win,
157                 const char* info_text, const double timeout);
158 int common_utils_get_rotate_angle(enum appcore_rm rotate_mode);
159 wlan_security_mode_type_t common_utils_get_sec_mode(
160                 wifi_security_type_e sec_type);
161 int common_utils_send_message_to_net_popup(const char *title,
162                 const char *content, const char *type, const char *ssid);
163
164 int common_util_set_system_registry(const char *key, int value);
165 int common_util_get_system_registry(const char *key);
166
167 guint common_util_managed_idle_add(GSourceFunc func, gpointer user_data);
168 void common_util_managed_idle_cleanup(void);
169 void common_popup_size_get(Ecore_IMF_Context *target_imf, int *width, int *height);
170 void common_util_genlist_item_style_set(Elm_Object_Item *target, GENLIST_ITEM_STYLE stype);
171
172 #ifdef __cplusplus
173 }
174 #endif
175
176 #endif