2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qmenu.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QMenu) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQMenu(h *C.QMenu) *QMenu {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-10-16 05:07:56 +00:00
|
|
|
return &QMenu{h: h, QWidget: UnsafeNewQWidget(unsafe.Pointer(h))}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQMenu(h unsafe.Pointer) *QMenu {
|
2024-08-25 04:08:24 +00:00
|
|
|
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 {
|
2024-10-18 23:53:33 +00:00
|
|
|
title_ms := C.struct_miqt_string{}
|
|
|
|
title_ms.data = C.CString(title)
|
|
|
|
title_ms.len = C.size_t(len(title))
|
|
|
|
defer C.free(unsafe.Pointer(title_ms.data))
|
|
|
|
ret := C.QMenu_new2(title_ms)
|
2024-08-25 04:08:24 +00:00
|
|
|
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 {
|
2024-10-18 23:53:33 +00:00
|
|
|
title_ms := C.struct_miqt_string{}
|
|
|
|
title_ms.data = C.CString(title)
|
|
|
|
title_ms.len = C.size_t(len(title))
|
|
|
|
defer C.free(unsafe.Pointer(title_ms.data))
|
|
|
|
ret := C.QMenu_new4(title_ms, parent.cPointer())
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQMenu(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) MetaObject() *QMetaObject {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQMetaObject(unsafe.Pointer(C.QMenu_MetaObject(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-20 22:32:57 +00:00
|
|
|
func (this *QMenu) Metacast(param1 string) unsafe.Pointer {
|
|
|
|
param1_Cstring := C.CString(param1)
|
|
|
|
defer C.free(unsafe.Pointer(param1_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
return (unsafe.Pointer)(C.QMenu_Metacast(this.h, param1_Cstring))
|
2024-09-20 22:32:57 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func QMenu_Tr(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
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.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QMenu_TrUtf8(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
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.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) AddAction(text string) *QAction {
|
2024-10-18 23:53:33 +00:00
|
|
|
text_ms := C.struct_miqt_string{}
|
|
|
|
text_ms.data = C.CString(text)
|
|
|
|
text_ms.len = C.size_t(len(text))
|
|
|
|
defer C.free(unsafe.Pointer(text_ms.data))
|
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_AddAction(this.h, text_ms)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) AddAction2(icon *QIcon, text string) *QAction {
|
2024-10-18 23:53:33 +00:00
|
|
|
text_ms := C.struct_miqt_string{}
|
|
|
|
text_ms.data = C.CString(text)
|
|
|
|
text_ms.len = C.size_t(len(text))
|
|
|
|
defer C.free(unsafe.Pointer(text_ms.data))
|
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_AddAction2(this.h, icon.cPointer(), text_ms)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) AddMenu(menu *QMenu) *QAction {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_AddMenu(this.h, menu.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) AddMenuWithTitle(title string) *QMenu {
|
2024-10-18 23:53:33 +00:00
|
|
|
title_ms := C.struct_miqt_string{}
|
|
|
|
title_ms.data = C.CString(title)
|
|
|
|
title_ms.len = C.size_t(len(title))
|
|
|
|
defer C.free(unsafe.Pointer(title_ms.data))
|
|
|
|
return UnsafeNewQMenu(unsafe.Pointer(C.QMenu_AddMenuWithTitle(this.h, title_ms)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) AddMenu2(icon *QIcon, title string) *QMenu {
|
2024-10-18 23:53:33 +00:00
|
|
|
title_ms := C.struct_miqt_string{}
|
|
|
|
title_ms.data = C.CString(title)
|
|
|
|
title_ms.len = C.size_t(len(title))
|
|
|
|
defer C.free(unsafe.Pointer(title_ms.data))
|
|
|
|
return UnsafeNewQMenu(unsafe.Pointer(C.QMenu_AddMenu2(this.h, icon.cPointer(), title_ms)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) AddSeparator() *QAction {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_AddSeparator(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) AddSection(text string) *QAction {
|
2024-10-18 23:53:33 +00:00
|
|
|
text_ms := C.struct_miqt_string{}
|
|
|
|
text_ms.data = C.CString(text)
|
|
|
|
text_ms.len = C.size_t(len(text))
|
|
|
|
defer C.free(unsafe.Pointer(text_ms.data))
|
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_AddSection(this.h, text_ms)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) AddSection2(icon *QIcon, text string) *QAction {
|
2024-10-18 23:53:33 +00:00
|
|
|
text_ms := C.struct_miqt_string{}
|
|
|
|
text_ms.data = C.CString(text)
|
|
|
|
text_ms.len = C.size_t(len(text))
|
|
|
|
defer C.free(unsafe.Pointer(text_ms.data))
|
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_AddSection2(this.h, icon.cPointer(), text_ms)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) InsertMenu(before *QAction, menu *QMenu) *QAction {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_InsertMenu(this.h, before.cPointer(), menu.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) InsertSeparator(before *QAction) *QAction {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_InsertSeparator(this.h, before.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) InsertSection(before *QAction, text string) *QAction {
|
2024-10-18 23:53:33 +00:00
|
|
|
text_ms := C.struct_miqt_string{}
|
|
|
|
text_ms.data = C.CString(text)
|
|
|
|
text_ms.len = C.size_t(len(text))
|
|
|
|
defer C.free(unsafe.Pointer(text_ms.data))
|
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_InsertSection(this.h, before.cPointer(), text_ms)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) InsertSection2(before *QAction, icon *QIcon, text string) *QAction {
|
2024-10-18 23:53:33 +00:00
|
|
|
text_ms := C.struct_miqt_string{}
|
|
|
|
text_ms.data = C.CString(text)
|
|
|
|
text_ms.len = C.size_t(len(text))
|
|
|
|
defer C.free(unsafe.Pointer(text_ms.data))
|
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_InsertSection2(this.h, before.cPointer(), icon.cPointer(), text_ms)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) IsEmpty() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QMenu_IsEmpty(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QMenu_IsTearOffEnabled(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) IsTearOffMenuVisible() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QMenu_IsTearOffMenuVisible(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_DefaultAction(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) SetActiveAction(act *QAction) {
|
|
|
|
C.QMenu_SetActiveAction(this.h, act.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) ActiveAction() *QAction {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_ActiveAction(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) Popup(pos *QPoint) {
|
|
|
|
C.QMenu_Popup(this.h, pos.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) Exec() *QAction {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_Exec(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) ExecWithPos(pos *QPoint) *QAction {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_ExecWithPos(this.h, pos.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QMenu_Exec2(actions []*QAction, pos *QPoint) *QAction {
|
|
|
|
// For the C ABI, malloc a C array of raw pointers
|
2024-09-01 05:51:28 +00:00
|
|
|
actions_CArray := (*[0xffff]*C.QAction)(C.malloc(C.size_t(8 * len(actions))))
|
2024-08-25 04:08:24 +00:00
|
|
|
defer C.free(unsafe.Pointer(actions_CArray))
|
|
|
|
for i := range actions {
|
|
|
|
actions_CArray[i] = actions[i].cPointer()
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
actions_ma := &C.struct_miqt_array{len: C.size_t(len(actions)), data: unsafe.Pointer(actions_CArray)}
|
|
|
|
defer runtime.KeepAlive(unsafe.Pointer(actions_ma))
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_Exec2(actions_ma, pos.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) SizeHint() *QSize {
|
2024-09-14 22:29:05 +00:00
|
|
|
_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
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) ActionGeometry(param1 *QAction) *QRect {
|
2024-09-14 22:29:05 +00:00
|
|
|
_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
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) ActionAt(param1 *QPoint) *QAction {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_ActionAt(this.h, param1.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) MenuAction() *QAction {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_MenuAction(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) Title() string {
|
2024-10-18 23:53:33 +00:00
|
|
|
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.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) SetTitle(title string) {
|
2024-10-18 23:53:33 +00:00
|
|
|
title_ms := C.struct_miqt_string{}
|
|
|
|
title_ms.data = C.CString(title)
|
|
|
|
title_ms.len = C.size_t(len(title))
|
|
|
|
defer C.free(unsafe.Pointer(title_ms.data))
|
|
|
|
C.QMenu_SetTitle(this.h, title_ms)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) Icon() *QIcon {
|
2024-09-14 22:29:05 +00:00
|
|
|
_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
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QMenu_SeparatorsCollapsible(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) SetSeparatorsCollapsible(collapse bool) {
|
|
|
|
C.QMenu_SetSeparatorsCollapsible(this.h, (C.bool)(collapse))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) ToolTipsVisible() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QMenu_ToolTipsVisible(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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()) {
|
2024-10-13 06:06:06 +00:00
|
|
|
C.QMenu_connect_AboutToShow(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
2024-09-14 22:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QMenu_AboutToShow
|
2024-10-13 06:06:06 +00:00
|
|
|
func miqt_exec_callback_QMenu_AboutToShow(cb C.intptr_t) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func())
|
2024-09-14 22:29:05 +00:00
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
gofunc()
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) AboutToHide() {
|
|
|
|
C.QMenu_AboutToHide(this.h)
|
|
|
|
}
|
|
|
|
func (this *QMenu) OnAboutToHide(slot func()) {
|
2024-10-13 06:06:06 +00:00
|
|
|
C.QMenu_connect_AboutToHide(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
2024-09-14 22:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QMenu_AboutToHide
|
2024-10-13 06:06:06 +00:00
|
|
|
func miqt_exec_callback_QMenu_AboutToHide(cb C.intptr_t) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func())
|
2024-09-14 22:29:05 +00:00
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
gofunc()
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) Triggered(action *QAction) {
|
|
|
|
C.QMenu_Triggered(this.h, action.cPointer())
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
func (this *QMenu) OnTriggered(slot func(action *QAction)) {
|
2024-10-13 06:06:06 +00:00
|
|
|
C.QMenu_connect_Triggered(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
2024-09-14 22:29:05 +00:00
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
//export miqt_exec_callback_QMenu_Triggered
|
2024-10-13 06:06:06 +00:00
|
|
|
func miqt_exec_callback_QMenu_Triggered(cb C.intptr_t, action *C.QAction) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(action *QAction))
|
2024-09-14 22:29:05 +00:00
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Convert all CABI parameters to Go parameters
|
2024-10-16 05:07:56 +00:00
|
|
|
slotval1 := UnsafeNewQAction(unsafe.Pointer(action))
|
2024-09-14 22:29:05 +00:00
|
|
|
|
|
|
|
gofunc(slotval1)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenu) Hovered(action *QAction) {
|
|
|
|
C.QMenu_Hovered(this.h, action.cPointer())
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
func (this *QMenu) OnHovered(slot func(action *QAction)) {
|
2024-10-13 06:06:06 +00:00
|
|
|
C.QMenu_connect_Hovered(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
2024-09-14 22:29:05 +00:00
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
//export miqt_exec_callback_QMenu_Hovered
|
2024-10-13 06:06:06 +00:00
|
|
|
func miqt_exec_callback_QMenu_Hovered(cb C.intptr_t, action *C.QAction) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(action *QAction))
|
2024-09-14 22:29:05 +00:00
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Convert all CABI parameters to Go parameters
|
2024-10-16 05:07:56 +00:00
|
|
|
slotval1 := UnsafeNewQAction(unsafe.Pointer(action))
|
2024-09-14 22:29:05 +00:00
|
|
|
|
|
|
|
gofunc(slotval1)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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))
|
2024-10-18 23:53:33 +00:00
|
|
|
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.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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))
|
2024-10-18 23:53:33 +00:00
|
|
|
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.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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))
|
2024-10-18 23:53:33 +00:00
|
|
|
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.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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))
|
2024-10-18 23:53:33 +00:00
|
|
|
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.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_Exec22(this.h, pos.cPointer(), at.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QMenu_Exec3(actions []*QAction, pos *QPoint, at *QAction) *QAction {
|
|
|
|
// For the C ABI, malloc a C array of raw pointers
|
2024-09-01 05:51:28 +00:00
|
|
|
actions_CArray := (*[0xffff]*C.QAction)(C.malloc(C.size_t(8 * len(actions))))
|
2024-08-25 04:08:24 +00:00
|
|
|
defer C.free(unsafe.Pointer(actions_CArray))
|
|
|
|
for i := range actions {
|
|
|
|
actions_CArray[i] = actions[i].cPointer()
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
actions_ma := &C.struct_miqt_array{len: C.size_t(len(actions)), data: unsafe.Pointer(actions_CArray)}
|
|
|
|
defer runtime.KeepAlive(unsafe.Pointer(actions_ma))
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_Exec3(actions_ma, pos.cPointer(), at.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QMenu_Exec4(actions []*QAction, pos *QPoint, at *QAction, parent *QWidget) *QAction {
|
|
|
|
// For the C ABI, malloc a C array of raw pointers
|
2024-09-01 05:51:28 +00:00
|
|
|
actions_CArray := (*[0xffff]*C.QAction)(C.malloc(C.size_t(8 * len(actions))))
|
2024-08-25 04:08:24 +00:00
|
|
|
defer C.free(unsafe.Pointer(actions_CArray))
|
|
|
|
for i := range actions {
|
|
|
|
actions_CArray[i] = actions[i].cPointer()
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
actions_ma := &C.struct_miqt_array{len: C.size_t(len(actions)), data: unsafe.Pointer(actions_CArray)}
|
|
|
|
defer runtime.KeepAlive(unsafe.Pointer(actions_ma))
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQAction(unsafe.Pointer(C.QMenu_Exec4(actions_ma, pos.cPointer(), at.cPointer(), parent.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QMenu) Delete() {
|
|
|
|
C.QMenu_Delete(this.h)
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
|
|
|
|
// 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)
|
|
|
|
})
|
|
|
|
}
|