| 28 |
28 |
| 29 #include "toolkit.h" |
29 #include "toolkit.h" |
| 30 #include "container.h" |
30 #include "container.h" |
| 31 |
31 |
| 32 #include "webview.h" |
32 #include "webview.h" |
| |
33 #include "widget.h" |
| 33 |
34 |
| 34 #ifdef UI_WEBVIEW |
35 #ifdef UI_WEBVIEW |
| 35 |
36 |
| 36 UIWIDGET ui_webview_create(UiObject *obj, UiWebviewArgs *args) { |
37 UIWIDGET ui_webview_create(UiObject *obj, UiWebviewArgs *args) { |
| 37 GtkWidget *webview = webkit_web_view_new(); |
38 GtkWidget *webview = webkit_web_view_new(); |
| 38 |
39 |
| 39 ui_set_name_and_style(webview, args->name, args->style_class); |
40 ui_set_name_and_style(webview, args->name, args->style_class); |
| |
41 |
| |
42 ui_widget_size_request(webview, args->width, args->height); |
| 40 |
43 |
| 41 UiVar *var = uic_widget_var(obj->ctx, obj->ctx, args->value, args->varname, UI_VAR_GENERIC); |
44 UiVar *var = uic_widget_var(obj->ctx, obj->ctx, args->value, args->varname, UI_VAR_GENERIC); |
| 42 if(var) { |
45 if(var) { |
| 43 WebViewData *data = malloc(sizeof(WebViewData)); |
46 WebViewData *data = malloc(sizeof(WebViewData)); |
| 44 memset(data, 0, sizeof(WebViewData)); |
47 memset(data, 0, sizeof(WebViewData)); |
| 55 if(value->value && value->type && !strcmp(value->type, UI_WEBVIEW_OBJECT_TYPE)) { |
58 if(value->value && value->type && !strcmp(value->type, UI_WEBVIEW_OBJECT_TYPE)) { |
| 56 ui_webview_set(value, value->value, UI_WEBVIEW_OBJECT_TYPE); |
59 ui_webview_set(value, value->value, UI_WEBVIEW_OBJECT_TYPE); |
| 57 } |
60 } |
| 58 } |
61 } |
| 59 |
62 |
| 60 ui_set_widget_groups(obj->ctx, webview, args->groups); |
63 ui_set_widget_states(obj->ctx, webview, args->states); |
| 61 UiContainerPrivate *ct = (UiContainerPrivate*)obj->container_end; |
64 UiContainerPrivate *ct = (UiContainerPrivate*)obj->container_end; |
| 62 UiLayout layout = UI_ARGS2LAYOUT(args); |
65 UiLayout layout = UI_ARGS2LAYOUT(args); |
| 63 ct->add(ct, webview, &layout); |
66 ct->add(ct, webview, &layout); |
| 64 |
67 |
| 65 return webview; |
68 return webview; |