示例#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
}
示例#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
}
示例#3
0
func (w *window) SetTitle(title string) {
	ctitle := C.CString(title)
	defer C.free(unsafe.Pointer(ctitle))
	C.windowSetTitle(w.id, ctitle)
}
示例#4
0
	C.applyStandardControlFont(id)
}

var classTypes = [nctypes]*classData{
	c_window: &classData{
		make: func(parentWindow C.id, alternate bool, s *sysData) C.id {
			return C.makeWindow(appDelegate)
		},
		show: func(what C.id) {
			C.windowShow(what)
		},
		hide: func(what C.id) {
			C.windowHide(what)
		},
		settext: func(what C.id, text C.id) {
			C.windowSetTitle(what, text)
		},
		text: func(what C.id, alternate bool) C.id {
			return C.windowTitle(what)
		},
	},
	c_button: &classData{
		make: func(parentWindow C.id, alternate bool, s *sysData) C.id {
			button := C.makeButton()
			C.buttonSetTargetAction(button, appDelegate)
			applyStandardControlFont(button)
			addControl(parentWindow, button)
			return button
		},
		show: controlShow,
		hide: controlHide,