1 #ifndef ELM_WIDGET_WEB_H
2 #define ELM_WIDGET_WEB_H
4 #ifdef HAVE_ELEMENTARY_WEB
16 * @section elm-web-class The Elementary Web Class
18 * Elementary, besides having the @ref Web widget, exposes its
19 * foundation -- the Elementary Web Class -- in order to create other
20 * widgets which are a web view with some more logic on top.
26 * Use this macro to cast whichever subclass of
27 * #Elm_Web_Smart_Class into it, so to access its fields.
31 #define ELM_WEB_CLASS(x) ((Elm_Web_Smart_Class *) x)
36 * Use this macro to cast whichever subdata of
37 * #Elm_Web_Smart_Data into it, so to access its fields.
41 #define ELM_WEB_DATA(x) ((Elm_Web_Smart_Data *) x)
44 * @def ELM_WEB_SMART_CLASS_VERSION
46 * Current version for Elementary web @b base smart class, a value
47 * which goes to _Elm_Web_Smart_Class::version.
51 #define ELM_WEB_SMART_CLASS_VERSION 1
54 * @def ELM_WEB_SMART_CLASS_INIT
56 * Initializer for a whole #Elm_Web_Smart_Class structure, with
57 * @c NULL values on its specific fields.
59 * @param smart_class_init initializer to use for the "base" field
60 * (#Evas_Smart_Class).
62 * @see EVAS_SMART_CLASS_INIT_NULL
63 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION
64 * @see ELM_WEB_SMART_CLASS_INIT_NULL
65 * @see ELM_WEB_SMART_CLASS_INIT_NAME_VERSION
69 #define ELM_WEB_SMART_CLASS_INIT(smart_class_init) \
70 {smart_class_init, ELM_WEB_SMART_CLASS_VERSION}
73 * @def ELM_WEB_SMART_CLASS_INIT_NULL
75 * Initializer to zero out a whole #Elm_Web_Smart_Class structure.
77 * @see ELM_WEB_SMART_CLASS_INIT_NAME_VERSION
78 * @see ELM_WEB_SMART_CLASS_INIT
82 #define ELM_WEB_SMART_CLASS_INIT_NULL \
83 ELM_WEB_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
86 * @def ELM_WEB_SMART_CLASS_INIT_NAME_VERSION
88 * Initializer to zero out a whole #Elm_Web_Smart_Class structure and
89 * set its name and version.
91 * This is similar to #ELM_WEB_SMART_CLASS_INIT_NULL, but it will
92 * also set the version field of #Elm_Web_Smart_Class (base field)
93 * to the latest #ELM_WEB_SMART_CLASS_VERSION and name it to the
96 * It will keep a reference to the name field as a <c>"const char *"</c>,
97 * i.e., the name must be available while the structure is
98 * used (hint: static or global variable!) and must not be modified.
100 * @see ELM_WEB_SMART_CLASS_INIT_NULL
101 * @see ELM_WEB_SMART_CLASS_INIT
105 #define ELM_WEB_SMART_CLASS_INIT_NAME_VERSION(name) \
106 ELM_WEB_SMART_CLASS_INIT(ELM_WIDGET_SMART_CLASS_INIT_NAME_VERSION(name))
109 * Elementary web base smart class. This inherits directly from
110 * #Elm_Widget_Smart_Class and is meant to build widgets extending the
113 * All of the functions listed on @ref Web namespace will work for
114 * objects deriving from #Elm_Web_Smart_Class.
116 typedef struct _Elm_Web_Smart_Class
118 Elm_Widget_Smart_Class base;
120 int version; /**< Version of this smart class definition */
121 } Elm_Web_Smart_Class;
124 * Base widget smart data extended with web instance data.
126 typedef struct _Elm_Web_Smart_Data Elm_Web_Smart_Data;
127 struct _Elm_Web_Smart_Data
129 Elm_Widget_Smart_Data base; /* base widget smart data as
130 * first member obligatory, as
131 * we're inheriting from it */
133 #ifdef HAVE_ELEMENTARY_WEB
136 Elm_Web_Window_Open window_create;
137 void *window_create_data;
138 Elm_Web_Dialog_Alert alert;
140 Elm_Web_Dialog_Confirm confirm;
142 Elm_Web_Dialog_Prompt prompt;
144 Elm_Web_Dialog_File_Selector file_selector;
145 void *file_selector_data;
146 Elm_Web_Console_Message console_message;
147 void *console_message_data;
150 Elm_Win_Keyboard_Mode input_method;
154 Elm_Web_Zoom_Mode mode;
167 Ecore_Animator *animator;
170 Eina_Bool tab_propagate : 1;
171 Eina_Bool inwin_mode : 1;
183 typedef struct _Dialog_Data Dialog_Data;
186 enum Dialog_Type type;
190 Evas_Object *bt_ok, *bt_cancel;
192 Evas_Object *file_sel;
195 const char **entry_value;
196 Eina_List **selected_files;
199 struct _Elm_Web_Callback_Proxy_Context
204 typedef struct _Elm_Web_Callback_Proxy_Context Elm_Web_Callback_Proxy_Context;
206 #ifdef HAVE_ELEMENTARY_WEB
208 typedef struct _View_Smart_Data View_Smart_Data;
209 struct _View_Smart_Data
211 Ewk_View_Smart_Data base;
214 Evas_Event_Mouse_Down event;
216 unsigned int move_count;
217 Ecore_Timer *longpress_timer;
218 Ecore_Animator *pan_anim;
228 EAPI extern const char ELM_WEB_SMART_NAME[];
229 EAPI const Elm_Web_Smart_Class *elm_web_smart_class_get(void);
231 #define ELM_WEB_DATA_GET(o, sd) \
232 Elm_Web_Smart_Data * sd = evas_object_smart_data_get(o)
234 #define ELM_WEB_DATA_GET_OR_RETURN(o, ptr) \
235 ELM_WEB_DATA_GET(o, ptr); \
238 CRITICAL("No widget data for object %p (%s)", \
239 o, evas_object_type_get(o)); \
243 #define ELM_WEB_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
244 ELM_WEB_DATA_GET(o, ptr); \
247 CRITICAL("No widget data for object %p (%s)", \
248 o, evas_object_type_get(o)); \
252 #define ELM_WEB_CHECK(obj) \
253 if (!obj || !elm_widget_type_check((obj), ELM_WEB_SMART_NAME, __func__)) \