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