Ejemplo n.º 1
0
func startGui(width, height int, title string, port int) {
	C.gtk_init(nil, nil) //gtk.Init(nil)

	window := C.window
	window = C.gtk_window_new(C.GTK_WINDOW_TOPLEVEL)
	C.gtk_window_set_title(C.to_GtkWindow(window), C.to_gcharptr(C.CString(title)))
	C.connect_destroy(window)

	vbox := C.gtk_hbox_new(0, 1)

	C.webview = C._new_webkit()

	C.gtk_container_add(C.to_GtkContainer(vbox), C.webview)

	C.loadUri(C.webview, C.to_gcharptr(C.CString(fmt.Sprintf("http://127.0.0.1:%d", port))))

	C.gtk_container_add(C.to_GtkContainer(window), vbox)
	C.gtk_widget_set_size_request(window, C.gint(width), C.gint(height))

	C.gtk_widget_show(vbox)
	C.gtk_widget_show(window) //Window.ShowAll()
	C.gtk_widget_show(C.webview)

	/*
		This only matters if proxy is stupid!
		proxy := os.Getenv("HTTP_PROXY")
		if len(proxy) > 0 {
			ptr := C.CString(uri)
			C.proxyshit(ptr)
			C.free(ptr)
		}
	*/

	C.gtk_main() //gtk.GtkMain()
}
Ejemplo n.º 2
0
Archivo: box.go Proyecto: ziutek/gtk
func NewHBox(homogeneous bool, spacing int) *HBox {
	b := new(HBox)
	var h C.gboolean
	if homogeneous {
		h = 1
	}
	b.SetPtr(glib.Pointer(C.gtk_hbox_new(h, C.gint(spacing))))
	return b
}
Ejemplo n.º 3
0
func gtk_hbox_new(homogeneous bool, spacing int) GtkWidget {
	return GtkWidget(C.gtk_hbox_new(C.bool(Bool2Int[homogeneous]), C.int(spacing)))
}