Change theme style for password editfield
[apps/native/ug-wifi-efl.git] / sources / libraries / Common / include / common.h
1 /*
2  * Wi-Fi
3  *
4  * Copyright 2012 Samsung Electronics Co., Ltd
5  *
6  * Licensed under the Flora License, Version 1.0 (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://www.tizenopensource.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_H__
21 #define __COMMON_H__
22
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27
28 #include <dlog.h>
29 #include <assert.h>
30
31 #define COMMON_NAME_FUNC        "wifi/func"
32 #define COMMON_NAME_LIB         "wifi/lib"
33 #define COMMON_NAME_ERR         "wifi/err"
34 #define UG_NAME_NORMAL          "wifi_ug"
35 #define UG_NAME_RESP            "wifi_ug/resp"
36 #define UG_NAME_REQ                     "wifi_ug/req"
37 #define UG_NAME_SCAN            "wifi_ug/scan"
38 #define UG_NAME_ERR                     "wifi_ug/err"
39 #define SP_NAME_NORMAL          "wifi_sp"
40 #define SP_NAME_ERR                     "wifi_sp/err"
41
42 #define CUSTOM_EDITFIELD_PATH \
43                         "/usr/apps/wifi-efl-ug/res/edje/wifi-efl-UG/custom_editfield.edj"
44 #define SETUP_WIZARD_EDJ_PATH \
45                         "/usr/apps/wifi-efl-ug/res/edje/wifi-efl-UG/setup_wizard.edj"
46
47 /* Log Level */
48 #define COMMON_LOG_DEBUG        LOG_DEBUG
49 #define COMMON_LOG_INFO         LOG_INFO
50 #define COMMON_LOG_WARN         LOG_WARN
51 #define COMMON_LOG_ERROR        LOG_ERROR
52
53 #define MAX_DEVICE_ICON_PATH_STR_LEN                    256
54 #define SCREEN_TYPE_ID_KEY                              "screen_type_id_key"
55
56 /* Device-picker height for portrait mode*/
57 #define DEVICE_PICKER_POPUP_H           550
58
59 /* Device-picker height for portrait mode in EAP screen with keypad*/
60 #define DEVICE_PICKER_POPUP_EAP_KEYPAD_H                260
61
62 /* Device-picker height for landscape mode */
63 #define DEVICE_PICKER_POPUP_LN_H                220
64
65 /* Device-picker height for zero profiles (same as defined in EDC file)*/
66 #define DEVICE_PICKER_EMPTY_POPUP_H 100
67
68 /* Device-picker width for landscape mode */
69 #define DEVICE_PICKER_POPUP_LN_W                600
70
71 /* Genlist new style for Tizen 2.4 */
72 #define WIFI_GENLIST_1LINE_TEXT_STYLE "type1"
73 #define WIFI_GENLIST_1LINE_TEXT_ICON_STYLE "type1"
74 #define WIFI_GENLIST_2LINE_TOP_TEXT_STYLE "type1"
75 #define WIFI_GENLIST_2LINE_TOP_TEXT_ICON_STYLE "type1"
76 #define WIFI_GENLIST_2LINE_BOTTOM_TEXT_STYLE "type2"
77 #define WIFI_GENLIST_2LINE_BOTTOM_TEXT_ICON_STYLE "type2"
78 #define WIFI_GENLIST_MULTILINE_TEXT_STYLE "multiline"
79 #define WIFI_GENLIST_GROUP_INDEX_STYLE "group_index"
80
81 /* Genlist new style for Tizen 3.0 */
82 #define WIFI_GENLIST_2LINE_BOTTOM_SWALLOW_STYLE "type2"
83 #define WIFI_GENLIST_SWALLOW_CONTENT_STYLE "full"
84
85 /* Icon Size*/
86 #define DEFAULT_BG_SIZE 60
87 #define DEFAULT_BUTTON_CIRCLE_SIZE 40
88
89 typedef enum {
90         UG_VIEW_DEFAULT = 0,
91         UG_VIEW_SETUP_WIZARD
92 } UG_TYPE;
93
94 typedef enum {
95         VIEW_MANAGER_VIEW_TYPE_MAIN,
96         VIEW_MANAGER_VIEW_TYPE_DETAIL,
97         VIEW_MANAGER_VIEW_TYPE_ADVANCED,
98         VIEW_MANAGER_VIEW_TYPE_EAP,
99         VIEW_MANAGER_VIEW_TYPE_PASSWD_POPUP,
100 } view_manager_view_type_t;
101
102 #define __COMMON_FUNC_ENTER__ \
103         FUNC_LOG(COMMON_NAME_FUNC, "[<Entering]: %s() [%d]", __func__, __LINE__)
104 #define __COMMON_FUNC_EXIT__ \
105         FUNC_LOG(COMMON_NAME_FUNC, "[Quit/>]: %s() [%d]", __func__, __LINE__)
106
107 #define FUNC_LOG(MID, format, args...) \
108         SLOG(LOG_INFO, MID, "\033[2m[%s:%d]\033[2m " format "\033[0m", __func__, __LINE__, ##args)
109 #define DEBUG_LOG(MID, format, args...) \
110         SLOG(LOG_DEBUG, MID, "\033[42m[%s:%d]\033[0m\033[32m " format "\033[0m", __func__, __LINE__, ##args)
111 #define INFO_LOG(MID, format, args...) \
112         SLOG(LOG_INFO, MID, "\033[0m[%s:%d]\033[0m " format, __func__, __LINE__, ##args)
113 #define WARN_LOG(MID, format, args...) \
114         SLOG(LOG_WARN, MID, "\033[43m[%s:%d]\033[0m\033[33m " format "\033[0m", __func__, __LINE__, ##args)
115 #define ERROR_LOG(MID, format, args...) \
116         SLOG(LOG_ERROR, MID, "\033[41m[%s:%d]\033[0m\033[31m " format "\033[0m", __func__, __LINE__, ##args)
117
118 #define SECURE_FUNC_LOG(MID, format, args...) \
119         SECURE_SLOG(LOG_INFO, MID, "\033[2m[%s:%d]\033[2m " format "\033[0m", __func__, __LINE__, ##args)
120 #define SECURE_DEBUG_LOG(MID, format, args...) \
121         SECURE_SLOG(LOG_DEBUG, MID, "\033[42m[%s:%d]\033[0m\033[32m " format "\033[0m", __func__, __LINE__, ##args)
122 #define SECURE_INFO_LOG(MID, format, args...) \
123         SECURE_SLOG(LOG_INFO, MID, "\033[0m[%s:%d]\033[0m " format, __func__, __LINE__, ##args)
124 #define SECURE_WARN_LOG(MID, format, args...) \
125         SECURE_SLOG(LOG_WARN, MID, "\033[43m[%s:%d]\033[0m\033[33m " format "\033[0m", __func__, __LINE__, ##args)
126 #define SECURE_ERROR_LOG(MID, format, args...) \
127         SECURE_SLOG(LOG_ERROR, MID, "\033[41m[%s:%d]\033[0m\033[31m " format "\033[0m", __func__, __LINE__, ##args)
128
129 #define retm_if(expr) do { \
130         if (expr) { \
131                 ERROR_LOG(COMMON_NAME_ERR, "[%s(): %d] (%s) [return]", __FUNCTION__, __LINE__, #expr); \
132                 return; \
133         } \
134 } while (0)
135
136 #define retvm_if(expr, val) do { \
137         if (expr) { \
138                 ERROR_LOG(COMMON_NAME_ERR, "[%s(): %d] (%s) [return]", __FUNCTION__, __LINE__, #expr); \
139                 return (val); \
140         } \
141 } while (0)
142
143 #define assertm_if(expr, fmt, arg...) do { \
144         if(expr) { \
145                 ERROR_LOG(COMMON_NAME_ERR, " ##(%s) -> %s() assert!!## "fmt, #expr, __FUNCTION__, ##arg); \
146                 assert(1); \
147         } \
148 } while (0) /* retvm if */
149
150 #ifdef __cplusplus
151 }
152 #endif
153
154 #endif