Example #1
0
func newWindow(title string, width int, height int, control Control) *window {
	id := C.newWindow(C.intptr_t(width), C.intptr_t(height))
	ctitle := C.CString(title)
	defer C.free(unsafe.Pointer(ctitle))
	C.windowSetTitle(id, ctitle)
	w := &window{
		id:        id,
		closing:   newEvent(),
		container: newContainer(control),
	}
	C.windowSetDelegate(w.id, unsafe.Pointer(w))
	C.windowSetContentView(w.id, w.container.id)
	return w
}
Example #2
0
func newWindow(title string, width int, height int, control Control) *window {
	id := C.newWindow(C.intptr_t(width), C.intptr_t(height))
	ctitle := C.CString(title)
	defer C.free(unsafe.Pointer(ctitle))
	C.windowSetTitle(id, ctitle)
	w := &window{
		id:      id,
		closing: newEvent(),
		child:   control,
	}
	C.windowSetDelegate(w.id, unsafe.Pointer(w))
	w.container = newContainer(w.child.resize)
	w.child.setParent(w.container.parent())
	C.windowSetContentView(w.id, w.container.id)
	// trigger an initial resize
	return w
}