ui/gtk/window.c

changeset 111
40dbf1a7526a
parent 107
9aff1dc3990d
child 128
c284c15509a8
equal deleted inserted replaced
110:36f1581b43e2 111:40dbf1a7526a
38 #include "toolbar.h" 38 #include "toolbar.h"
39 #include "container.h" 39 #include "container.h"
40 40
41 static int nwindows = 0; 41 static int nwindows = 0;
42 42
43 static ui_callback wclose_fnc = NULL;
44 static void *wclose_udata = NULL;
45
46 static int window_default_width = 650; 43 static int window_default_width = 650;
47 static int window_default_height = 550; 44 static int window_default_height = 550;
48 45
49 void ui_exit_event(GtkWidget *widget, gpointer data) { 46 void ui_exit_event(GtkWidget *widget, gpointer data) {
50 if(wclose_fnc) { 47 UiObject *obj = data;
51 // TODO: use UiEvent 48 UiEvent ev;
52 wclose_fnc(data, wclose_udata); 49 ev.window = obj->window;
50 ev.document = obj->ctx->document;
51 ev.obj = obj;
52 ev.eventdata = NULL;
53 ev.intval = 0;
54
55 if(obj->ctx->close_callback) {
56 obj->ctx->close_callback(&ev, obj->ctx->close_data);
53 } 57 }
58 // TODO: free UiObject
59
54 nwindows--; 60 nwindows--;
55 if(nwindows == 0) { 61 if(nwindows == 0) {
56 gtk_main_quit(); 62 gtk_main_quit();
57 } 63 }
58 } 64 }
83 89
84 g_signal_connect( 90 g_signal_connect(
85 obj->widget, 91 obj->widget,
86 "destroy", 92 "destroy",
87 G_CALLBACK(ui_exit_event), 93 G_CALLBACK(ui_exit_event),
88 window_data); 94 obj);
89 95
90 GtkWidget *vbox = ui_gtk_vbox_new(0); 96 GtkWidget *vbox = ui_gtk_vbox_new(0);
91 gtk_container_add(GTK_CONTAINER(obj->widget), vbox); 97 gtk_container_add(GTK_CONTAINER(obj->widget), vbox);
92 98
93 if(!simple) { 99 if(!simple) {

mercurial