package qt /* #include "gen_qmenu.h" #include */ import "C" import ( "runtime" "runtime/cgo" "unsafe" ) type QMenu struct { h *C.QMenu *QWidget } func (this *QMenu) cPointer() *C.QMenu { if this == nil { return nil } return this.h } func newQMenu(h *C.QMenu) *QMenu { if h == nil { return nil } return &QMenu{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))} } func newQMenu_U(h unsafe.Pointer) *QMenu { return newQMenu((*C.QMenu)(h)) } // NewQMenu constructs a new QMenu object. func NewQMenu() *QMenu { ret := C.QMenu_new() return newQMenu(ret) } // NewQMenu2 constructs a new QMenu object. func NewQMenu2(title string) *QMenu { title_ms := miqt_strdupg(title) defer C.free(title_ms) ret := C.QMenu_new2((*C.struct_miqt_string)(title_ms)) return newQMenu(ret) } // NewQMenu3 constructs a new QMenu object. func NewQMenu3(parent *QWidget) *QMenu { ret := C.QMenu_new3(parent.cPointer()) return newQMenu(ret) } // NewQMenu4 constructs a new QMenu object. func NewQMenu4(title string, parent *QWidget) *QMenu { title_ms := miqt_strdupg(title) defer C.free(title_ms) ret := C.QMenu_new4((*C.struct_miqt_string)(title_ms), parent.cPointer()) return newQMenu(ret) } func (this *QMenu) MetaObject() *QMetaObject { return newQMetaObject_U(unsafe.Pointer(C.QMenu_MetaObject(this.h))) } func (this *QMenu) Metacast(param1 string) unsafe.Pointer { param1_Cstring := C.CString(param1) defer C.free(unsafe.Pointer(param1_Cstring)) return C.QMenu_Metacast(this.h, param1_Cstring) } func QMenu_Tr(s string) string { s_Cstring := C.CString(s) defer C.free(unsafe.Pointer(s_Cstring)) var _ms *C.struct_miqt_string = C.QMenu_Tr(s_Cstring) _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) C.free(unsafe.Pointer(_ms)) return _ret } func QMenu_TrUtf8(s string) string { s_Cstring := C.CString(s) defer C.free(unsafe.Pointer(s_Cstring)) var _ms *C.struct_miqt_string = C.QMenu_TrUtf8(s_Cstring) _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) C.free(unsafe.Pointer(_ms)) return _ret } func (this *QMenu) AddAction(text string) *QAction { text_ms := miqt_strdupg(text) defer C.free(text_ms) return newQAction_U(unsafe.Pointer(C.QMenu_AddAction(this.h, (*C.struct_miqt_string)(text_ms)))) } func (this *QMenu) AddAction2(icon *QIcon, text string) *QAction { text_ms := miqt_strdupg(text) defer C.free(text_ms) return newQAction_U(unsafe.Pointer(C.QMenu_AddAction2(this.h, icon.cPointer(), (*C.struct_miqt_string)(text_ms)))) } func (this *QMenu) AddMenu(menu *QMenu) *QAction { return newQAction_U(unsafe.Pointer(C.QMenu_AddMenu(this.h, menu.cPointer()))) } func (this *QMenu) AddMenuWithTitle(title string) *QMenu { title_ms := miqt_strdupg(title) defer C.free(title_ms) return newQMenu_U(unsafe.Pointer(C.QMenu_AddMenuWithTitle(this.h, (*C.struct_miqt_string)(title_ms)))) } func (this *QMenu) AddMenu2(icon *QIcon, title string) *QMenu { title_ms := miqt_strdupg(title) defer C.free(title_ms) return newQMenu_U(unsafe.Pointer(C.QMenu_AddMenu2(this.h, icon.cPointer(), (*C.struct_miqt_string)(title_ms)))) } func (this *QMenu) AddSeparator() *QAction { return newQAction_U(unsafe.Pointer(C.QMenu_AddSeparator(this.h))) } func (this *QMenu) AddSection(text string) *QAction { text_ms := miqt_strdupg(text) defer C.free(text_ms) return newQAction_U(unsafe.Pointer(C.QMenu_AddSection(this.h, (*C.struct_miqt_string)(text_ms)))) } func (this *QMenu) AddSection2(icon *QIcon, text string) *QAction { text_ms := miqt_strdupg(text) defer C.free(text_ms) return newQAction_U(unsafe.Pointer(C.QMenu_AddSection2(this.h, icon.cPointer(), (*C.struct_miqt_string)(text_ms)))) } func (this *QMenu) InsertMenu(before *QAction, menu *QMenu) *QAction { return newQAction_U(unsafe.Pointer(C.QMenu_InsertMenu(this.h, before.cPointer(), menu.cPointer()))) } func (this *QMenu) InsertSeparator(before *QAction) *QAction { return newQAction_U(unsafe.Pointer(C.QMenu_InsertSeparator(this.h, before.cPointer()))) } func (this *QMenu) InsertSection(before *QAction, text string) *QAction { text_ms := miqt_strdupg(text) defer C.free(text_ms) return newQAction_U(unsafe.Pointer(C.QMenu_InsertSection(this.h, before.cPointer(), (*C.struct_miqt_string)(text_ms)))) } func (this *QMenu) InsertSection2(before *QAction, icon *QIcon, text string) *QAction { text_ms := miqt_strdupg(text) defer C.free(text_ms) return newQAction_U(unsafe.Pointer(C.QMenu_InsertSection2(this.h, before.cPointer(), icon.cPointer(), (*C.struct_miqt_string)(text_ms)))) } func (this *QMenu) IsEmpty() bool { return (bool)(C.QMenu_IsEmpty(this.h)) } func (this *QMenu) Clear() { C.QMenu_Clear(this.h) } func (this *QMenu) SetTearOffEnabled(tearOffEnabled bool) { C.QMenu_SetTearOffEnabled(this.h, (C.bool)(tearOffEnabled)) } func (this *QMenu) IsTearOffEnabled() bool { return (bool)(C.QMenu_IsTearOffEnabled(this.h)) } func (this *QMenu) IsTearOffMenuVisible() bool { return (bool)(C.QMenu_IsTearOffMenuVisible(this.h)) } func (this *QMenu) ShowTearOffMenu() { C.QMenu_ShowTearOffMenu(this.h) } func (this *QMenu) ShowTearOffMenuWithPos(pos *QPoint) { C.QMenu_ShowTearOffMenuWithPos(this.h, pos.cPointer()) } func (this *QMenu) HideTearOffMenu() { C.QMenu_HideTearOffMenu(this.h) } func (this *QMenu) SetDefaultAction(defaultAction *QAction) { C.QMenu_SetDefaultAction(this.h, defaultAction.cPointer()) } func (this *QMenu) DefaultAction() *QAction { return newQAction_U(unsafe.Pointer(C.QMenu_DefaultAction(this.h))) } func (this *QMenu) SetActiveAction(act *QAction) { C.QMenu_SetActiveAction(this.h, act.cPointer()) } func (this *QMenu) ActiveAction() *QAction { return newQAction_U(unsafe.Pointer(C.QMenu_ActiveAction(this.h))) } func (this *QMenu) Popup(pos *QPoint) { C.QMenu_Popup(this.h, pos.cPointer()) } func (this *QMenu) Exec() *QAction { return newQAction_U(unsafe.Pointer(C.QMenu_Exec(this.h))) } func (this *QMenu) ExecWithPos(pos *QPoint) *QAction { return newQAction_U(unsafe.Pointer(C.QMenu_ExecWithPos(this.h, pos.cPointer()))) } func QMenu_Exec2(actions []*QAction, pos *QPoint) *QAction { // For the C ABI, malloc a C array of raw pointers actions_CArray := (*[0xffff]*C.QAction)(C.malloc(C.size_t(8 * len(actions)))) defer C.free(unsafe.Pointer(actions_CArray)) for i := range actions { actions_CArray[i] = actions[i].cPointer() } actions_ma := &C.struct_miqt_array{len: C.size_t(len(actions)), data: unsafe.Pointer(actions_CArray)} defer runtime.KeepAlive(unsafe.Pointer(actions_ma)) return newQAction_U(unsafe.Pointer(C.QMenu_Exec2(actions_ma, pos.cPointer()))) } func (this *QMenu) SizeHint() *QSize { _ret := C.QMenu_SizeHint(this.h) _goptr := newQSize(_ret) _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer return _goptr } func (this *QMenu) ActionGeometry(param1 *QAction) *QRect { _ret := C.QMenu_ActionGeometry(this.h, param1.cPointer()) _goptr := newQRect(_ret) _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer return _goptr } func (this *QMenu) ActionAt(param1 *QPoint) *QAction { return newQAction_U(unsafe.Pointer(C.QMenu_ActionAt(this.h, param1.cPointer()))) } func (this *QMenu) MenuAction() *QAction { return newQAction_U(unsafe.Pointer(C.QMenu_MenuAction(this.h))) } func (this *QMenu) Title() string { var _ms *C.struct_miqt_string = C.QMenu_Title(this.h) _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) C.free(unsafe.Pointer(_ms)) return _ret } func (this *QMenu) SetTitle(title string) { title_ms := miqt_strdupg(title) defer C.free(title_ms) C.QMenu_SetTitle(this.h, (*C.struct_miqt_string)(title_ms)) } func (this *QMenu) Icon() *QIcon { _ret := C.QMenu_Icon(this.h) _goptr := newQIcon(_ret) _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer return _goptr } func (this *QMenu) SetIcon(icon *QIcon) { C.QMenu_SetIcon(this.h, icon.cPointer()) } func (this *QMenu) SetNoReplayFor(widget *QWidget) { C.QMenu_SetNoReplayFor(this.h, widget.cPointer()) } func (this *QMenu) SeparatorsCollapsible() bool { return (bool)(C.QMenu_SeparatorsCollapsible(this.h)) } func (this *QMenu) SetSeparatorsCollapsible(collapse bool) { C.QMenu_SetSeparatorsCollapsible(this.h, (C.bool)(collapse)) } func (this *QMenu) ToolTipsVisible() bool { return (bool)(C.QMenu_ToolTipsVisible(this.h)) } func (this *QMenu) SetToolTipsVisible(visible bool) { C.QMenu_SetToolTipsVisible(this.h, (C.bool)(visible)) } func (this *QMenu) AboutToShow() { C.QMenu_AboutToShow(this.h) } func (this *QMenu) OnAboutToShow(slot func()) { C.QMenu_connect_AboutToShow(this.h, unsafe.Pointer(uintptr(cgo.NewHandle(slot)))) } //export miqt_exec_callback_QMenu_AboutToShow func miqt_exec_callback_QMenu_AboutToShow(cb *C.void) { gofunc, ok := (cgo.Handle(uintptr(unsafe.Pointer(cb))).Value()).(func()) if !ok { panic("miqt: callback of non-callback type (heap corruption?)") } gofunc() } func (this *QMenu) AboutToHide() { C.QMenu_AboutToHide(this.h) } func (this *QMenu) OnAboutToHide(slot func()) { C.QMenu_connect_AboutToHide(this.h, unsafe.Pointer(uintptr(cgo.NewHandle(slot)))) } //export miqt_exec_callback_QMenu_AboutToHide func miqt_exec_callback_QMenu_AboutToHide(cb *C.void) { gofunc, ok := (cgo.Handle(uintptr(unsafe.Pointer(cb))).Value()).(func()) if !ok { panic("miqt: callback of non-callback type (heap corruption?)") } gofunc() } func (this *QMenu) Triggered(action *QAction) { C.QMenu_Triggered(this.h, action.cPointer()) } func (this *QMenu) OnTriggered(slot func(action *QAction)) { C.QMenu_connect_Triggered(this.h, unsafe.Pointer(uintptr(cgo.NewHandle(slot)))) } //export miqt_exec_callback_QMenu_Triggered func miqt_exec_callback_QMenu_Triggered(cb *C.void, action *C.QAction) { gofunc, ok := (cgo.Handle(uintptr(unsafe.Pointer(cb))).Value()).(func(action *QAction)) if !ok { panic("miqt: callback of non-callback type (heap corruption?)") } // Convert all CABI parameters to Go parameters slotval1 := newQAction_U(unsafe.Pointer(action)) gofunc(slotval1) } func (this *QMenu) Hovered(action *QAction) { C.QMenu_Hovered(this.h, action.cPointer()) } func (this *QMenu) OnHovered(slot func(action *QAction)) { C.QMenu_connect_Hovered(this.h, unsafe.Pointer(uintptr(cgo.NewHandle(slot)))) } //export miqt_exec_callback_QMenu_Hovered func miqt_exec_callback_QMenu_Hovered(cb *C.void, action *C.QAction) { gofunc, ok := (cgo.Handle(uintptr(unsafe.Pointer(cb))).Value()).(func(action *QAction)) if !ok { panic("miqt: callback of non-callback type (heap corruption?)") } // Convert all CABI parameters to Go parameters slotval1 := newQAction_U(unsafe.Pointer(action)) gofunc(slotval1) } func QMenu_Tr2(s string, c string) string { s_Cstring := C.CString(s) defer C.free(unsafe.Pointer(s_Cstring)) c_Cstring := C.CString(c) defer C.free(unsafe.Pointer(c_Cstring)) var _ms *C.struct_miqt_string = C.QMenu_Tr2(s_Cstring, c_Cstring) _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) C.free(unsafe.Pointer(_ms)) return _ret } func QMenu_Tr3(s string, c string, n int) string { s_Cstring := C.CString(s) defer C.free(unsafe.Pointer(s_Cstring)) c_Cstring := C.CString(c) defer C.free(unsafe.Pointer(c_Cstring)) var _ms *C.struct_miqt_string = C.QMenu_Tr3(s_Cstring, c_Cstring, (C.int)(n)) _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) C.free(unsafe.Pointer(_ms)) return _ret } func QMenu_TrUtf82(s string, c string) string { s_Cstring := C.CString(s) defer C.free(unsafe.Pointer(s_Cstring)) c_Cstring := C.CString(c) defer C.free(unsafe.Pointer(c_Cstring)) var _ms *C.struct_miqt_string = C.QMenu_TrUtf82(s_Cstring, c_Cstring) _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) C.free(unsafe.Pointer(_ms)) return _ret } func QMenu_TrUtf83(s string, c string, n int) string { s_Cstring := C.CString(s) defer C.free(unsafe.Pointer(s_Cstring)) c_Cstring := C.CString(c) defer C.free(unsafe.Pointer(c_Cstring)) var _ms *C.struct_miqt_string = C.QMenu_TrUtf83(s_Cstring, c_Cstring, (C.int)(n)) _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) C.free(unsafe.Pointer(_ms)) return _ret } func (this *QMenu) Popup2(pos *QPoint, at *QAction) { C.QMenu_Popup2(this.h, pos.cPointer(), at.cPointer()) } func (this *QMenu) Exec22(pos *QPoint, at *QAction) *QAction { return newQAction_U(unsafe.Pointer(C.QMenu_Exec22(this.h, pos.cPointer(), at.cPointer()))) } func QMenu_Exec3(actions []*QAction, pos *QPoint, at *QAction) *QAction { // For the C ABI, malloc a C array of raw pointers actions_CArray := (*[0xffff]*C.QAction)(C.malloc(C.size_t(8 * len(actions)))) defer C.free(unsafe.Pointer(actions_CArray)) for i := range actions { actions_CArray[i] = actions[i].cPointer() } actions_ma := &C.struct_miqt_array{len: C.size_t(len(actions)), data: unsafe.Pointer(actions_CArray)} defer runtime.KeepAlive(unsafe.Pointer(actions_ma)) return newQAction_U(unsafe.Pointer(C.QMenu_Exec3(actions_ma, pos.cPointer(), at.cPointer()))) } func QMenu_Exec4(actions []*QAction, pos *QPoint, at *QAction, parent *QWidget) *QAction { // For the C ABI, malloc a C array of raw pointers actions_CArray := (*[0xffff]*C.QAction)(C.malloc(C.size_t(8 * len(actions)))) defer C.free(unsafe.Pointer(actions_CArray)) for i := range actions { actions_CArray[i] = actions[i].cPointer() } actions_ma := &C.struct_miqt_array{len: C.size_t(len(actions)), data: unsafe.Pointer(actions_CArray)} defer runtime.KeepAlive(unsafe.Pointer(actions_ma)) return newQAction_U(unsafe.Pointer(C.QMenu_Exec4(actions_ma, pos.cPointer(), at.cPointer(), parent.cPointer()))) } // Delete this object from C++ memory. func (this *QMenu) Delete() { C.QMenu_Delete(this.h) } // GoGC adds a Go Finalizer to this pointer, so that it will be deleted // from C++ memory once it is unreachable from Go memory. func (this *QMenu) GoGC() { runtime.SetFinalizer(this, func(this *QMenu) { this.Delete() runtime.KeepAlive(this.h) }) }