mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 09:28:36 +00:00
291 lines
9.0 KiB
Go
291 lines
9.0 KiB
Go
|
package qprintsupport
|
||
|
|
||
|
/*
|
||
|
|
||
|
#include "gen_qprintpreviewwidget.h"
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
*/
|
||
|
import "C"
|
||
|
|
||
|
import (
|
||
|
"github.com/mappu/miqt/qt6"
|
||
|
"runtime"
|
||
|
"runtime/cgo"
|
||
|
"unsafe"
|
||
|
)
|
||
|
|
||
|
type QPrintPreviewWidget__ViewMode int
|
||
|
|
||
|
const (
|
||
|
QPrintPreviewWidget__SinglePageView QPrintPreviewWidget__ViewMode = 0
|
||
|
QPrintPreviewWidget__FacingPagesView QPrintPreviewWidget__ViewMode = 1
|
||
|
QPrintPreviewWidget__AllPagesView QPrintPreviewWidget__ViewMode = 2
|
||
|
)
|
||
|
|
||
|
type QPrintPreviewWidget__ZoomMode int
|
||
|
|
||
|
const (
|
||
|
QPrintPreviewWidget__CustomZoom QPrintPreviewWidget__ZoomMode = 0
|
||
|
QPrintPreviewWidget__FitToWidth QPrintPreviewWidget__ZoomMode = 1
|
||
|
QPrintPreviewWidget__FitInView QPrintPreviewWidget__ZoomMode = 2
|
||
|
)
|
||
|
|
||
|
type QPrintPreviewWidget struct {
|
||
|
h *C.QPrintPreviewWidget
|
||
|
*qt6.QWidget
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) cPointer() *C.QPrintPreviewWidget {
|
||
|
if this == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return this.h
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) UnsafePointer() unsafe.Pointer {
|
||
|
if this == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return unsafe.Pointer(this.h)
|
||
|
}
|
||
|
|
||
|
func newQPrintPreviewWidget(h *C.QPrintPreviewWidget) *QPrintPreviewWidget {
|
||
|
if h == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return &QPrintPreviewWidget{h: h, QWidget: qt6.UnsafeNewQWidget(unsafe.Pointer(h))}
|
||
|
}
|
||
|
|
||
|
func UnsafeNewQPrintPreviewWidget(h unsafe.Pointer) *QPrintPreviewWidget {
|
||
|
return newQPrintPreviewWidget((*C.QPrintPreviewWidget)(h))
|
||
|
}
|
||
|
|
||
|
// NewQPrintPreviewWidget constructs a new QPrintPreviewWidget object.
|
||
|
func NewQPrintPreviewWidget(printer *QPrinter) *QPrintPreviewWidget {
|
||
|
ret := C.QPrintPreviewWidget_new(printer.cPointer())
|
||
|
return newQPrintPreviewWidget(ret)
|
||
|
}
|
||
|
|
||
|
// NewQPrintPreviewWidget2 constructs a new QPrintPreviewWidget object.
|
||
|
func NewQPrintPreviewWidget2() *QPrintPreviewWidget {
|
||
|
ret := C.QPrintPreviewWidget_new2()
|
||
|
return newQPrintPreviewWidget(ret)
|
||
|
}
|
||
|
|
||
|
// NewQPrintPreviewWidget3 constructs a new QPrintPreviewWidget object.
|
||
|
func NewQPrintPreviewWidget3(printer *QPrinter, parent *qt6.QWidget) *QPrintPreviewWidget {
|
||
|
ret := C.QPrintPreviewWidget_new3(printer.cPointer(), (*C.QWidget)(parent.UnsafePointer()))
|
||
|
return newQPrintPreviewWidget(ret)
|
||
|
}
|
||
|
|
||
|
// NewQPrintPreviewWidget4 constructs a new QPrintPreviewWidget object.
|
||
|
func NewQPrintPreviewWidget4(printer *QPrinter, parent *qt6.QWidget, flags qt6.WindowType) *QPrintPreviewWidget {
|
||
|
ret := C.QPrintPreviewWidget_new4(printer.cPointer(), (*C.QWidget)(parent.UnsafePointer()), (C.int)(flags))
|
||
|
return newQPrintPreviewWidget(ret)
|
||
|
}
|
||
|
|
||
|
// NewQPrintPreviewWidget5 constructs a new QPrintPreviewWidget object.
|
||
|
func NewQPrintPreviewWidget5(parent *qt6.QWidget) *QPrintPreviewWidget {
|
||
|
ret := C.QPrintPreviewWidget_new5((*C.QWidget)(parent.UnsafePointer()))
|
||
|
return newQPrintPreviewWidget(ret)
|
||
|
}
|
||
|
|
||
|
// NewQPrintPreviewWidget6 constructs a new QPrintPreviewWidget object.
|
||
|
func NewQPrintPreviewWidget6(parent *qt6.QWidget, flags qt6.WindowType) *QPrintPreviewWidget {
|
||
|
ret := C.QPrintPreviewWidget_new6((*C.QWidget)(parent.UnsafePointer()), (C.int)(flags))
|
||
|
return newQPrintPreviewWidget(ret)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) MetaObject() *qt6.QMetaObject {
|
||
|
return qt6.UnsafeNewQMetaObject(unsafe.Pointer(C.QPrintPreviewWidget_MetaObject(this.h)))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) Metacast(param1 string) unsafe.Pointer {
|
||
|
param1_Cstring := C.CString(param1)
|
||
|
defer C.free(unsafe.Pointer(param1_Cstring))
|
||
|
return (unsafe.Pointer)(C.QPrintPreviewWidget_Metacast(this.h, param1_Cstring))
|
||
|
}
|
||
|
|
||
|
func QPrintPreviewWidget_Tr(s string) string {
|
||
|
s_Cstring := C.CString(s)
|
||
|
defer C.free(unsafe.Pointer(s_Cstring))
|
||
|
var _ms C.struct_miqt_string = C.QPrintPreviewWidget_Tr(s_Cstring)
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) ZoomFactor() float64 {
|
||
|
return (float64)(C.QPrintPreviewWidget_ZoomFactor(this.h))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) Orientation() qt6.QPageLayout__Orientation {
|
||
|
return (qt6.QPageLayout__Orientation)(C.QPrintPreviewWidget_Orientation(this.h))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) ViewMode() QPrintPreviewWidget__ViewMode {
|
||
|
return (QPrintPreviewWidget__ViewMode)(C.QPrintPreviewWidget_ViewMode(this.h))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) ZoomMode() QPrintPreviewWidget__ZoomMode {
|
||
|
return (QPrintPreviewWidget__ZoomMode)(C.QPrintPreviewWidget_ZoomMode(this.h))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) CurrentPage() int {
|
||
|
return (int)(C.QPrintPreviewWidget_CurrentPage(this.h))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) PageCount() int {
|
||
|
return (int)(C.QPrintPreviewWidget_PageCount(this.h))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) SetVisible(visible bool) {
|
||
|
C.QPrintPreviewWidget_SetVisible(this.h, (C.bool)(visible))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) Print() {
|
||
|
C.QPrintPreviewWidget_Print(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) ZoomIn() {
|
||
|
C.QPrintPreviewWidget_ZoomIn(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) ZoomOut() {
|
||
|
C.QPrintPreviewWidget_ZoomOut(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) SetZoomFactor(zoomFactor float64) {
|
||
|
C.QPrintPreviewWidget_SetZoomFactor(this.h, (C.double)(zoomFactor))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) SetOrientation(orientation qt6.QPageLayout__Orientation) {
|
||
|
C.QPrintPreviewWidget_SetOrientation(this.h, (C.int)(orientation))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) SetViewMode(viewMode QPrintPreviewWidget__ViewMode) {
|
||
|
C.QPrintPreviewWidget_SetViewMode(this.h, (C.int)(viewMode))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) SetZoomMode(zoomMode QPrintPreviewWidget__ZoomMode) {
|
||
|
C.QPrintPreviewWidget_SetZoomMode(this.h, (C.int)(zoomMode))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) SetCurrentPage(pageNumber int) {
|
||
|
C.QPrintPreviewWidget_SetCurrentPage(this.h, (C.int)(pageNumber))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) FitToWidth() {
|
||
|
C.QPrintPreviewWidget_FitToWidth(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) FitInView() {
|
||
|
C.QPrintPreviewWidget_FitInView(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) SetLandscapeOrientation() {
|
||
|
C.QPrintPreviewWidget_SetLandscapeOrientation(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) SetPortraitOrientation() {
|
||
|
C.QPrintPreviewWidget_SetPortraitOrientation(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) SetSinglePageViewMode() {
|
||
|
C.QPrintPreviewWidget_SetSinglePageViewMode(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) SetFacingPagesViewMode() {
|
||
|
C.QPrintPreviewWidget_SetFacingPagesViewMode(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) SetAllPagesViewMode() {
|
||
|
C.QPrintPreviewWidget_SetAllPagesViewMode(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) UpdatePreview() {
|
||
|
C.QPrintPreviewWidget_UpdatePreview(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) PaintRequested(printer *QPrinter) {
|
||
|
C.QPrintPreviewWidget_PaintRequested(this.h, printer.cPointer())
|
||
|
}
|
||
|
func (this *QPrintPreviewWidget) OnPaintRequested(slot func(printer *QPrinter)) {
|
||
|
C.QPrintPreviewWidget_connect_PaintRequested(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
||
|
}
|
||
|
|
||
|
//export miqt_exec_callback_QPrintPreviewWidget_PaintRequested
|
||
|
func miqt_exec_callback_QPrintPreviewWidget_PaintRequested(cb C.intptr_t, printer *C.QPrinter) {
|
||
|
gofunc, ok := cgo.Handle(cb).Value().(func(printer *QPrinter))
|
||
|
if !ok {
|
||
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
||
|
}
|
||
|
|
||
|
// Convert all CABI parameters to Go parameters
|
||
|
slotval1 := UnsafeNewQPrinter(unsafe.Pointer(printer))
|
||
|
|
||
|
gofunc(slotval1)
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) PreviewChanged() {
|
||
|
C.QPrintPreviewWidget_PreviewChanged(this.h)
|
||
|
}
|
||
|
func (this *QPrintPreviewWidget) OnPreviewChanged(slot func()) {
|
||
|
C.QPrintPreviewWidget_connect_PreviewChanged(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
||
|
}
|
||
|
|
||
|
//export miqt_exec_callback_QPrintPreviewWidget_PreviewChanged
|
||
|
func miqt_exec_callback_QPrintPreviewWidget_PreviewChanged(cb C.intptr_t) {
|
||
|
gofunc, ok := cgo.Handle(cb).Value().(func())
|
||
|
if !ok {
|
||
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
||
|
}
|
||
|
|
||
|
gofunc()
|
||
|
}
|
||
|
|
||
|
func QPrintPreviewWidget_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.QPrintPreviewWidget_Tr2(s_Cstring, c_Cstring)
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
func QPrintPreviewWidget_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.QPrintPreviewWidget_Tr3(s_Cstring, c_Cstring, (C.int)(n))
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) ZoomIn1(zoom float64) {
|
||
|
C.QPrintPreviewWidget_ZoomIn1(this.h, (C.double)(zoom))
|
||
|
}
|
||
|
|
||
|
func (this *QPrintPreviewWidget) ZoomOut1(zoom float64) {
|
||
|
C.QPrintPreviewWidget_ZoomOut1(this.h, (C.double)(zoom))
|
||
|
}
|
||
|
|
||
|
// Delete this object from C++ memory.
|
||
|
func (this *QPrintPreviewWidget) Delete() {
|
||
|
C.QPrintPreviewWidget_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 *QPrintPreviewWidget) GoGC() {
|
||
|
runtime.SetFinalizer(this, func(this *QPrintPreviewWidget) {
|
||
|
this.Delete()
|
||
|
runtime.KeepAlive(this.h)
|
||
|
})
|
||
|
}
|