2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qmenubar.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"runtime/cgo"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QMenuBar struct {
|
|
|
|
h *C.QMenuBar
|
|
|
|
*QWidget
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) cPointer() *C.QMenuBar {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQMenuBar(h *C.QMenuBar) *QMenuBar {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QMenuBar{h: h, QWidget: newQWidget_U(unsafe.Pointer(h))}
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQMenuBar_U(h unsafe.Pointer) *QMenuBar {
|
|
|
|
return newQMenuBar((*C.QMenuBar)(h))
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQMenuBar constructs a new QMenuBar object.
|
|
|
|
func NewQMenuBar() *QMenuBar {
|
|
|
|
ret := C.QMenuBar_new()
|
|
|
|
return newQMenuBar(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQMenuBar2 constructs a new QMenuBar object.
|
|
|
|
func NewQMenuBar2(parent *QWidget) *QMenuBar {
|
|
|
|
ret := C.QMenuBar_new2(parent.cPointer())
|
|
|
|
return newQMenuBar(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) MetaObject() *QMetaObject {
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQMetaObject_U(unsafe.Pointer(C.QMenuBar_MetaObject(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QMenuBar_Tr(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QMenuBar_Tr(s_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QMenuBar_TrUtf8(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QMenuBar_TrUtf8(s_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) AddAction(text string) *QAction {
|
2024-09-14 22:29:05 +00:00
|
|
|
text_ms := miqt_strdupg(text)
|
|
|
|
defer C.free(text_ms)
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQAction_U(unsafe.Pointer(C.QMenuBar_AddAction(this.h, (*C.struct_miqt_string)(text_ms))))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) AddMenu(menu *QMenu) *QAction {
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQAction_U(unsafe.Pointer(C.QMenuBar_AddMenu(this.h, menu.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) AddMenuWithTitle(title string) *QMenu {
|
2024-09-14 22:29:05 +00:00
|
|
|
title_ms := miqt_strdupg(title)
|
|
|
|
defer C.free(title_ms)
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQMenu_U(unsafe.Pointer(C.QMenuBar_AddMenuWithTitle(this.h, (*C.struct_miqt_string)(title_ms))))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) AddMenu2(icon *QIcon, title string) *QMenu {
|
2024-09-14 22:29:05 +00:00
|
|
|
title_ms := miqt_strdupg(title)
|
|
|
|
defer C.free(title_ms)
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQMenu_U(unsafe.Pointer(C.QMenuBar_AddMenu2(this.h, icon.cPointer(), (*C.struct_miqt_string)(title_ms))))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) AddSeparator() *QAction {
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQAction_U(unsafe.Pointer(C.QMenuBar_AddSeparator(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) InsertSeparator(before *QAction) *QAction {
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQAction_U(unsafe.Pointer(C.QMenuBar_InsertSeparator(this.h, before.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) InsertMenu(before *QAction, menu *QMenu) *QAction {
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQAction_U(unsafe.Pointer(C.QMenuBar_InsertMenu(this.h, before.cPointer(), menu.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) Clear() {
|
|
|
|
C.QMenuBar_Clear(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) ActiveAction() *QAction {
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQAction_U(unsafe.Pointer(C.QMenuBar_ActiveAction(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) SetActiveAction(action *QAction) {
|
|
|
|
C.QMenuBar_SetActiveAction(this.h, action.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) SetDefaultUp(defaultUp bool) {
|
|
|
|
C.QMenuBar_SetDefaultUp(this.h, (C.bool)(defaultUp))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) IsDefaultUp() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QMenuBar_IsDefaultUp(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) SizeHint() *QSize {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QMenuBar_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 *QMenuBar) MinimumSizeHint() *QSize {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QMenuBar_MinimumSizeHint(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 *QMenuBar) HeightForWidth(param1 int) int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QMenuBar_HeightForWidth(this.h, (C.int)(param1)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) ActionGeometry(param1 *QAction) *QRect {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QMenuBar_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 *QMenuBar) ActionAt(param1 *QPoint) *QAction {
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQAction_U(unsafe.Pointer(C.QMenuBar_ActionAt(this.h, param1.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
func (this *QMenuBar) SetCornerWidget(w *QWidget) {
|
|
|
|
C.QMenuBar_SetCornerWidget(this.h, w.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) CornerWidget() *QWidget {
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQWidget_U(unsafe.Pointer(C.QMenuBar_CornerWidget(this.h)))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QMenuBar) IsNativeMenuBar() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QMenuBar_IsNativeMenuBar(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) SetNativeMenuBar(nativeMenuBar bool) {
|
|
|
|
C.QMenuBar_SetNativeMenuBar(this.h, (C.bool)(nativeMenuBar))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) SetVisible(visible bool) {
|
|
|
|
C.QMenuBar_SetVisible(this.h, (C.bool)(visible))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) Triggered(action *QAction) {
|
|
|
|
C.QMenuBar_Triggered(this.h, action.cPointer())
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
func (this *QMenuBar) OnTriggered(slot func(action *QAction)) {
|
|
|
|
C.QMenuBar_connect_Triggered(this.h, unsafe.Pointer(uintptr(cgo.NewHandle(slot))))
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
//export miqt_exec_callback_QMenuBar_Triggered
|
|
|
|
func miqt_exec_callback_QMenuBar_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?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Convert all CABI parameters to Go parameters
|
2024-09-17 07:30:27 +00:00
|
|
|
slotval1 := newQAction_U(unsafe.Pointer(action))
|
2024-09-14 22:29:05 +00:00
|
|
|
|
|
|
|
gofunc(slotval1)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QMenuBar) Hovered(action *QAction) {
|
|
|
|
C.QMenuBar_Hovered(this.h, action.cPointer())
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
func (this *QMenuBar) OnHovered(slot func(action *QAction)) {
|
|
|
|
C.QMenuBar_connect_Hovered(this.h, unsafe.Pointer(uintptr(cgo.NewHandle(slot))))
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
//export miqt_exec_callback_QMenuBar_Hovered
|
|
|
|
func miqt_exec_callback_QMenuBar_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?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Convert all CABI parameters to Go parameters
|
2024-09-17 07:30:27 +00:00
|
|
|
slotval1 := newQAction_U(unsafe.Pointer(action))
|
2024-09-14 22:29:05 +00:00
|
|
|
|
|
|
|
gofunc(slotval1)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QMenuBar_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-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QMenuBar_Tr2(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QMenuBar_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-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QMenuBar_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
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QMenuBar_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-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QMenuBar_TrUtf82(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QMenuBar_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-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QMenuBar_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
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QMenuBar) SetCornerWidget2(w *QWidget, corner Corner) {
|
2024-09-18 00:12:02 +00:00
|
|
|
C.QMenuBar_SetCornerWidget2(this.h, w.cPointer(), (C.int)(corner))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QMenuBar) CornerWidget1(corner Corner) *QWidget {
|
2024-09-18 00:12:02 +00:00
|
|
|
return newQWidget_U(unsafe.Pointer(C.QMenuBar_CornerWidget1(this.h, (C.int)(corner))))
|
2024-08-29 07:01:51 +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 *QMenuBar) Delete() {
|
|
|
|
C.QMenuBar_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 *QMenuBar) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QMenuBar) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|