diff --git a/qt/qprintsupport/cflags_linux.go b/qt/qprintsupport/cflags_linux.go new file mode 100644 index 00000000..ebb10b1d --- /dev/null +++ b/qt/qprintsupport/cflags_linux.go @@ -0,0 +1,9 @@ +// +build linux,!android + +package qprintsupport + +/* +#cgo CFLAGS: -fPIC +#cgo pkg-config: Qt5PrintSupport +*/ +import "C" diff --git a/qt/qprintsupport/gen_qabstractprintdialog.cpp b/qt/qprintsupport/gen_qabstractprintdialog.cpp new file mode 100644 index 00000000..d789d12e --- /dev/null +++ b/qt/qprintsupport/gen_qabstractprintdialog.cpp @@ -0,0 +1,138 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qabstractprintdialog.h" +#include "_cgo_export.h" + +QAbstractPrintDialog* QAbstractPrintDialog_new(QPrinter* printer) { + return new QAbstractPrintDialog(printer); +} + +QAbstractPrintDialog* QAbstractPrintDialog_new2(QPrinter* printer, QWidget* parent) { + return new QAbstractPrintDialog(printer, parent); +} + +QMetaObject* QAbstractPrintDialog_MetaObject(const QAbstractPrintDialog* self) { + return (QMetaObject*) self->metaObject(); +} + +void* QAbstractPrintDialog_Metacast(QAbstractPrintDialog* self, const char* param1) { + return self->qt_metacast(param1); +} + +struct miqt_string* QAbstractPrintDialog_Tr(const char* s) { + QString _ret = QAbstractPrintDialog::tr(s); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QAbstractPrintDialog_TrUtf8(const char* s) { + QString _ret = QAbstractPrintDialog::trUtf8(s); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +void QAbstractPrintDialog_AddEnabledOption(QAbstractPrintDialog* self, int option) { + self->addEnabledOption(static_cast(option)); +} + +void QAbstractPrintDialog_SetEnabledOptions(QAbstractPrintDialog* self, int options) { + self->setEnabledOptions(static_cast(options)); +} + +int QAbstractPrintDialog_EnabledOptions(const QAbstractPrintDialog* self) { + QAbstractPrintDialog::PrintDialogOptions _ret = self->enabledOptions(); + return static_cast(_ret); +} + +bool QAbstractPrintDialog_IsOptionEnabled(const QAbstractPrintDialog* self, int option) { + return self->isOptionEnabled(static_cast(option)); +} + +void QAbstractPrintDialog_SetOptionTabs(QAbstractPrintDialog* self, struct miqt_array* /* of QWidget* */ tabs) { + QList tabs_QList; + tabs_QList.reserve(tabs->len); + QWidget** tabs_arr = static_cast(tabs->data); + for(size_t i = 0; i < tabs->len; ++i) { + tabs_QList.push_back(tabs_arr[i]); + } + self->setOptionTabs(tabs_QList); +} + +void QAbstractPrintDialog_SetPrintRange(QAbstractPrintDialog* self, int rangeVal) { + self->setPrintRange(static_cast(rangeVal)); +} + +int QAbstractPrintDialog_PrintRange(const QAbstractPrintDialog* self) { + QAbstractPrintDialog::PrintRange _ret = self->printRange(); + return static_cast(_ret); +} + +void QAbstractPrintDialog_SetMinMax(QAbstractPrintDialog* self, int min, int max) { + self->setMinMax(static_cast(min), static_cast(max)); +} + +int QAbstractPrintDialog_MinPage(const QAbstractPrintDialog* self) { + return self->minPage(); +} + +int QAbstractPrintDialog_MaxPage(const QAbstractPrintDialog* self) { + return self->maxPage(); +} + +void QAbstractPrintDialog_SetFromTo(QAbstractPrintDialog* self, int fromPage, int toPage) { + self->setFromTo(static_cast(fromPage), static_cast(toPage)); +} + +int QAbstractPrintDialog_FromPage(const QAbstractPrintDialog* self) { + return self->fromPage(); +} + +int QAbstractPrintDialog_ToPage(const QAbstractPrintDialog* self) { + return self->toPage(); +} + +QPrinter* QAbstractPrintDialog_Printer(const QAbstractPrintDialog* self) { + return self->printer(); +} + +struct miqt_string* QAbstractPrintDialog_Tr2(const char* s, const char* c) { + QString _ret = QAbstractPrintDialog::tr(s, c); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QAbstractPrintDialog_Tr3(const char* s, const char* c, int n) { + QString _ret = QAbstractPrintDialog::tr(s, c, static_cast(n)); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QAbstractPrintDialog_TrUtf82(const char* s, const char* c) { + QString _ret = QAbstractPrintDialog::trUtf8(s, c); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QAbstractPrintDialog_TrUtf83(const char* s, const char* c, int n) { + QString _ret = QAbstractPrintDialog::trUtf8(s, c, static_cast(n)); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +void QAbstractPrintDialog_Delete(QAbstractPrintDialog* self) { + delete self; +} + diff --git a/qt/qprintsupport/gen_qabstractprintdialog.go b/qt/qprintsupport/gen_qabstractprintdialog.go new file mode 100644 index 00000000..b0e3ba45 --- /dev/null +++ b/qt/qprintsupport/gen_qabstractprintdialog.go @@ -0,0 +1,229 @@ +package qprintsupport + +/* + +#include "gen_qabstractprintdialog.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/qt" + "runtime" + "unsafe" +) + +type QAbstractPrintDialog__PrintRange int + +const ( + QAbstractPrintDialog__AllPages QAbstractPrintDialog__PrintRange = 0 + QAbstractPrintDialog__Selection QAbstractPrintDialog__PrintRange = 1 + QAbstractPrintDialog__PageRange QAbstractPrintDialog__PrintRange = 2 + QAbstractPrintDialog__CurrentPage QAbstractPrintDialog__PrintRange = 3 +) + +type QAbstractPrintDialog__PrintDialogOption int + +const ( + QAbstractPrintDialog__None QAbstractPrintDialog__PrintDialogOption = 0 + QAbstractPrintDialog__PrintToFile QAbstractPrintDialog__PrintDialogOption = 1 + QAbstractPrintDialog__PrintSelection QAbstractPrintDialog__PrintDialogOption = 2 + QAbstractPrintDialog__PrintPageRange QAbstractPrintDialog__PrintDialogOption = 4 + QAbstractPrintDialog__PrintShowPageSize QAbstractPrintDialog__PrintDialogOption = 8 + QAbstractPrintDialog__PrintCollateCopies QAbstractPrintDialog__PrintDialogOption = 16 + QAbstractPrintDialog__DontUseSheet QAbstractPrintDialog__PrintDialogOption = 32 + QAbstractPrintDialog__PrintCurrentPage QAbstractPrintDialog__PrintDialogOption = 64 +) + +type QAbstractPrintDialog struct { + h *C.QAbstractPrintDialog + *qt.QDialog +} + +func (this *QAbstractPrintDialog) cPointer() *C.QAbstractPrintDialog { + if this == nil { + return nil + } + return this.h +} + +func (this *QAbstractPrintDialog) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +func newQAbstractPrintDialog(h *C.QAbstractPrintDialog) *QAbstractPrintDialog { + if h == nil { + return nil + } + return &QAbstractPrintDialog{h: h, QDialog: qt.UnsafeNewQDialog(unsafe.Pointer(h))} +} + +func UnsafeNewQAbstractPrintDialog(h unsafe.Pointer) *QAbstractPrintDialog { + return newQAbstractPrintDialog((*C.QAbstractPrintDialog)(h)) +} + +// NewQAbstractPrintDialog constructs a new QAbstractPrintDialog object. +func NewQAbstractPrintDialog(printer *QPrinter) *QAbstractPrintDialog { + ret := C.QAbstractPrintDialog_new(printer.cPointer()) + return newQAbstractPrintDialog(ret) +} + +// NewQAbstractPrintDialog2 constructs a new QAbstractPrintDialog object. +func NewQAbstractPrintDialog2(printer *QPrinter, parent *qt.QWidget) *QAbstractPrintDialog { + ret := C.QAbstractPrintDialog_new2(printer.cPointer(), (*C.QWidget)(parent.UnsafePointer())) + return newQAbstractPrintDialog(ret) +} + +func (this *QAbstractPrintDialog) MetaObject() *qt.QMetaObject { + return qt.UnsafeNewQMetaObject(unsafe.Pointer(C.QAbstractPrintDialog_MetaObject(this.h))) +} + +func (this *QAbstractPrintDialog) Metacast(param1 string) unsafe.Pointer { + param1_Cstring := C.CString(param1) + defer C.free(unsafe.Pointer(param1_Cstring)) + return C.QAbstractPrintDialog_Metacast(this.h, param1_Cstring) +} + +func QAbstractPrintDialog_Tr(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms *C.struct_miqt_string = C.QAbstractPrintDialog_Tr(s_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QAbstractPrintDialog_TrUtf8(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms *C.struct_miqt_string = C.QAbstractPrintDialog_TrUtf8(s_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QAbstractPrintDialog) AddEnabledOption(option QAbstractPrintDialog__PrintDialogOption) { + C.QAbstractPrintDialog_AddEnabledOption(this.h, (C.int)(option)) +} + +func (this *QAbstractPrintDialog) SetEnabledOptions(options QAbstractPrintDialog__PrintDialogOption) { + C.QAbstractPrintDialog_SetEnabledOptions(this.h, (C.int)(options)) +} + +func (this *QAbstractPrintDialog) EnabledOptions() QAbstractPrintDialog__PrintDialogOption { + return (QAbstractPrintDialog__PrintDialogOption)(C.QAbstractPrintDialog_EnabledOptions(this.h)) +} + +func (this *QAbstractPrintDialog) IsOptionEnabled(option QAbstractPrintDialog__PrintDialogOption) bool { + return (bool)(C.QAbstractPrintDialog_IsOptionEnabled(this.h, (C.int)(option))) +} + +func (this *QAbstractPrintDialog) SetOptionTabs(tabs []*qt.QWidget) { + // For the C ABI, malloc a C array of raw pointers + tabs_CArray := (*[0xffff]*C.QWidget)(C.malloc(C.size_t(8 * len(tabs)))) + defer C.free(unsafe.Pointer(tabs_CArray)) + for i := range tabs { + tabs_CArray[i] = (*C.QWidget)(tabs[i].UnsafePointer()) + } + tabs_ma := &C.struct_miqt_array{len: C.size_t(len(tabs)), data: unsafe.Pointer(tabs_CArray)} + defer runtime.KeepAlive(unsafe.Pointer(tabs_ma)) + C.QAbstractPrintDialog_SetOptionTabs(this.h, tabs_ma) +} + +func (this *QAbstractPrintDialog) SetPrintRange(rangeVal QAbstractPrintDialog__PrintRange) { + C.QAbstractPrintDialog_SetPrintRange(this.h, (C.int)(rangeVal)) +} + +func (this *QAbstractPrintDialog) PrintRange() QAbstractPrintDialog__PrintRange { + return (QAbstractPrintDialog__PrintRange)(C.QAbstractPrintDialog_PrintRange(this.h)) +} + +func (this *QAbstractPrintDialog) SetMinMax(min int, max int) { + C.QAbstractPrintDialog_SetMinMax(this.h, (C.int)(min), (C.int)(max)) +} + +func (this *QAbstractPrintDialog) MinPage() int { + return (int)(C.QAbstractPrintDialog_MinPage(this.h)) +} + +func (this *QAbstractPrintDialog) MaxPage() int { + return (int)(C.QAbstractPrintDialog_MaxPage(this.h)) +} + +func (this *QAbstractPrintDialog) SetFromTo(fromPage int, toPage int) { + C.QAbstractPrintDialog_SetFromTo(this.h, (C.int)(fromPage), (C.int)(toPage)) +} + +func (this *QAbstractPrintDialog) FromPage() int { + return (int)(C.QAbstractPrintDialog_FromPage(this.h)) +} + +func (this *QAbstractPrintDialog) ToPage() int { + return (int)(C.QAbstractPrintDialog_ToPage(this.h)) +} + +func (this *QAbstractPrintDialog) Printer() *QPrinter { + return UnsafeNewQPrinter(unsafe.Pointer(C.QAbstractPrintDialog_Printer(this.h))) +} + +func QAbstractPrintDialog_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.QAbstractPrintDialog_Tr2(s_Cstring, c_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QAbstractPrintDialog_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.QAbstractPrintDialog_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 QAbstractPrintDialog_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.QAbstractPrintDialog_TrUtf82(s_Cstring, c_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QAbstractPrintDialog_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.QAbstractPrintDialog_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 +} + +// Delete this object from C++ memory. +func (this *QAbstractPrintDialog) Delete() { + C.QAbstractPrintDialog_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 *QAbstractPrintDialog) GoGC() { + runtime.SetFinalizer(this, func(this *QAbstractPrintDialog) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/qprintsupport/gen_qabstractprintdialog.h b/qt/qprintsupport/gen_qabstractprintdialog.h new file mode 100644 index 00000000..d8af6b71 --- /dev/null +++ b/qt/qprintsupport/gen_qabstractprintdialog.h @@ -0,0 +1,58 @@ +#ifndef GEN_QABSTRACTPRINTDIALOG_H +#define GEN_QABSTRACTPRINTDIALOG_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QAbstractPrintDialog; +class QMetaObject; +class QPrinter; +class QWidget; +#else +typedef struct QAbstractPrintDialog QAbstractPrintDialog; +typedef struct QMetaObject QMetaObject; +typedef struct QPrinter QPrinter; +typedef struct QWidget QWidget; +#endif + +QAbstractPrintDialog* QAbstractPrintDialog_new(QPrinter* printer); +QAbstractPrintDialog* QAbstractPrintDialog_new2(QPrinter* printer, QWidget* parent); +QMetaObject* QAbstractPrintDialog_MetaObject(const QAbstractPrintDialog* self); +void* QAbstractPrintDialog_Metacast(QAbstractPrintDialog* self, const char* param1); +struct miqt_string* QAbstractPrintDialog_Tr(const char* s); +struct miqt_string* QAbstractPrintDialog_TrUtf8(const char* s); +void QAbstractPrintDialog_AddEnabledOption(QAbstractPrintDialog* self, int option); +void QAbstractPrintDialog_SetEnabledOptions(QAbstractPrintDialog* self, int options); +int QAbstractPrintDialog_EnabledOptions(const QAbstractPrintDialog* self); +bool QAbstractPrintDialog_IsOptionEnabled(const QAbstractPrintDialog* self, int option); +void QAbstractPrintDialog_SetOptionTabs(QAbstractPrintDialog* self, struct miqt_array* /* of QWidget* */ tabs); +void QAbstractPrintDialog_SetPrintRange(QAbstractPrintDialog* self, int rangeVal); +int QAbstractPrintDialog_PrintRange(const QAbstractPrintDialog* self); +void QAbstractPrintDialog_SetMinMax(QAbstractPrintDialog* self, int min, int max); +int QAbstractPrintDialog_MinPage(const QAbstractPrintDialog* self); +int QAbstractPrintDialog_MaxPage(const QAbstractPrintDialog* self); +void QAbstractPrintDialog_SetFromTo(QAbstractPrintDialog* self, int fromPage, int toPage); +int QAbstractPrintDialog_FromPage(const QAbstractPrintDialog* self); +int QAbstractPrintDialog_ToPage(const QAbstractPrintDialog* self); +QPrinter* QAbstractPrintDialog_Printer(const QAbstractPrintDialog* self); +struct miqt_string* QAbstractPrintDialog_Tr2(const char* s, const char* c); +struct miqt_string* QAbstractPrintDialog_Tr3(const char* s, const char* c, int n); +struct miqt_string* QAbstractPrintDialog_TrUtf82(const char* s, const char* c); +struct miqt_string* QAbstractPrintDialog_TrUtf83(const char* s, const char* c, int n); +void QAbstractPrintDialog_Delete(QAbstractPrintDialog* self); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/qprintsupport/gen_qpagesetupdialog.cpp b/qt/qprintsupport/gen_qpagesetupdialog.cpp new file mode 100644 index 00000000..ffe635cc --- /dev/null +++ b/qt/qprintsupport/gen_qpagesetupdialog.cpp @@ -0,0 +1,93 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qpagesetupdialog.h" +#include "_cgo_export.h" + +QPageSetupDialog* QPageSetupDialog_new(QPrinter* printer) { + return new QPageSetupDialog(printer); +} + +QPageSetupDialog* QPageSetupDialog_new2() { + return new QPageSetupDialog(); +} + +QPageSetupDialog* QPageSetupDialog_new3(QPrinter* printer, QWidget* parent) { + return new QPageSetupDialog(printer, parent); +} + +QPageSetupDialog* QPageSetupDialog_new4(QWidget* parent) { + return new QPageSetupDialog(parent); +} + +QMetaObject* QPageSetupDialog_MetaObject(const QPageSetupDialog* self) { + return (QMetaObject*) self->metaObject(); +} + +void* QPageSetupDialog_Metacast(QPageSetupDialog* self, const char* param1) { + return self->qt_metacast(param1); +} + +struct miqt_string* QPageSetupDialog_Tr(const char* s) { + QString _ret = QPageSetupDialog::tr(s); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPageSetupDialog_TrUtf8(const char* s) { + QString _ret = QPageSetupDialog::trUtf8(s); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +int QPageSetupDialog_Exec(QPageSetupDialog* self) { + return self->exec(); +} + +void QPageSetupDialog_Done(QPageSetupDialog* self, int result) { + self->done(static_cast(result)); +} + +QPrinter* QPageSetupDialog_Printer(QPageSetupDialog* self) { + return self->printer(); +} + +struct miqt_string* QPageSetupDialog_Tr2(const char* s, const char* c) { + QString _ret = QPageSetupDialog::tr(s, c); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPageSetupDialog_Tr3(const char* s, const char* c, int n) { + QString _ret = QPageSetupDialog::tr(s, c, static_cast(n)); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPageSetupDialog_TrUtf82(const char* s, const char* c) { + QString _ret = QPageSetupDialog::trUtf8(s, c); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPageSetupDialog_TrUtf83(const char* s, const char* c, int n) { + QString _ret = QPageSetupDialog::trUtf8(s, c, static_cast(n)); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +void QPageSetupDialog_Delete(QPageSetupDialog* self) { + delete self; +} + diff --git a/qt/qprintsupport/gen_qpagesetupdialog.go b/qt/qprintsupport/gen_qpagesetupdialog.go new file mode 100644 index 00000000..2b5f50c7 --- /dev/null +++ b/qt/qprintsupport/gen_qpagesetupdialog.go @@ -0,0 +1,167 @@ +package qprintsupport + +/* + +#include "gen_qpagesetupdialog.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/qt" + "runtime" + "unsafe" +) + +type QPageSetupDialog struct { + h *C.QPageSetupDialog + *qt.QDialog +} + +func (this *QPageSetupDialog) cPointer() *C.QPageSetupDialog { + if this == nil { + return nil + } + return this.h +} + +func (this *QPageSetupDialog) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +func newQPageSetupDialog(h *C.QPageSetupDialog) *QPageSetupDialog { + if h == nil { + return nil + } + return &QPageSetupDialog{h: h, QDialog: qt.UnsafeNewQDialog(unsafe.Pointer(h))} +} + +func UnsafeNewQPageSetupDialog(h unsafe.Pointer) *QPageSetupDialog { + return newQPageSetupDialog((*C.QPageSetupDialog)(h)) +} + +// NewQPageSetupDialog constructs a new QPageSetupDialog object. +func NewQPageSetupDialog(printer *QPrinter) *QPageSetupDialog { + ret := C.QPageSetupDialog_new(printer.cPointer()) + return newQPageSetupDialog(ret) +} + +// NewQPageSetupDialog2 constructs a new QPageSetupDialog object. +func NewQPageSetupDialog2() *QPageSetupDialog { + ret := C.QPageSetupDialog_new2() + return newQPageSetupDialog(ret) +} + +// NewQPageSetupDialog3 constructs a new QPageSetupDialog object. +func NewQPageSetupDialog3(printer *QPrinter, parent *qt.QWidget) *QPageSetupDialog { + ret := C.QPageSetupDialog_new3(printer.cPointer(), (*C.QWidget)(parent.UnsafePointer())) + return newQPageSetupDialog(ret) +} + +// NewQPageSetupDialog4 constructs a new QPageSetupDialog object. +func NewQPageSetupDialog4(parent *qt.QWidget) *QPageSetupDialog { + ret := C.QPageSetupDialog_new4((*C.QWidget)(parent.UnsafePointer())) + return newQPageSetupDialog(ret) +} + +func (this *QPageSetupDialog) MetaObject() *qt.QMetaObject { + return qt.UnsafeNewQMetaObject(unsafe.Pointer(C.QPageSetupDialog_MetaObject(this.h))) +} + +func (this *QPageSetupDialog) Metacast(param1 string) unsafe.Pointer { + param1_Cstring := C.CString(param1) + defer C.free(unsafe.Pointer(param1_Cstring)) + return C.QPageSetupDialog_Metacast(this.h, param1_Cstring) +} + +func QPageSetupDialog_Tr(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms *C.struct_miqt_string = C.QPageSetupDialog_Tr(s_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QPageSetupDialog_TrUtf8(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms *C.struct_miqt_string = C.QPageSetupDialog_TrUtf8(s_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPageSetupDialog) Exec() int { + return (int)(C.QPageSetupDialog_Exec(this.h)) +} + +func (this *QPageSetupDialog) Done(result int) { + C.QPageSetupDialog_Done(this.h, (C.int)(result)) +} + +func (this *QPageSetupDialog) Printer() *QPrinter { + return UnsafeNewQPrinter(unsafe.Pointer(C.QPageSetupDialog_Printer(this.h))) +} + +func QPageSetupDialog_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.QPageSetupDialog_Tr2(s_Cstring, c_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QPageSetupDialog_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.QPageSetupDialog_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 QPageSetupDialog_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.QPageSetupDialog_TrUtf82(s_Cstring, c_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QPageSetupDialog_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.QPageSetupDialog_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 +} + +// Delete this object from C++ memory. +func (this *QPageSetupDialog) Delete() { + C.QPageSetupDialog_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 *QPageSetupDialog) GoGC() { + runtime.SetFinalizer(this, func(this *QPageSetupDialog) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/qprintsupport/gen_qpagesetupdialog.h b/qt/qprintsupport/gen_qpagesetupdialog.h new file mode 100644 index 00000000..e48ce138 --- /dev/null +++ b/qt/qprintsupport/gen_qpagesetupdialog.h @@ -0,0 +1,49 @@ +#ifndef GEN_QPAGESETUPDIALOG_H +#define GEN_QPAGESETUPDIALOG_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QMetaObject; +class QPageSetupDialog; +class QPrinter; +class QWidget; +#else +typedef struct QMetaObject QMetaObject; +typedef struct QPageSetupDialog QPageSetupDialog; +typedef struct QPrinter QPrinter; +typedef struct QWidget QWidget; +#endif + +QPageSetupDialog* QPageSetupDialog_new(QPrinter* printer); +QPageSetupDialog* QPageSetupDialog_new2(); +QPageSetupDialog* QPageSetupDialog_new3(QPrinter* printer, QWidget* parent); +QPageSetupDialog* QPageSetupDialog_new4(QWidget* parent); +QMetaObject* QPageSetupDialog_MetaObject(const QPageSetupDialog* self); +void* QPageSetupDialog_Metacast(QPageSetupDialog* self, const char* param1); +struct miqt_string* QPageSetupDialog_Tr(const char* s); +struct miqt_string* QPageSetupDialog_TrUtf8(const char* s); +int QPageSetupDialog_Exec(QPageSetupDialog* self); +void QPageSetupDialog_Done(QPageSetupDialog* self, int result); +QPrinter* QPageSetupDialog_Printer(QPageSetupDialog* self); +struct miqt_string* QPageSetupDialog_Tr2(const char* s, const char* c); +struct miqt_string* QPageSetupDialog_Tr3(const char* s, const char* c, int n); +struct miqt_string* QPageSetupDialog_TrUtf82(const char* s, const char* c); +struct miqt_string* QPageSetupDialog_TrUtf83(const char* s, const char* c, int n); +void QPageSetupDialog_Delete(QPageSetupDialog* self); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/qprintsupport/gen_qprintdialog.cpp b/qt/qprintsupport/gen_qprintdialog.cpp new file mode 100644 index 00000000..71add150 --- /dev/null +++ b/qt/qprintsupport/gen_qprintdialog.cpp @@ -0,0 +1,129 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qprintdialog.h" +#include "_cgo_export.h" + +QPrintDialog* QPrintDialog_new(QPrinter* printer) { + return new QPrintDialog(printer); +} + +QPrintDialog* QPrintDialog_new2() { + return new QPrintDialog(); +} + +QPrintDialog* QPrintDialog_new3(QPrinter* printer, QWidget* parent) { + return new QPrintDialog(printer, parent); +} + +QPrintDialog* QPrintDialog_new4(QWidget* parent) { + return new QPrintDialog(parent); +} + +QMetaObject* QPrintDialog_MetaObject(const QPrintDialog* self) { + return (QMetaObject*) self->metaObject(); +} + +void* QPrintDialog_Metacast(QPrintDialog* self, const char* param1) { + return self->qt_metacast(param1); +} + +struct miqt_string* QPrintDialog_Tr(const char* s) { + QString _ret = QPrintDialog::tr(s); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrintDialog_TrUtf8(const char* s) { + QString _ret = QPrintDialog::trUtf8(s); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +int QPrintDialog_Exec(QPrintDialog* self) { + return self->exec(); +} + +void QPrintDialog_Accept(QPrintDialog* self) { + self->accept(); +} + +void QPrintDialog_Done(QPrintDialog* self, int result) { + self->done(static_cast(result)); +} + +void QPrintDialog_SetOption(QPrintDialog* self, int option) { + self->setOption(static_cast(option)); +} + +bool QPrintDialog_TestOption(const QPrintDialog* self, int option) { + return self->testOption(static_cast(option)); +} + +void QPrintDialog_SetOptions(QPrintDialog* self, int options) { + self->setOptions(static_cast(options)); +} + +int QPrintDialog_Options(const QPrintDialog* self) { + QAbstractPrintDialog::PrintDialogOptions _ret = self->options(); + return static_cast(_ret); +} + +void QPrintDialog_SetVisible(QPrintDialog* self, bool visible) { + self->setVisible(visible); +} + +void QPrintDialog_Accepted(QPrintDialog* self, QPrinter* printer) { + self->accepted(printer); +} + +void QPrintDialog_connect_Accepted(QPrintDialog* self, intptr_t slot) { + QPrintDialog::connect(self, static_cast(&QPrintDialog::accepted), self, [=](QPrinter* printer) { + QPrinter* sigval1 = printer; + miqt_exec_callback_QPrintDialog_Accepted(slot, sigval1); + }); +} + +struct miqt_string* QPrintDialog_Tr2(const char* s, const char* c) { + QString _ret = QPrintDialog::tr(s, c); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrintDialog_Tr3(const char* s, const char* c, int n) { + QString _ret = QPrintDialog::tr(s, c, static_cast(n)); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrintDialog_TrUtf82(const char* s, const char* c) { + QString _ret = QPrintDialog::trUtf8(s, c); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrintDialog_TrUtf83(const char* s, const char* c, int n) { + QString _ret = QPrintDialog::trUtf8(s, c, static_cast(n)); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +void QPrintDialog_SetOption2(QPrintDialog* self, int option, bool on) { + self->setOption(static_cast(option), on); +} + +void QPrintDialog_Delete(QPrintDialog* self) { + delete self; +} + diff --git a/qt/qprintsupport/gen_qprintdialog.go b/qt/qprintsupport/gen_qprintdialog.go new file mode 100644 index 00000000..32840703 --- /dev/null +++ b/qt/qprintsupport/gen_qprintdialog.go @@ -0,0 +1,212 @@ +package qprintsupport + +/* + +#include "gen_qprintdialog.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/qt" + "runtime" + "runtime/cgo" + "unsafe" +) + +type QPrintDialog struct { + h *C.QPrintDialog + *QAbstractPrintDialog +} + +func (this *QPrintDialog) cPointer() *C.QPrintDialog { + if this == nil { + return nil + } + return this.h +} + +func (this *QPrintDialog) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +func newQPrintDialog(h *C.QPrintDialog) *QPrintDialog { + if h == nil { + return nil + } + return &QPrintDialog{h: h, QAbstractPrintDialog: UnsafeNewQAbstractPrintDialog(unsafe.Pointer(h))} +} + +func UnsafeNewQPrintDialog(h unsafe.Pointer) *QPrintDialog { + return newQPrintDialog((*C.QPrintDialog)(h)) +} + +// NewQPrintDialog constructs a new QPrintDialog object. +func NewQPrintDialog(printer *QPrinter) *QPrintDialog { + ret := C.QPrintDialog_new(printer.cPointer()) + return newQPrintDialog(ret) +} + +// NewQPrintDialog2 constructs a new QPrintDialog object. +func NewQPrintDialog2() *QPrintDialog { + ret := C.QPrintDialog_new2() + return newQPrintDialog(ret) +} + +// NewQPrintDialog3 constructs a new QPrintDialog object. +func NewQPrintDialog3(printer *QPrinter, parent *qt.QWidget) *QPrintDialog { + ret := C.QPrintDialog_new3(printer.cPointer(), (*C.QWidget)(parent.UnsafePointer())) + return newQPrintDialog(ret) +} + +// NewQPrintDialog4 constructs a new QPrintDialog object. +func NewQPrintDialog4(parent *qt.QWidget) *QPrintDialog { + ret := C.QPrintDialog_new4((*C.QWidget)(parent.UnsafePointer())) + return newQPrintDialog(ret) +} + +func (this *QPrintDialog) MetaObject() *qt.QMetaObject { + return qt.UnsafeNewQMetaObject(unsafe.Pointer(C.QPrintDialog_MetaObject(this.h))) +} + +func (this *QPrintDialog) Metacast(param1 string) unsafe.Pointer { + param1_Cstring := C.CString(param1) + defer C.free(unsafe.Pointer(param1_Cstring)) + return C.QPrintDialog_Metacast(this.h, param1_Cstring) +} + +func QPrintDialog_Tr(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms *C.struct_miqt_string = C.QPrintDialog_Tr(s_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QPrintDialog_TrUtf8(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms *C.struct_miqt_string = C.QPrintDialog_TrUtf8(s_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrintDialog) Exec() int { + return (int)(C.QPrintDialog_Exec(this.h)) +} + +func (this *QPrintDialog) Accept() { + C.QPrintDialog_Accept(this.h) +} + +func (this *QPrintDialog) Done(result int) { + C.QPrintDialog_Done(this.h, (C.int)(result)) +} + +func (this *QPrintDialog) SetOption(option QAbstractPrintDialog__PrintDialogOption) { + C.QPrintDialog_SetOption(this.h, (C.int)(option)) +} + +func (this *QPrintDialog) TestOption(option QAbstractPrintDialog__PrintDialogOption) bool { + return (bool)(C.QPrintDialog_TestOption(this.h, (C.int)(option))) +} + +func (this *QPrintDialog) SetOptions(options QAbstractPrintDialog__PrintDialogOption) { + C.QPrintDialog_SetOptions(this.h, (C.int)(options)) +} + +func (this *QPrintDialog) Options() QAbstractPrintDialog__PrintDialogOption { + return (QAbstractPrintDialog__PrintDialogOption)(C.QPrintDialog_Options(this.h)) +} + +func (this *QPrintDialog) SetVisible(visible bool) { + C.QPrintDialog_SetVisible(this.h, (C.bool)(visible)) +} + +func (this *QPrintDialog) Accepted(printer *QPrinter) { + C.QPrintDialog_Accepted(this.h, printer.cPointer()) +} +func (this *QPrintDialog) OnAccepted(slot func(printer *QPrinter)) { + C.QPrintDialog_connect_Accepted(this.h, C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QPrintDialog_Accepted +func miqt_exec_callback_QPrintDialog_Accepted(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 QPrintDialog_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.QPrintDialog_Tr2(s_Cstring, c_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QPrintDialog_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.QPrintDialog_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 QPrintDialog_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.QPrintDialog_TrUtf82(s_Cstring, c_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QPrintDialog_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.QPrintDialog_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 *QPrintDialog) SetOption2(option QAbstractPrintDialog__PrintDialogOption, on bool) { + C.QPrintDialog_SetOption2(this.h, (C.int)(option), (C.bool)(on)) +} + +// Delete this object from C++ memory. +func (this *QPrintDialog) Delete() { + C.QPrintDialog_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 *QPrintDialog) GoGC() { + runtime.SetFinalizer(this, func(this *QPrintDialog) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/qprintsupport/gen_qprintdialog.h b/qt/qprintsupport/gen_qprintdialog.h new file mode 100644 index 00000000..a29e0833 --- /dev/null +++ b/qt/qprintsupport/gen_qprintdialog.h @@ -0,0 +1,57 @@ +#ifndef GEN_QPRINTDIALOG_H +#define GEN_QPRINTDIALOG_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QMetaObject; +class QPrintDialog; +class QPrinter; +class QWidget; +#else +typedef struct QMetaObject QMetaObject; +typedef struct QPrintDialog QPrintDialog; +typedef struct QPrinter QPrinter; +typedef struct QWidget QWidget; +#endif + +QPrintDialog* QPrintDialog_new(QPrinter* printer); +QPrintDialog* QPrintDialog_new2(); +QPrintDialog* QPrintDialog_new3(QPrinter* printer, QWidget* parent); +QPrintDialog* QPrintDialog_new4(QWidget* parent); +QMetaObject* QPrintDialog_MetaObject(const QPrintDialog* self); +void* QPrintDialog_Metacast(QPrintDialog* self, const char* param1); +struct miqt_string* QPrintDialog_Tr(const char* s); +struct miqt_string* QPrintDialog_TrUtf8(const char* s); +int QPrintDialog_Exec(QPrintDialog* self); +void QPrintDialog_Accept(QPrintDialog* self); +void QPrintDialog_Done(QPrintDialog* self, int result); +void QPrintDialog_SetOption(QPrintDialog* self, int option); +bool QPrintDialog_TestOption(const QPrintDialog* self, int option); +void QPrintDialog_SetOptions(QPrintDialog* self, int options); +int QPrintDialog_Options(const QPrintDialog* self); +void QPrintDialog_SetVisible(QPrintDialog* self, bool visible); +void QPrintDialog_Accepted(QPrintDialog* self, QPrinter* printer); +void QPrintDialog_connect_Accepted(QPrintDialog* self, intptr_t slot); +struct miqt_string* QPrintDialog_Tr2(const char* s, const char* c); +struct miqt_string* QPrintDialog_Tr3(const char* s, const char* c, int n); +struct miqt_string* QPrintDialog_TrUtf82(const char* s, const char* c); +struct miqt_string* QPrintDialog_TrUtf83(const char* s, const char* c, int n); +void QPrintDialog_SetOption2(QPrintDialog* self, int option, bool on); +void QPrintDialog_Delete(QPrintDialog* self); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/qprintsupport/gen_qprintengine.cpp b/qt/qprintsupport/gen_qprintengine.cpp new file mode 100644 index 00000000..c4f4ea21 --- /dev/null +++ b/qt/qprintsupport/gen_qprintengine.cpp @@ -0,0 +1,39 @@ +#include +#include +#include +#include "gen_qprintengine.h" +#include "_cgo_export.h" + +void QPrintEngine_SetProperty(QPrintEngine* self, int key, QVariant* value) { + self->setProperty(static_cast(key), *value); +} + +QVariant* QPrintEngine_Property(const QPrintEngine* self, int key) { + return new QVariant(self->property(static_cast(key))); +} + +bool QPrintEngine_NewPage(QPrintEngine* self) { + return self->newPage(); +} + +bool QPrintEngine_Abort(QPrintEngine* self) { + return self->abort(); +} + +int QPrintEngine_Metric(const QPrintEngine* self, int param1) { + return self->metric(static_cast(param1)); +} + +int QPrintEngine_PrinterState(const QPrintEngine* self) { + QPrinter::PrinterState _ret = self->printerState(); + return static_cast(_ret); +} + +void QPrintEngine_OperatorAssign(QPrintEngine* self, QPrintEngine* param1) { + self->operator=(*param1); +} + +void QPrintEngine_Delete(QPrintEngine* self) { + delete self; +} + diff --git a/qt/qprintsupport/gen_qprintengine.go b/qt/qprintsupport/gen_qprintengine.go new file mode 100644 index 00000000..490aafd7 --- /dev/null +++ b/qt/qprintsupport/gen_qprintengine.go @@ -0,0 +1,126 @@ +package qprintsupport + +/* + +#include "gen_qprintengine.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/qt" + "runtime" + "unsafe" +) + +type QPrintEngine__PrintEnginePropertyKey int + +const ( + QPrintEngine__PPK_CollateCopies QPrintEngine__PrintEnginePropertyKey = 0 + QPrintEngine__PPK_ColorMode QPrintEngine__PrintEnginePropertyKey = 1 + QPrintEngine__PPK_Creator QPrintEngine__PrintEnginePropertyKey = 2 + QPrintEngine__PPK_DocumentName QPrintEngine__PrintEnginePropertyKey = 3 + QPrintEngine__PPK_FullPage QPrintEngine__PrintEnginePropertyKey = 4 + QPrintEngine__PPK_NumberOfCopies QPrintEngine__PrintEnginePropertyKey = 5 + QPrintEngine__PPK_Orientation QPrintEngine__PrintEnginePropertyKey = 6 + QPrintEngine__PPK_OutputFileName QPrintEngine__PrintEnginePropertyKey = 7 + QPrintEngine__PPK_PageOrder QPrintEngine__PrintEnginePropertyKey = 8 + QPrintEngine__PPK_PageRect QPrintEngine__PrintEnginePropertyKey = 9 + QPrintEngine__PPK_PageSize QPrintEngine__PrintEnginePropertyKey = 10 + QPrintEngine__PPK_PaperRect QPrintEngine__PrintEnginePropertyKey = 11 + QPrintEngine__PPK_PaperSource QPrintEngine__PrintEnginePropertyKey = 12 + QPrintEngine__PPK_PrinterName QPrintEngine__PrintEnginePropertyKey = 13 + QPrintEngine__PPK_PrinterProgram QPrintEngine__PrintEnginePropertyKey = 14 + QPrintEngine__PPK_Resolution QPrintEngine__PrintEnginePropertyKey = 15 + QPrintEngine__PPK_SelectionOption QPrintEngine__PrintEnginePropertyKey = 16 + QPrintEngine__PPK_SupportedResolutions QPrintEngine__PrintEnginePropertyKey = 17 + QPrintEngine__PPK_WindowsPageSize QPrintEngine__PrintEnginePropertyKey = 18 + QPrintEngine__PPK_FontEmbedding QPrintEngine__PrintEnginePropertyKey = 19 + QPrintEngine__PPK_Duplex QPrintEngine__PrintEnginePropertyKey = 20 + QPrintEngine__PPK_PaperSources QPrintEngine__PrintEnginePropertyKey = 21 + QPrintEngine__PPK_CustomPaperSize QPrintEngine__PrintEnginePropertyKey = 22 + QPrintEngine__PPK_PageMargins QPrintEngine__PrintEnginePropertyKey = 23 + QPrintEngine__PPK_CopyCount QPrintEngine__PrintEnginePropertyKey = 24 + QPrintEngine__PPK_SupportsMultipleCopies QPrintEngine__PrintEnginePropertyKey = 25 + QPrintEngine__PPK_PaperName QPrintEngine__PrintEnginePropertyKey = 26 + QPrintEngine__PPK_QPageSize QPrintEngine__PrintEnginePropertyKey = 27 + QPrintEngine__PPK_QPageMargins QPrintEngine__PrintEnginePropertyKey = 28 + QPrintEngine__PPK_QPageLayout QPrintEngine__PrintEnginePropertyKey = 29 + QPrintEngine__PPK_PaperSize QPrintEngine__PrintEnginePropertyKey = 10 + QPrintEngine__PPK_CustomBase QPrintEngine__PrintEnginePropertyKey = 65280 +) + +type QPrintEngine struct { + h *C.QPrintEngine +} + +func (this *QPrintEngine) cPointer() *C.QPrintEngine { + if this == nil { + return nil + } + return this.h +} + +func (this *QPrintEngine) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +func newQPrintEngine(h *C.QPrintEngine) *QPrintEngine { + if h == nil { + return nil + } + return &QPrintEngine{h: h} +} + +func UnsafeNewQPrintEngine(h unsafe.Pointer) *QPrintEngine { + return newQPrintEngine((*C.QPrintEngine)(h)) +} + +func (this *QPrintEngine) SetProperty(key QPrintEngine__PrintEnginePropertyKey, value *qt.QVariant) { + C.QPrintEngine_SetProperty(this.h, (C.int)(key), (*C.QVariant)(value.UnsafePointer())) +} + +func (this *QPrintEngine) Property(key QPrintEngine__PrintEnginePropertyKey) *qt.QVariant { + _ret := C.QPrintEngine_Property(this.h, (C.int)(key)) + _goptr := qt.UnsafeNewQVariant(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QPrintEngine) NewPage() bool { + return (bool)(C.QPrintEngine_NewPage(this.h)) +} + +func (this *QPrintEngine) Abort() bool { + return (bool)(C.QPrintEngine_Abort(this.h)) +} + +func (this *QPrintEngine) Metric(param1 qt.QPaintDevice__PaintDeviceMetric) int { + return (int)(C.QPrintEngine_Metric(this.h, (C.int)(param1))) +} + +func (this *QPrintEngine) PrinterState() QPrinter__PrinterState { + return (QPrinter__PrinterState)(C.QPrintEngine_PrinterState(this.h)) +} + +func (this *QPrintEngine) OperatorAssign(param1 *QPrintEngine) { + C.QPrintEngine_OperatorAssign(this.h, param1.cPointer()) +} + +// Delete this object from C++ memory. +func (this *QPrintEngine) Delete() { + C.QPrintEngine_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 *QPrintEngine) GoGC() { + runtime.SetFinalizer(this, func(this *QPrintEngine) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/qprintsupport/gen_qprintengine.h b/qt/qprintsupport/gen_qprintengine.h new file mode 100644 index 00000000..c29d9bd5 --- /dev/null +++ b/qt/qprintsupport/gen_qprintengine.h @@ -0,0 +1,37 @@ +#ifndef GEN_QPRINTENGINE_H +#define GEN_QPRINTENGINE_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QPrintEngine; +class QVariant; +#else +typedef struct QPrintEngine QPrintEngine; +typedef struct QVariant QVariant; +#endif + +void QPrintEngine_SetProperty(QPrintEngine* self, int key, QVariant* value); +QVariant* QPrintEngine_Property(const QPrintEngine* self, int key); +bool QPrintEngine_NewPage(QPrintEngine* self); +bool QPrintEngine_Abort(QPrintEngine* self); +int QPrintEngine_Metric(const QPrintEngine* self, int param1); +int QPrintEngine_PrinterState(const QPrintEngine* self); +void QPrintEngine_OperatorAssign(QPrintEngine* self, QPrintEngine* param1); +void QPrintEngine_Delete(QPrintEngine* self); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/qprintsupport/gen_qprinter.cpp b/qt/qprintsupport/gen_qprinter.cpp new file mode 100644 index 00000000..91a90a77 --- /dev/null +++ b/qt/qprintsupport/gen_qprinter.cpp @@ -0,0 +1,376 @@ +#include +#define WORKAROUND_INNER_CLASS_DEFINITION_QPagedPaintDevice__Margins +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qprinter.h" +#include "_cgo_export.h" + +QPrinter* QPrinter_new() { + return new QPrinter(); +} + +QPrinter* QPrinter_new2(QPrinterInfo* printer) { + return new QPrinter(*printer); +} + +QPrinter* QPrinter_new3(int mode) { + return new QPrinter(static_cast(mode)); +} + +QPrinter* QPrinter_new4(QPrinterInfo* printer, int mode) { + return new QPrinter(*printer, static_cast(mode)); +} + +int QPrinter_DevType(const QPrinter* self) { + return self->devType(); +} + +void QPrinter_SetOutputFormat(QPrinter* self, int format) { + self->setOutputFormat(static_cast(format)); +} + +int QPrinter_OutputFormat(const QPrinter* self) { + QPrinter::OutputFormat _ret = self->outputFormat(); + return static_cast(_ret); +} + +void QPrinter_SetPdfVersion(QPrinter* self, int version) { + self->setPdfVersion(static_cast(version)); +} + +int QPrinter_PdfVersion(const QPrinter* self) { + QPagedPaintDevice::PdfVersion _ret = self->pdfVersion(); + return static_cast(_ret); +} + +void QPrinter_SetPrinterName(QPrinter* self, struct miqt_string* printerName) { + QString printerName_QString = QString::fromUtf8(&printerName->data, printerName->len); + self->setPrinterName(printerName_QString); +} + +struct miqt_string* QPrinter_PrinterName(const QPrinter* self) { + QString _ret = self->printerName(); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +bool QPrinter_IsValid(const QPrinter* self) { + return self->isValid(); +} + +void QPrinter_SetOutputFileName(QPrinter* self, struct miqt_string* outputFileName) { + QString outputFileName_QString = QString::fromUtf8(&outputFileName->data, outputFileName->len); + self->setOutputFileName(outputFileName_QString); +} + +struct miqt_string* QPrinter_OutputFileName(const QPrinter* self) { + QString _ret = self->outputFileName(); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +void QPrinter_SetPrintProgram(QPrinter* self, struct miqt_string* printProgram) { + QString printProgram_QString = QString::fromUtf8(&printProgram->data, printProgram->len); + self->setPrintProgram(printProgram_QString); +} + +struct miqt_string* QPrinter_PrintProgram(const QPrinter* self) { + QString _ret = self->printProgram(); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +void QPrinter_SetDocName(QPrinter* self, struct miqt_string* docName) { + QString docName_QString = QString::fromUtf8(&docName->data, docName->len); + self->setDocName(docName_QString); +} + +struct miqt_string* QPrinter_DocName(const QPrinter* self) { + QString _ret = self->docName(); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +void QPrinter_SetCreator(QPrinter* self, struct miqt_string* creator) { + QString creator_QString = QString::fromUtf8(&creator->data, creator->len); + self->setCreator(creator_QString); +} + +struct miqt_string* QPrinter_Creator(const QPrinter* self) { + QString _ret = self->creator(); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +void QPrinter_SetOrientation(QPrinter* self, int orientation) { + self->setOrientation(static_cast(orientation)); +} + +int QPrinter_Orientation(const QPrinter* self) { + QPrinter::Orientation _ret = self->orientation(); + return static_cast(_ret); +} + +void QPrinter_SetPageSize(QPrinter* self, int pageSize) { + self->setPageSize(static_cast(pageSize)); +} + +int QPrinter_PageSize(const QPrinter* self) { + QPagedPaintDevice::PageSize _ret = self->pageSize(); + return static_cast(_ret); +} + +void QPrinter_SetPageSizeMM(QPrinter* self, QSizeF* size) { + self->setPageSizeMM(*size); +} + +void QPrinter_SetPaperSize(QPrinter* self, int paperSize) { + self->setPaperSize(static_cast(paperSize)); +} + +int QPrinter_PaperSize(const QPrinter* self) { + QPrinter::PaperSize _ret = self->paperSize(); + return static_cast(_ret); +} + +void QPrinter_SetPaperSize2(QPrinter* self, QSizeF* paperSize, int unit) { + self->setPaperSize(*paperSize, static_cast(unit)); +} + +QSizeF* QPrinter_PaperSizeWithUnit(const QPrinter* self, int unit) { + return new QSizeF(self->paperSize(static_cast(unit))); +} + +void QPrinter_SetPaperName(QPrinter* self, struct miqt_string* paperName) { + QString paperName_QString = QString::fromUtf8(&paperName->data, paperName->len); + self->setPaperName(paperName_QString); +} + +struct miqt_string* QPrinter_PaperName(const QPrinter* self) { + QString _ret = self->paperName(); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +void QPrinter_SetPageOrder(QPrinter* self, int pageOrder) { + self->setPageOrder(static_cast(pageOrder)); +} + +int QPrinter_PageOrder(const QPrinter* self) { + QPrinter::PageOrder _ret = self->pageOrder(); + return static_cast(_ret); +} + +void QPrinter_SetResolution(QPrinter* self, int resolution) { + self->setResolution(static_cast(resolution)); +} + +int QPrinter_Resolution(const QPrinter* self) { + return self->resolution(); +} + +void QPrinter_SetColorMode(QPrinter* self, int colorMode) { + self->setColorMode(static_cast(colorMode)); +} + +int QPrinter_ColorMode(const QPrinter* self) { + QPrinter::ColorMode _ret = self->colorMode(); + return static_cast(_ret); +} + +void QPrinter_SetCollateCopies(QPrinter* self, bool collate) { + self->setCollateCopies(collate); +} + +bool QPrinter_CollateCopies(const QPrinter* self) { + return self->collateCopies(); +} + +void QPrinter_SetFullPage(QPrinter* self, bool fullPage) { + self->setFullPage(fullPage); +} + +bool QPrinter_FullPage(const QPrinter* self) { + return self->fullPage(); +} + +void QPrinter_SetNumCopies(QPrinter* self, int numCopies) { + self->setNumCopies(static_cast(numCopies)); +} + +int QPrinter_NumCopies(const QPrinter* self) { + return self->numCopies(); +} + +int QPrinter_ActualNumCopies(const QPrinter* self) { + return self->actualNumCopies(); +} + +void QPrinter_SetCopyCount(QPrinter* self, int copyCount) { + self->setCopyCount(static_cast(copyCount)); +} + +int QPrinter_CopyCount(const QPrinter* self) { + return self->copyCount(); +} + +bool QPrinter_SupportsMultipleCopies(const QPrinter* self) { + return self->supportsMultipleCopies(); +} + +void QPrinter_SetPaperSource(QPrinter* self, int paperSource) { + self->setPaperSource(static_cast(paperSource)); +} + +int QPrinter_PaperSource(const QPrinter* self) { + QPrinter::PaperSource _ret = self->paperSource(); + return static_cast(_ret); +} + +void QPrinter_SetDuplex(QPrinter* self, int duplex) { + self->setDuplex(static_cast(duplex)); +} + +int QPrinter_Duplex(const QPrinter* self) { + QPrinter::DuplexMode _ret = self->duplex(); + return static_cast(_ret); +} + +struct miqt_array* QPrinter_SupportedResolutions(const QPrinter* self) { + QList _ret = self->supportedResolutions(); + // Convert QList<> from C++ memory to manually-managed C memory + int* _arr = static_cast(malloc(sizeof(int) * _ret.length())); + for (size_t i = 0, e = _ret.length(); i < e; ++i) { + _arr[i] = _ret[i]; + } + struct miqt_array* _out = static_cast(malloc(sizeof(struct miqt_array))); + _out->len = _ret.length(); + _out->data = static_cast(_arr); + return _out; +} + +void QPrinter_SetFontEmbeddingEnabled(QPrinter* self, bool enable) { + self->setFontEmbeddingEnabled(enable); +} + +bool QPrinter_FontEmbeddingEnabled(const QPrinter* self) { + return self->fontEmbeddingEnabled(); +} + +void QPrinter_SetDoubleSidedPrinting(QPrinter* self, bool enable) { + self->setDoubleSidedPrinting(enable); +} + +bool QPrinter_DoubleSidedPrinting(const QPrinter* self) { + return self->doubleSidedPrinting(); +} + +void QPrinter_SetWinPageSize(QPrinter* self, int winPageSize) { + self->setWinPageSize(static_cast(winPageSize)); +} + +int QPrinter_WinPageSize(const QPrinter* self) { + return self->winPageSize(); +} + +QRect* QPrinter_PaperRect(const QPrinter* self) { + return new QRect(self->paperRect()); +} + +QRect* QPrinter_PageRect(const QPrinter* self) { + return new QRect(self->pageRect()); +} + +QRectF* QPrinter_PaperRectWithQPrinterUnit(const QPrinter* self, int param1) { + return new QRectF(self->paperRect(static_cast(param1))); +} + +QRectF* QPrinter_PageRectWithQPrinterUnit(const QPrinter* self, int param1) { + return new QRectF(self->pageRect(static_cast(param1))); +} + +struct miqt_string* QPrinter_PrinterSelectionOption(const QPrinter* self) { + QString _ret = self->printerSelectionOption(); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +void QPrinter_SetPrinterSelectionOption(QPrinter* self, struct miqt_string* printerSelectionOption) { + QString printerSelectionOption_QString = QString::fromUtf8(&printerSelectionOption->data, printerSelectionOption->len); + self->setPrinterSelectionOption(printerSelectionOption_QString); +} + +bool QPrinter_NewPage(QPrinter* self) { + return self->newPage(); +} + +bool QPrinter_Abort(QPrinter* self) { + return self->abort(); +} + +int QPrinter_PrinterState(const QPrinter* self) { + QPrinter::PrinterState _ret = self->printerState(); + return static_cast(_ret); +} + +QPaintEngine* QPrinter_PaintEngine(const QPrinter* self) { + return self->paintEngine(); +} + +QPrintEngine* QPrinter_PrintEngine(const QPrinter* self) { + return self->printEngine(); +} + +void QPrinter_SetFromTo(QPrinter* self, int fromPage, int toPage) { + self->setFromTo(static_cast(fromPage), static_cast(toPage)); +} + +int QPrinter_FromPage(const QPrinter* self) { + return self->fromPage(); +} + +int QPrinter_ToPage(const QPrinter* self) { + return self->toPage(); +} + +void QPrinter_SetPrintRange(QPrinter* self, int rangeVal) { + self->setPrintRange(static_cast(rangeVal)); +} + +int QPrinter_PrintRange(const QPrinter* self) { + QPrinter::PrintRange _ret = self->printRange(); + return static_cast(_ret); +} + +void QPrinter_SetMargins(QPrinter* self, QPagedPaintDevice__Margins* m) { + self->setMargins(*m); +} + +void QPrinter_SetPageMargins(QPrinter* self, double left, double top, double right, double bottom, int unit) { + self->setPageMargins(static_cast(left), static_cast(top), static_cast(right), static_cast(bottom), static_cast(unit)); +} + +void QPrinter_GetPageMargins(const QPrinter* self, double* left, double* top, double* right, double* bottom, int unit) { + self->getPageMargins(static_cast(left), static_cast(top), static_cast(right), static_cast(bottom), static_cast(unit)); +} + +void QPrinter_Delete(QPrinter* self) { + delete self; +} + diff --git a/qt/qprintsupport/gen_qprinter.go b/qt/qprintsupport/gen_qprinter.go new file mode 100644 index 00000000..47605023 --- /dev/null +++ b/qt/qprintsupport/gen_qprinter.go @@ -0,0 +1,530 @@ +package qprintsupport + +/* + +#include "gen_qprinter.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/libmiqt" + "github.com/mappu/miqt/qt" + "runtime" + "unsafe" +) + +type QPrinter__PrinterMode int + +const ( + QPrinter__ScreenResolution QPrinter__PrinterMode = 0 + QPrinter__PrinterResolution QPrinter__PrinterMode = 1 + QPrinter__HighResolution QPrinter__PrinterMode = 2 +) + +type QPrinter__Orientation int + +const ( + QPrinter__Portrait QPrinter__Orientation = 0 + QPrinter__Landscape QPrinter__Orientation = 1 +) + +type QPrinter__PageOrder int + +const ( + QPrinter__FirstPageFirst QPrinter__PageOrder = 0 + QPrinter__LastPageFirst QPrinter__PageOrder = 1 +) + +type QPrinter__ColorMode int + +const ( + QPrinter__GrayScale QPrinter__ColorMode = 0 + QPrinter__Color QPrinter__ColorMode = 1 +) + +type QPrinter__PaperSource int + +const ( + QPrinter__OnlyOne QPrinter__PaperSource = 0 + QPrinter__Lower QPrinter__PaperSource = 1 + QPrinter__Middle QPrinter__PaperSource = 2 + QPrinter__Manual QPrinter__PaperSource = 3 + QPrinter__Envelope QPrinter__PaperSource = 4 + QPrinter__EnvelopeManual QPrinter__PaperSource = 5 + QPrinter__Auto QPrinter__PaperSource = 6 + QPrinter__Tractor QPrinter__PaperSource = 7 + QPrinter__SmallFormat QPrinter__PaperSource = 8 + QPrinter__LargeFormat QPrinter__PaperSource = 9 + QPrinter__LargeCapacity QPrinter__PaperSource = 10 + QPrinter__Cassette QPrinter__PaperSource = 11 + QPrinter__FormSource QPrinter__PaperSource = 12 + QPrinter__MaxPageSource QPrinter__PaperSource = 13 + QPrinter__CustomSource QPrinter__PaperSource = 14 + QPrinter__LastPaperSource QPrinter__PaperSource = 14 + QPrinter__Upper QPrinter__PaperSource = 0 +) + +type QPrinter__PrinterState int + +const ( + QPrinter__Idle QPrinter__PrinterState = 0 + QPrinter__Active QPrinter__PrinterState = 1 + QPrinter__Aborted QPrinter__PrinterState = 2 + QPrinter__Error QPrinter__PrinterState = 3 +) + +type QPrinter__OutputFormat int + +const ( + QPrinter__NativeFormat QPrinter__OutputFormat = 0 + QPrinter__PdfFormat QPrinter__OutputFormat = 1 +) + +type QPrinter__PrintRange int + +const ( + QPrinter__AllPages QPrinter__PrintRange = 0 + QPrinter__Selection QPrinter__PrintRange = 1 + QPrinter__PageRange QPrinter__PrintRange = 2 + QPrinter__CurrentPage QPrinter__PrintRange = 3 +) + +type QPrinter__Unit int + +const ( + QPrinter__Millimeter QPrinter__Unit = 0 + QPrinter__Point QPrinter__Unit = 1 + QPrinter__Inch QPrinter__Unit = 2 + QPrinter__Pica QPrinter__Unit = 3 + QPrinter__Didot QPrinter__Unit = 4 + QPrinter__Cicero QPrinter__Unit = 5 + QPrinter__DevicePixel QPrinter__Unit = 6 +) + +type QPrinter__DuplexMode int + +const ( + QPrinter__DuplexNone QPrinter__DuplexMode = 0 + QPrinter__DuplexAuto QPrinter__DuplexMode = 1 + QPrinter__DuplexLongSide QPrinter__DuplexMode = 2 + QPrinter__DuplexShortSide QPrinter__DuplexMode = 3 +) + +type QPrinter struct { + h *C.QPrinter + *qt.QPagedPaintDevice +} + +func (this *QPrinter) cPointer() *C.QPrinter { + if this == nil { + return nil + } + return this.h +} + +func (this *QPrinter) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +func newQPrinter(h *C.QPrinter) *QPrinter { + if h == nil { + return nil + } + return &QPrinter{h: h, QPagedPaintDevice: qt.UnsafeNewQPagedPaintDevice(unsafe.Pointer(h))} +} + +func UnsafeNewQPrinter(h unsafe.Pointer) *QPrinter { + return newQPrinter((*C.QPrinter)(h)) +} + +// NewQPrinter constructs a new QPrinter object. +func NewQPrinter() *QPrinter { + ret := C.QPrinter_new() + return newQPrinter(ret) +} + +// NewQPrinter2 constructs a new QPrinter object. +func NewQPrinter2(printer *QPrinterInfo) *QPrinter { + ret := C.QPrinter_new2(printer.cPointer()) + return newQPrinter(ret) +} + +// NewQPrinter3 constructs a new QPrinter object. +func NewQPrinter3(mode QPrinter__PrinterMode) *QPrinter { + ret := C.QPrinter_new3((C.int)(mode)) + return newQPrinter(ret) +} + +// NewQPrinter4 constructs a new QPrinter object. +func NewQPrinter4(printer *QPrinterInfo, mode QPrinter__PrinterMode) *QPrinter { + ret := C.QPrinter_new4(printer.cPointer(), (C.int)(mode)) + return newQPrinter(ret) +} + +func (this *QPrinter) DevType() int { + return (int)(C.QPrinter_DevType(this.h)) +} + +func (this *QPrinter) SetOutputFormat(format QPrinter__OutputFormat) { + C.QPrinter_SetOutputFormat(this.h, (C.int)(format)) +} + +func (this *QPrinter) OutputFormat() QPrinter__OutputFormat { + return (QPrinter__OutputFormat)(C.QPrinter_OutputFormat(this.h)) +} + +func (this *QPrinter) SetPdfVersion(version qt.QPagedPaintDevice__PdfVersion) { + C.QPrinter_SetPdfVersion(this.h, (C.int)(version)) +} + +func (this *QPrinter) PdfVersion() qt.QPagedPaintDevice__PdfVersion { + return (qt.QPagedPaintDevice__PdfVersion)(C.QPrinter_PdfVersion(this.h)) +} + +func (this *QPrinter) SetPrinterName(printerName string) { + printerName_ms := libmiqt.Strdupg(printerName) + defer C.free(printerName_ms) + C.QPrinter_SetPrinterName(this.h, (*C.struct_miqt_string)(printerName_ms)) +} + +func (this *QPrinter) PrinterName() string { + var _ms *C.struct_miqt_string = C.QPrinter_PrinterName(this.h) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrinter) IsValid() bool { + return (bool)(C.QPrinter_IsValid(this.h)) +} + +func (this *QPrinter) SetOutputFileName(outputFileName string) { + outputFileName_ms := libmiqt.Strdupg(outputFileName) + defer C.free(outputFileName_ms) + C.QPrinter_SetOutputFileName(this.h, (*C.struct_miqt_string)(outputFileName_ms)) +} + +func (this *QPrinter) OutputFileName() string { + var _ms *C.struct_miqt_string = C.QPrinter_OutputFileName(this.h) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrinter) SetPrintProgram(printProgram string) { + printProgram_ms := libmiqt.Strdupg(printProgram) + defer C.free(printProgram_ms) + C.QPrinter_SetPrintProgram(this.h, (*C.struct_miqt_string)(printProgram_ms)) +} + +func (this *QPrinter) PrintProgram() string { + var _ms *C.struct_miqt_string = C.QPrinter_PrintProgram(this.h) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrinter) SetDocName(docName string) { + docName_ms := libmiqt.Strdupg(docName) + defer C.free(docName_ms) + C.QPrinter_SetDocName(this.h, (*C.struct_miqt_string)(docName_ms)) +} + +func (this *QPrinter) DocName() string { + var _ms *C.struct_miqt_string = C.QPrinter_DocName(this.h) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrinter) SetCreator(creator string) { + creator_ms := libmiqt.Strdupg(creator) + defer C.free(creator_ms) + C.QPrinter_SetCreator(this.h, (*C.struct_miqt_string)(creator_ms)) +} + +func (this *QPrinter) Creator() string { + var _ms *C.struct_miqt_string = C.QPrinter_Creator(this.h) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrinter) SetOrientation(orientation QPrinter__Orientation) { + C.QPrinter_SetOrientation(this.h, (C.int)(orientation)) +} + +func (this *QPrinter) Orientation() QPrinter__Orientation { + return (QPrinter__Orientation)(C.QPrinter_Orientation(this.h)) +} + +func (this *QPrinter) SetPageSize(pageSize qt.QPagedPaintDevice__PageSize) { + C.QPrinter_SetPageSize(this.h, (C.int)(pageSize)) +} + +func (this *QPrinter) PageSize() qt.QPagedPaintDevice__PageSize { + return (qt.QPagedPaintDevice__PageSize)(C.QPrinter_PageSize(this.h)) +} + +func (this *QPrinter) SetPageSizeMM(size *qt.QSizeF) { + C.QPrinter_SetPageSizeMM(this.h, (*C.QSizeF)(size.UnsafePointer())) +} + +func (this *QPrinter) SetPaperSize(paperSize qt.QPagedPaintDevice__PageSize) { + C.QPrinter_SetPaperSize(this.h, (C.int)(paperSize)) +} + +func (this *QPrinter) PaperSize() qt.QPagedPaintDevice__PageSize { + return (qt.QPagedPaintDevice__PageSize)(C.QPrinter_PaperSize(this.h)) +} + +func (this *QPrinter) SetPaperSize2(paperSize *qt.QSizeF, unit QPrinter__Unit) { + C.QPrinter_SetPaperSize2(this.h, (*C.QSizeF)(paperSize.UnsafePointer()), (C.int)(unit)) +} + +func (this *QPrinter) PaperSizeWithUnit(unit QPrinter__Unit) *qt.QSizeF { + _ret := C.QPrinter_PaperSizeWithUnit(this.h, (C.int)(unit)) + _goptr := qt.UnsafeNewQSizeF(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QPrinter) SetPaperName(paperName string) { + paperName_ms := libmiqt.Strdupg(paperName) + defer C.free(paperName_ms) + C.QPrinter_SetPaperName(this.h, (*C.struct_miqt_string)(paperName_ms)) +} + +func (this *QPrinter) PaperName() string { + var _ms *C.struct_miqt_string = C.QPrinter_PaperName(this.h) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrinter) SetPageOrder(pageOrder QPrinter__PageOrder) { + C.QPrinter_SetPageOrder(this.h, (C.int)(pageOrder)) +} + +func (this *QPrinter) PageOrder() QPrinter__PageOrder { + return (QPrinter__PageOrder)(C.QPrinter_PageOrder(this.h)) +} + +func (this *QPrinter) SetResolution(resolution int) { + C.QPrinter_SetResolution(this.h, (C.int)(resolution)) +} + +func (this *QPrinter) Resolution() int { + return (int)(C.QPrinter_Resolution(this.h)) +} + +func (this *QPrinter) SetColorMode(colorMode QPrinter__ColorMode) { + C.QPrinter_SetColorMode(this.h, (C.int)(colorMode)) +} + +func (this *QPrinter) ColorMode() QPrinter__ColorMode { + return (QPrinter__ColorMode)(C.QPrinter_ColorMode(this.h)) +} + +func (this *QPrinter) SetCollateCopies(collate bool) { + C.QPrinter_SetCollateCopies(this.h, (C.bool)(collate)) +} + +func (this *QPrinter) CollateCopies() bool { + return (bool)(C.QPrinter_CollateCopies(this.h)) +} + +func (this *QPrinter) SetFullPage(fullPage bool) { + C.QPrinter_SetFullPage(this.h, (C.bool)(fullPage)) +} + +func (this *QPrinter) FullPage() bool { + return (bool)(C.QPrinter_FullPage(this.h)) +} + +func (this *QPrinter) SetNumCopies(numCopies int) { + C.QPrinter_SetNumCopies(this.h, (C.int)(numCopies)) +} + +func (this *QPrinter) NumCopies() int { + return (int)(C.QPrinter_NumCopies(this.h)) +} + +func (this *QPrinter) ActualNumCopies() int { + return (int)(C.QPrinter_ActualNumCopies(this.h)) +} + +func (this *QPrinter) SetCopyCount(copyCount int) { + C.QPrinter_SetCopyCount(this.h, (C.int)(copyCount)) +} + +func (this *QPrinter) CopyCount() int { + return (int)(C.QPrinter_CopyCount(this.h)) +} + +func (this *QPrinter) SupportsMultipleCopies() bool { + return (bool)(C.QPrinter_SupportsMultipleCopies(this.h)) +} + +func (this *QPrinter) SetPaperSource(paperSource QPrinter__PaperSource) { + C.QPrinter_SetPaperSource(this.h, (C.int)(paperSource)) +} + +func (this *QPrinter) PaperSource() QPrinter__PaperSource { + return (QPrinter__PaperSource)(C.QPrinter_PaperSource(this.h)) +} + +func (this *QPrinter) SetDuplex(duplex QPrinter__DuplexMode) { + C.QPrinter_SetDuplex(this.h, (C.int)(duplex)) +} + +func (this *QPrinter) Duplex() QPrinter__DuplexMode { + return (QPrinter__DuplexMode)(C.QPrinter_Duplex(this.h)) +} + +func (this *QPrinter) SupportedResolutions() []int { + var _ma *C.struct_miqt_array = C.QPrinter_SupportedResolutions(this.h) + _ret := make([]int, int(_ma.len)) + _outCast := (*[0xffff]C.int)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + _ret[i] = (int)(_outCast[i]) + } + C.free(unsafe.Pointer(_ma)) + return _ret +} + +func (this *QPrinter) SetFontEmbeddingEnabled(enable bool) { + C.QPrinter_SetFontEmbeddingEnabled(this.h, (C.bool)(enable)) +} + +func (this *QPrinter) FontEmbeddingEnabled() bool { + return (bool)(C.QPrinter_FontEmbeddingEnabled(this.h)) +} + +func (this *QPrinter) SetDoubleSidedPrinting(enable bool) { + C.QPrinter_SetDoubleSidedPrinting(this.h, (C.bool)(enable)) +} + +func (this *QPrinter) DoubleSidedPrinting() bool { + return (bool)(C.QPrinter_DoubleSidedPrinting(this.h)) +} + +func (this *QPrinter) SetWinPageSize(winPageSize int) { + C.QPrinter_SetWinPageSize(this.h, (C.int)(winPageSize)) +} + +func (this *QPrinter) WinPageSize() int { + return (int)(C.QPrinter_WinPageSize(this.h)) +} + +func (this *QPrinter) PaperRect() *qt.QRect { + _ret := C.QPrinter_PaperRect(this.h) + _goptr := qt.UnsafeNewQRect(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QPrinter) PageRect() *qt.QRect { + _ret := C.QPrinter_PageRect(this.h) + _goptr := qt.UnsafeNewQRect(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QPrinter) PaperRectWithQPrinterUnit(param1 QPrinter__Unit) *qt.QRectF { + _ret := C.QPrinter_PaperRectWithQPrinterUnit(this.h, (C.int)(param1)) + _goptr := qt.UnsafeNewQRectF(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QPrinter) PageRectWithQPrinterUnit(param1 QPrinter__Unit) *qt.QRectF { + _ret := C.QPrinter_PageRectWithQPrinterUnit(this.h, (C.int)(param1)) + _goptr := qt.UnsafeNewQRectF(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QPrinter) PrinterSelectionOption() string { + var _ms *C.struct_miqt_string = C.QPrinter_PrinterSelectionOption(this.h) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrinter) SetPrinterSelectionOption(printerSelectionOption string) { + printerSelectionOption_ms := libmiqt.Strdupg(printerSelectionOption) + defer C.free(printerSelectionOption_ms) + C.QPrinter_SetPrinterSelectionOption(this.h, (*C.struct_miqt_string)(printerSelectionOption_ms)) +} + +func (this *QPrinter) NewPage() bool { + return (bool)(C.QPrinter_NewPage(this.h)) +} + +func (this *QPrinter) Abort() bool { + return (bool)(C.QPrinter_Abort(this.h)) +} + +func (this *QPrinter) PrinterState() QPrinter__PrinterState { + return (QPrinter__PrinterState)(C.QPrinter_PrinterState(this.h)) +} + +func (this *QPrinter) PaintEngine() *qt.QPaintEngine { + return qt.UnsafeNewQPaintEngine(unsafe.Pointer(C.QPrinter_PaintEngine(this.h))) +} + +func (this *QPrinter) PrintEngine() *QPrintEngine { + return UnsafeNewQPrintEngine(unsafe.Pointer(C.QPrinter_PrintEngine(this.h))) +} + +func (this *QPrinter) SetFromTo(fromPage int, toPage int) { + C.QPrinter_SetFromTo(this.h, (C.int)(fromPage), (C.int)(toPage)) +} + +func (this *QPrinter) FromPage() int { + return (int)(C.QPrinter_FromPage(this.h)) +} + +func (this *QPrinter) ToPage() int { + return (int)(C.QPrinter_ToPage(this.h)) +} + +func (this *QPrinter) SetPrintRange(rangeVal QPrinter__PrintRange) { + C.QPrinter_SetPrintRange(this.h, (C.int)(rangeVal)) +} + +func (this *QPrinter) PrintRange() QPrinter__PrintRange { + return (QPrinter__PrintRange)(C.QPrinter_PrintRange(this.h)) +} + +func (this *QPrinter) SetMargins(m *qt.QPagedPaintDevice__Margins) { + C.QPrinter_SetMargins(this.h, (*C.QPagedPaintDevice__Margins)(m.UnsafePointer())) +} + +func (this *QPrinter) SetPageMargins(left float64, top float64, right float64, bottom float64, unit QPrinter__Unit) { + C.QPrinter_SetPageMargins(this.h, (C.double)(left), (C.double)(top), (C.double)(right), (C.double)(bottom), (C.int)(unit)) +} + +func (this *QPrinter) GetPageMargins(left *float64, top *float64, right *float64, bottom *float64, unit QPrinter__Unit) { + C.QPrinter_GetPageMargins(this.h, (*C.double)(unsafe.Pointer(left)), (*C.double)(unsafe.Pointer(top)), (*C.double)(unsafe.Pointer(right)), (*C.double)(unsafe.Pointer(bottom)), (C.int)(unit)) +} + +// Delete this object from C++ memory. +func (this *QPrinter) Delete() { + C.QPrinter_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 *QPrinter) GoGC() { + runtime.SetFinalizer(this, func(this *QPrinter) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/qprintsupport/gen_qprinter.h b/qt/qprintsupport/gen_qprinter.h new file mode 100644 index 00000000..8f73d053 --- /dev/null +++ b/qt/qprintsupport/gen_qprinter.h @@ -0,0 +1,123 @@ +#ifndef GEN_QPRINTER_H +#define GEN_QPRINTER_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +#if defined(WORKAROUND_INNER_CLASS_DEFINITION_QPagedPaintDevice__Margins) +typedef QPagedPaintDevice::Margins QPagedPaintDevice__Margins; +#else +class QPagedPaintDevice__Margins; +#endif +class QPaintEngine; +class QPrintEngine; +class QPrinter; +class QPrinterInfo; +class QRect; +class QRectF; +class QSizeF; +#else +typedef struct QPagedPaintDevice__Margins QPagedPaintDevice__Margins; +typedef struct QPaintEngine QPaintEngine; +typedef struct QPrintEngine QPrintEngine; +typedef struct QPrinter QPrinter; +typedef struct QPrinterInfo QPrinterInfo; +typedef struct QRect QRect; +typedef struct QRectF QRectF; +typedef struct QSizeF QSizeF; +#endif + +QPrinter* QPrinter_new(); +QPrinter* QPrinter_new2(QPrinterInfo* printer); +QPrinter* QPrinter_new3(int mode); +QPrinter* QPrinter_new4(QPrinterInfo* printer, int mode); +int QPrinter_DevType(const QPrinter* self); +void QPrinter_SetOutputFormat(QPrinter* self, int format); +int QPrinter_OutputFormat(const QPrinter* self); +void QPrinter_SetPdfVersion(QPrinter* self, int version); +int QPrinter_PdfVersion(const QPrinter* self); +void QPrinter_SetPrinterName(QPrinter* self, struct miqt_string* printerName); +struct miqt_string* QPrinter_PrinterName(const QPrinter* self); +bool QPrinter_IsValid(const QPrinter* self); +void QPrinter_SetOutputFileName(QPrinter* self, struct miqt_string* outputFileName); +struct miqt_string* QPrinter_OutputFileName(const QPrinter* self); +void QPrinter_SetPrintProgram(QPrinter* self, struct miqt_string* printProgram); +struct miqt_string* QPrinter_PrintProgram(const QPrinter* self); +void QPrinter_SetDocName(QPrinter* self, struct miqt_string* docName); +struct miqt_string* QPrinter_DocName(const QPrinter* self); +void QPrinter_SetCreator(QPrinter* self, struct miqt_string* creator); +struct miqt_string* QPrinter_Creator(const QPrinter* self); +void QPrinter_SetOrientation(QPrinter* self, int orientation); +int QPrinter_Orientation(const QPrinter* self); +void QPrinter_SetPageSize(QPrinter* self, int pageSize); +int QPrinter_PageSize(const QPrinter* self); +void QPrinter_SetPageSizeMM(QPrinter* self, QSizeF* size); +void QPrinter_SetPaperSize(QPrinter* self, int paperSize); +int QPrinter_PaperSize(const QPrinter* self); +void QPrinter_SetPaperSize2(QPrinter* self, QSizeF* paperSize, int unit); +QSizeF* QPrinter_PaperSizeWithUnit(const QPrinter* self, int unit); +void QPrinter_SetPaperName(QPrinter* self, struct miqt_string* paperName); +struct miqt_string* QPrinter_PaperName(const QPrinter* self); +void QPrinter_SetPageOrder(QPrinter* self, int pageOrder); +int QPrinter_PageOrder(const QPrinter* self); +void QPrinter_SetResolution(QPrinter* self, int resolution); +int QPrinter_Resolution(const QPrinter* self); +void QPrinter_SetColorMode(QPrinter* self, int colorMode); +int QPrinter_ColorMode(const QPrinter* self); +void QPrinter_SetCollateCopies(QPrinter* self, bool collate); +bool QPrinter_CollateCopies(const QPrinter* self); +void QPrinter_SetFullPage(QPrinter* self, bool fullPage); +bool QPrinter_FullPage(const QPrinter* self); +void QPrinter_SetNumCopies(QPrinter* self, int numCopies); +int QPrinter_NumCopies(const QPrinter* self); +int QPrinter_ActualNumCopies(const QPrinter* self); +void QPrinter_SetCopyCount(QPrinter* self, int copyCount); +int QPrinter_CopyCount(const QPrinter* self); +bool QPrinter_SupportsMultipleCopies(const QPrinter* self); +void QPrinter_SetPaperSource(QPrinter* self, int paperSource); +int QPrinter_PaperSource(const QPrinter* self); +void QPrinter_SetDuplex(QPrinter* self, int duplex); +int QPrinter_Duplex(const QPrinter* self); +struct miqt_array* QPrinter_SupportedResolutions(const QPrinter* self); +void QPrinter_SetFontEmbeddingEnabled(QPrinter* self, bool enable); +bool QPrinter_FontEmbeddingEnabled(const QPrinter* self); +void QPrinter_SetDoubleSidedPrinting(QPrinter* self, bool enable); +bool QPrinter_DoubleSidedPrinting(const QPrinter* self); +void QPrinter_SetWinPageSize(QPrinter* self, int winPageSize); +int QPrinter_WinPageSize(const QPrinter* self); +QRect* QPrinter_PaperRect(const QPrinter* self); +QRect* QPrinter_PageRect(const QPrinter* self); +QRectF* QPrinter_PaperRectWithQPrinterUnit(const QPrinter* self, int param1); +QRectF* QPrinter_PageRectWithQPrinterUnit(const QPrinter* self, int param1); +struct miqt_string* QPrinter_PrinterSelectionOption(const QPrinter* self); +void QPrinter_SetPrinterSelectionOption(QPrinter* self, struct miqt_string* printerSelectionOption); +bool QPrinter_NewPage(QPrinter* self); +bool QPrinter_Abort(QPrinter* self); +int QPrinter_PrinterState(const QPrinter* self); +QPaintEngine* QPrinter_PaintEngine(const QPrinter* self); +QPrintEngine* QPrinter_PrintEngine(const QPrinter* self); +void QPrinter_SetFromTo(QPrinter* self, int fromPage, int toPage); +int QPrinter_FromPage(const QPrinter* self); +int QPrinter_ToPage(const QPrinter* self); +void QPrinter_SetPrintRange(QPrinter* self, int rangeVal); +int QPrinter_PrintRange(const QPrinter* self); +void QPrinter_SetMargins(QPrinter* self, QPagedPaintDevice__Margins* m); +void QPrinter_SetPageMargins(QPrinter* self, double left, double top, double right, double bottom, int unit); +void QPrinter_GetPageMargins(const QPrinter* self, double* left, double* top, double* right, double* bottom, int unit); +void QPrinter_Delete(QPrinter* self); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/qprintsupport/gen_qprinterinfo.cpp b/qt/qprintsupport/gen_qprinterinfo.cpp new file mode 100644 index 00000000..485710f0 --- /dev/null +++ b/qt/qprintsupport/gen_qprinterinfo.cpp @@ -0,0 +1,215 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qprinterinfo.h" +#include "_cgo_export.h" + +QPrinterInfo* QPrinterInfo_new() { + return new QPrinterInfo(); +} + +QPrinterInfo* QPrinterInfo_new2(QPrinterInfo* other) { + return new QPrinterInfo(*other); +} + +QPrinterInfo* QPrinterInfo_new3(QPrinter* printer) { + return new QPrinterInfo(*printer); +} + +void QPrinterInfo_OperatorAssign(QPrinterInfo* self, QPrinterInfo* other) { + self->operator=(*other); +} + +struct miqt_string* QPrinterInfo_PrinterName(const QPrinterInfo* self) { + QString _ret = self->printerName(); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrinterInfo_Description(const QPrinterInfo* self) { + QString _ret = self->description(); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrinterInfo_Location(const QPrinterInfo* self) { + QString _ret = self->location(); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrinterInfo_MakeAndModel(const QPrinterInfo* self) { + QString _ret = self->makeAndModel(); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +bool QPrinterInfo_IsNull(const QPrinterInfo* self) { + return self->isNull(); +} + +bool QPrinterInfo_IsDefault(const QPrinterInfo* self) { + return self->isDefault(); +} + +bool QPrinterInfo_IsRemote(const QPrinterInfo* self) { + return self->isRemote(); +} + +int QPrinterInfo_State(const QPrinterInfo* self) { + QPrinter::PrinterState _ret = self->state(); + return static_cast(_ret); +} + +struct miqt_array* QPrinterInfo_SupportedPageSizes(const QPrinterInfo* self) { + QList _ret = self->supportedPageSizes(); + // Convert QList<> from C++ memory to manually-managed C memory + QPageSize** _arr = static_cast(malloc(sizeof(QPageSize*) * _ret.length())); + for (size_t i = 0, e = _ret.length(); i < e; ++i) { + _arr[i] = new QPageSize(_ret[i]); + } + struct miqt_array* _out = static_cast(malloc(sizeof(struct miqt_array))); + _out->len = _ret.length(); + _out->data = static_cast(_arr); + return _out; +} + +QPageSize* QPrinterInfo_DefaultPageSize(const QPrinterInfo* self) { + return new QPageSize(self->defaultPageSize()); +} + +bool QPrinterInfo_SupportsCustomPageSizes(const QPrinterInfo* self) { + return self->supportsCustomPageSizes(); +} + +QPageSize* QPrinterInfo_MinimumPhysicalPageSize(const QPrinterInfo* self) { + return new QPageSize(self->minimumPhysicalPageSize()); +} + +QPageSize* QPrinterInfo_MaximumPhysicalPageSize(const QPrinterInfo* self) { + return new QPageSize(self->maximumPhysicalPageSize()); +} + +struct miqt_array* QPrinterInfo_SupportedPaperSizes(const QPrinterInfo* self) { + QList _ret = self->supportedPaperSizes(); + // Convert QList<> from C++ memory to manually-managed C memory + int* _arr = static_cast(malloc(sizeof(int) * _ret.length())); + for (size_t i = 0, e = _ret.length(); i < e; ++i) { + QPagedPaintDevice::PageSize _lv_ret = _ret[i]; + _arr[i] = static_cast(_lv_ret); + } + struct miqt_array* _out = static_cast(malloc(sizeof(struct miqt_array))); + _out->len = _ret.length(); + _out->data = static_cast(_arr); + return _out; +} + +struct miqt_array* QPrinterInfo_SupportedResolutions(const QPrinterInfo* self) { + QList _ret = self->supportedResolutions(); + // Convert QList<> from C++ memory to manually-managed C memory + int* _arr = static_cast(malloc(sizeof(int) * _ret.length())); + for (size_t i = 0, e = _ret.length(); i < e; ++i) { + _arr[i] = _ret[i]; + } + struct miqt_array* _out = static_cast(malloc(sizeof(struct miqt_array))); + _out->len = _ret.length(); + _out->data = static_cast(_arr); + return _out; +} + +int QPrinterInfo_DefaultDuplexMode(const QPrinterInfo* self) { + QPrinter::DuplexMode _ret = self->defaultDuplexMode(); + return static_cast(_ret); +} + +struct miqt_array* QPrinterInfo_SupportedDuplexModes(const QPrinterInfo* self) { + QList _ret = self->supportedDuplexModes(); + // Convert QList<> from C++ memory to manually-managed C memory + int* _arr = static_cast(malloc(sizeof(int) * _ret.length())); + for (size_t i = 0, e = _ret.length(); i < e; ++i) { + QPrinter::DuplexMode _lv_ret = _ret[i]; + _arr[i] = static_cast(_lv_ret); + } + struct miqt_array* _out = static_cast(malloc(sizeof(struct miqt_array))); + _out->len = _ret.length(); + _out->data = static_cast(_arr); + return _out; +} + +int QPrinterInfo_DefaultColorMode(const QPrinterInfo* self) { + QPrinter::ColorMode _ret = self->defaultColorMode(); + return static_cast(_ret); +} + +struct miqt_array* QPrinterInfo_SupportedColorModes(const QPrinterInfo* self) { + QList _ret = self->supportedColorModes(); + // Convert QList<> from C++ memory to manually-managed C memory + int* _arr = static_cast(malloc(sizeof(int) * _ret.length())); + for (size_t i = 0, e = _ret.length(); i < e; ++i) { + QPrinter::ColorMode _lv_ret = _ret[i]; + _arr[i] = static_cast(_lv_ret); + } + struct miqt_array* _out = static_cast(malloc(sizeof(struct miqt_array))); + _out->len = _ret.length(); + _out->data = static_cast(_arr); + return _out; +} + +struct miqt_array* QPrinterInfo_AvailablePrinterNames() { + QStringList _ret = QPrinterInfo::availablePrinterNames(); + // Convert QList<> from C++ memory to manually-managed C memory + struct miqt_string** _arr = static_cast(malloc(sizeof(struct miqt_string*) * _ret.length())); + for (size_t i = 0, e = _ret.length(); i < e; ++i) { + QString _lv_ret = _ret[i]; + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _lv_b = _lv_ret.toUtf8(); + _arr[i] = miqt_strdup(_lv_b.data(), _lv_b.length()); + } + struct miqt_array* _out = static_cast(malloc(sizeof(struct miqt_array))); + _out->len = _ret.length(); + _out->data = static_cast(_arr); + return _out; +} + +struct miqt_array* QPrinterInfo_AvailablePrinters() { + QList _ret = QPrinterInfo::availablePrinters(); + // Convert QList<> from C++ memory to manually-managed C memory + QPrinterInfo** _arr = static_cast(malloc(sizeof(QPrinterInfo*) * _ret.length())); + for (size_t i = 0, e = _ret.length(); i < e; ++i) { + _arr[i] = new QPrinterInfo(_ret[i]); + } + struct miqt_array* _out = static_cast(malloc(sizeof(struct miqt_array))); + _out->len = _ret.length(); + _out->data = static_cast(_arr); + return _out; +} + +struct miqt_string* QPrinterInfo_DefaultPrinterName() { + QString _ret = QPrinterInfo::defaultPrinterName(); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +QPrinterInfo* QPrinterInfo_DefaultPrinter() { + return new QPrinterInfo(QPrinterInfo::defaultPrinter()); +} + +QPrinterInfo* QPrinterInfo_PrinterInfo(struct miqt_string* printerName) { + QString printerName_QString = QString::fromUtf8(&printerName->data, printerName->len); + return new QPrinterInfo(QPrinterInfo::printerInfo(printerName_QString)); +} + +void QPrinterInfo_Delete(QPrinterInfo* self) { + delete self; +} + diff --git a/qt/qprintsupport/gen_qprinterinfo.go b/qt/qprintsupport/gen_qprinterinfo.go new file mode 100644 index 00000000..dffa39d6 --- /dev/null +++ b/qt/qprintsupport/gen_qprinterinfo.go @@ -0,0 +1,267 @@ +package qprintsupport + +/* + +#include "gen_qprinterinfo.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/libmiqt" + "github.com/mappu/miqt/qt" + "runtime" + "unsafe" +) + +type QPrinterInfo struct { + h *C.QPrinterInfo +} + +func (this *QPrinterInfo) cPointer() *C.QPrinterInfo { + if this == nil { + return nil + } + return this.h +} + +func (this *QPrinterInfo) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +func newQPrinterInfo(h *C.QPrinterInfo) *QPrinterInfo { + if h == nil { + return nil + } + return &QPrinterInfo{h: h} +} + +func UnsafeNewQPrinterInfo(h unsafe.Pointer) *QPrinterInfo { + return newQPrinterInfo((*C.QPrinterInfo)(h)) +} + +// NewQPrinterInfo constructs a new QPrinterInfo object. +func NewQPrinterInfo() *QPrinterInfo { + ret := C.QPrinterInfo_new() + return newQPrinterInfo(ret) +} + +// NewQPrinterInfo2 constructs a new QPrinterInfo object. +func NewQPrinterInfo2(other *QPrinterInfo) *QPrinterInfo { + ret := C.QPrinterInfo_new2(other.cPointer()) + return newQPrinterInfo(ret) +} + +// NewQPrinterInfo3 constructs a new QPrinterInfo object. +func NewQPrinterInfo3(printer *QPrinter) *QPrinterInfo { + ret := C.QPrinterInfo_new3(printer.cPointer()) + return newQPrinterInfo(ret) +} + +func (this *QPrinterInfo) OperatorAssign(other *QPrinterInfo) { + C.QPrinterInfo_OperatorAssign(this.h, other.cPointer()) +} + +func (this *QPrinterInfo) PrinterName() string { + var _ms *C.struct_miqt_string = C.QPrinterInfo_PrinterName(this.h) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrinterInfo) Description() string { + var _ms *C.struct_miqt_string = C.QPrinterInfo_Description(this.h) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrinterInfo) Location() string { + var _ms *C.struct_miqt_string = C.QPrinterInfo_Location(this.h) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrinterInfo) MakeAndModel() string { + var _ms *C.struct_miqt_string = C.QPrinterInfo_MakeAndModel(this.h) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrinterInfo) IsNull() bool { + return (bool)(C.QPrinterInfo_IsNull(this.h)) +} + +func (this *QPrinterInfo) IsDefault() bool { + return (bool)(C.QPrinterInfo_IsDefault(this.h)) +} + +func (this *QPrinterInfo) IsRemote() bool { + return (bool)(C.QPrinterInfo_IsRemote(this.h)) +} + +func (this *QPrinterInfo) State() QPrinter__PrinterState { + return (QPrinter__PrinterState)(C.QPrinterInfo_State(this.h)) +} + +func (this *QPrinterInfo) SupportedPageSizes() []qt.QPageSize { + var _ma *C.struct_miqt_array = C.QPrinterInfo_SupportedPageSizes(this.h) + _ret := make([]qt.QPageSize, int(_ma.len)) + _outCast := (*[0xffff]*C.QPageSize)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + _lv_ret := _outCast[i] + _lv_goptr := qt.UnsafeNewQPageSize(unsafe.Pointer(_lv_ret)) + _lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + _ret[i] = *_lv_goptr + } + C.free(unsafe.Pointer(_ma)) + return _ret +} + +func (this *QPrinterInfo) DefaultPageSize() *qt.QPageSize { + _ret := C.QPrinterInfo_DefaultPageSize(this.h) + _goptr := qt.UnsafeNewQPageSize(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QPrinterInfo) SupportsCustomPageSizes() bool { + return (bool)(C.QPrinterInfo_SupportsCustomPageSizes(this.h)) +} + +func (this *QPrinterInfo) MinimumPhysicalPageSize() *qt.QPageSize { + _ret := C.QPrinterInfo_MinimumPhysicalPageSize(this.h) + _goptr := qt.UnsafeNewQPageSize(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QPrinterInfo) MaximumPhysicalPageSize() *qt.QPageSize { + _ret := C.QPrinterInfo_MaximumPhysicalPageSize(this.h) + _goptr := qt.UnsafeNewQPageSize(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QPrinterInfo) SupportedPaperSizes() []qt.QPagedPaintDevice__PageSize { + var _ma *C.struct_miqt_array = C.QPrinterInfo_SupportedPaperSizes(this.h) + _ret := make([]qt.QPagedPaintDevice__PageSize, int(_ma.len)) + _outCast := (*[0xffff]C.int)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + _ret[i] = (qt.QPagedPaintDevice__PageSize)(_outCast[i]) + } + C.free(unsafe.Pointer(_ma)) + return _ret +} + +func (this *QPrinterInfo) SupportedResolutions() []int { + var _ma *C.struct_miqt_array = C.QPrinterInfo_SupportedResolutions(this.h) + _ret := make([]int, int(_ma.len)) + _outCast := (*[0xffff]C.int)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + _ret[i] = (int)(_outCast[i]) + } + C.free(unsafe.Pointer(_ma)) + return _ret +} + +func (this *QPrinterInfo) DefaultDuplexMode() QPrinter__DuplexMode { + return (QPrinter__DuplexMode)(C.QPrinterInfo_DefaultDuplexMode(this.h)) +} + +func (this *QPrinterInfo) SupportedDuplexModes() []QPrinter__DuplexMode { + var _ma *C.struct_miqt_array = C.QPrinterInfo_SupportedDuplexModes(this.h) + _ret := make([]QPrinter__DuplexMode, int(_ma.len)) + _outCast := (*[0xffff]C.int)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + _ret[i] = (QPrinter__DuplexMode)(_outCast[i]) + } + C.free(unsafe.Pointer(_ma)) + return _ret +} + +func (this *QPrinterInfo) DefaultColorMode() QPrinter__ColorMode { + return (QPrinter__ColorMode)(C.QPrinterInfo_DefaultColorMode(this.h)) +} + +func (this *QPrinterInfo) SupportedColorModes() []QPrinter__ColorMode { + var _ma *C.struct_miqt_array = C.QPrinterInfo_SupportedColorModes(this.h) + _ret := make([]QPrinter__ColorMode, int(_ma.len)) + _outCast := (*[0xffff]C.int)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + _ret[i] = (QPrinter__ColorMode)(_outCast[i]) + } + C.free(unsafe.Pointer(_ma)) + return _ret +} + +func QPrinterInfo_AvailablePrinterNames() []string { + var _ma *C.struct_miqt_array = C.QPrinterInfo_AvailablePrinterNames() + _ret := make([]string, int(_ma.len)) + _outCast := (*[0xffff]*C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + var _lv_ms *C.struct_miqt_string = _outCast[i] + _lv_ret := C.GoStringN(&_lv_ms.data, C.int(int64(_lv_ms.len))) + C.free(unsafe.Pointer(_lv_ms)) + _ret[i] = _lv_ret + } + C.free(unsafe.Pointer(_ma)) + return _ret +} + +func QPrinterInfo_AvailablePrinters() []QPrinterInfo { + var _ma *C.struct_miqt_array = C.QPrinterInfo_AvailablePrinters() + _ret := make([]QPrinterInfo, int(_ma.len)) + _outCast := (*[0xffff]*C.QPrinterInfo)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + _lv_ret := _outCast[i] + _lv_goptr := newQPrinterInfo(_lv_ret) + _lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + _ret[i] = *_lv_goptr + } + C.free(unsafe.Pointer(_ma)) + return _ret +} + +func QPrinterInfo_DefaultPrinterName() string { + var _ms *C.struct_miqt_string = C.QPrinterInfo_DefaultPrinterName() + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QPrinterInfo_DefaultPrinter() *QPrinterInfo { + _ret := C.QPrinterInfo_DefaultPrinter() + _goptr := newQPrinterInfo(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func QPrinterInfo_PrinterInfo(printerName string) *QPrinterInfo { + printerName_ms := libmiqt.Strdupg(printerName) + defer C.free(printerName_ms) + _ret := C.QPrinterInfo_PrinterInfo((*C.struct_miqt_string)(printerName_ms)) + _goptr := newQPrinterInfo(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +// Delete this object from C++ memory. +func (this *QPrinterInfo) Delete() { + C.QPrinterInfo_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 *QPrinterInfo) GoGC() { + runtime.SetFinalizer(this, func(this *QPrinterInfo) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/qprintsupport/gen_qprinterinfo.h b/qt/qprintsupport/gen_qprinterinfo.h new file mode 100644 index 00000000..6d1dbfc4 --- /dev/null +++ b/qt/qprintsupport/gen_qprinterinfo.h @@ -0,0 +1,60 @@ +#ifndef GEN_QPRINTERINFO_H +#define GEN_QPRINTERINFO_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QPageSize; +class QPrinter; +class QPrinterInfo; +#else +typedef struct QPageSize QPageSize; +typedef struct QPrinter QPrinter; +typedef struct QPrinterInfo QPrinterInfo; +#endif + +QPrinterInfo* QPrinterInfo_new(); +QPrinterInfo* QPrinterInfo_new2(QPrinterInfo* other); +QPrinterInfo* QPrinterInfo_new3(QPrinter* printer); +void QPrinterInfo_OperatorAssign(QPrinterInfo* self, QPrinterInfo* other); +struct miqt_string* QPrinterInfo_PrinterName(const QPrinterInfo* self); +struct miqt_string* QPrinterInfo_Description(const QPrinterInfo* self); +struct miqt_string* QPrinterInfo_Location(const QPrinterInfo* self); +struct miqt_string* QPrinterInfo_MakeAndModel(const QPrinterInfo* self); +bool QPrinterInfo_IsNull(const QPrinterInfo* self); +bool QPrinterInfo_IsDefault(const QPrinterInfo* self); +bool QPrinterInfo_IsRemote(const QPrinterInfo* self); +int QPrinterInfo_State(const QPrinterInfo* self); +struct miqt_array* QPrinterInfo_SupportedPageSizes(const QPrinterInfo* self); +QPageSize* QPrinterInfo_DefaultPageSize(const QPrinterInfo* self); +bool QPrinterInfo_SupportsCustomPageSizes(const QPrinterInfo* self); +QPageSize* QPrinterInfo_MinimumPhysicalPageSize(const QPrinterInfo* self); +QPageSize* QPrinterInfo_MaximumPhysicalPageSize(const QPrinterInfo* self); +struct miqt_array* QPrinterInfo_SupportedPaperSizes(const QPrinterInfo* self); +struct miqt_array* QPrinterInfo_SupportedResolutions(const QPrinterInfo* self); +int QPrinterInfo_DefaultDuplexMode(const QPrinterInfo* self); +struct miqt_array* QPrinterInfo_SupportedDuplexModes(const QPrinterInfo* self); +int QPrinterInfo_DefaultColorMode(const QPrinterInfo* self); +struct miqt_array* QPrinterInfo_SupportedColorModes(const QPrinterInfo* self); +struct miqt_array* QPrinterInfo_AvailablePrinterNames(); +struct miqt_array* QPrinterInfo_AvailablePrinters(); +struct miqt_string* QPrinterInfo_DefaultPrinterName(); +QPrinterInfo* QPrinterInfo_DefaultPrinter(); +QPrinterInfo* QPrinterInfo_PrinterInfo(struct miqt_string* printerName); +void QPrinterInfo_Delete(QPrinterInfo* self); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/qprintsupport/gen_qprintpreviewdialog.cpp b/qt/qprintsupport/gen_qprintpreviewdialog.cpp new file mode 100644 index 00000000..7b150395 --- /dev/null +++ b/qt/qprintsupport/gen_qprintpreviewdialog.cpp @@ -0,0 +1,112 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qprintpreviewdialog.h" +#include "_cgo_export.h" + +QPrintPreviewDialog* QPrintPreviewDialog_new() { + return new QPrintPreviewDialog(); +} + +QPrintPreviewDialog* QPrintPreviewDialog_new2(QPrinter* printer) { + return new QPrintPreviewDialog(printer); +} + +QPrintPreviewDialog* QPrintPreviewDialog_new3(QWidget* parent) { + return new QPrintPreviewDialog(parent); +} + +QPrintPreviewDialog* QPrintPreviewDialog_new4(QWidget* parent, int flags) { + return new QPrintPreviewDialog(parent, static_cast(flags)); +} + +QPrintPreviewDialog* QPrintPreviewDialog_new5(QPrinter* printer, QWidget* parent) { + return new QPrintPreviewDialog(printer, parent); +} + +QPrintPreviewDialog* QPrintPreviewDialog_new6(QPrinter* printer, QWidget* parent, int flags) { + return new QPrintPreviewDialog(printer, parent, static_cast(flags)); +} + +QMetaObject* QPrintPreviewDialog_MetaObject(const QPrintPreviewDialog* self) { + return (QMetaObject*) self->metaObject(); +} + +void* QPrintPreviewDialog_Metacast(QPrintPreviewDialog* self, const char* param1) { + return self->qt_metacast(param1); +} + +struct miqt_string* QPrintPreviewDialog_Tr(const char* s) { + QString _ret = QPrintPreviewDialog::tr(s); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrintPreviewDialog_TrUtf8(const char* s) { + QString _ret = QPrintPreviewDialog::trUtf8(s); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +QPrinter* QPrintPreviewDialog_Printer(QPrintPreviewDialog* self) { + return self->printer(); +} + +void QPrintPreviewDialog_SetVisible(QPrintPreviewDialog* self, bool visible) { + self->setVisible(visible); +} + +void QPrintPreviewDialog_Done(QPrintPreviewDialog* self, int result) { + self->done(static_cast(result)); +} + +void QPrintPreviewDialog_PaintRequested(QPrintPreviewDialog* self, QPrinter* printer) { + self->paintRequested(printer); +} + +void QPrintPreviewDialog_connect_PaintRequested(QPrintPreviewDialog* self, intptr_t slot) { + QPrintPreviewDialog::connect(self, static_cast(&QPrintPreviewDialog::paintRequested), self, [=](QPrinter* printer) { + QPrinter* sigval1 = printer; + miqt_exec_callback_QPrintPreviewDialog_PaintRequested(slot, sigval1); + }); +} + +struct miqt_string* QPrintPreviewDialog_Tr2(const char* s, const char* c) { + QString _ret = QPrintPreviewDialog::tr(s, c); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrintPreviewDialog_Tr3(const char* s, const char* c, int n) { + QString _ret = QPrintPreviewDialog::tr(s, c, static_cast(n)); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrintPreviewDialog_TrUtf82(const char* s, const char* c) { + QString _ret = QPrintPreviewDialog::trUtf8(s, c); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrintPreviewDialog_TrUtf83(const char* s, const char* c, int n) { + QString _ret = QPrintPreviewDialog::trUtf8(s, c, static_cast(n)); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +void QPrintPreviewDialog_Delete(QPrintPreviewDialog* self) { + delete self; +} + diff --git a/qt/qprintsupport/gen_qprintpreviewdialog.go b/qt/qprintsupport/gen_qprintpreviewdialog.go new file mode 100644 index 00000000..218797d4 --- /dev/null +++ b/qt/qprintsupport/gen_qprintpreviewdialog.go @@ -0,0 +1,200 @@ +package qprintsupport + +/* + +#include "gen_qprintpreviewdialog.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/qt" + "runtime" + "runtime/cgo" + "unsafe" +) + +type QPrintPreviewDialog struct { + h *C.QPrintPreviewDialog + *qt.QDialog +} + +func (this *QPrintPreviewDialog) cPointer() *C.QPrintPreviewDialog { + if this == nil { + return nil + } + return this.h +} + +func (this *QPrintPreviewDialog) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +func newQPrintPreviewDialog(h *C.QPrintPreviewDialog) *QPrintPreviewDialog { + if h == nil { + return nil + } + return &QPrintPreviewDialog{h: h, QDialog: qt.UnsafeNewQDialog(unsafe.Pointer(h))} +} + +func UnsafeNewQPrintPreviewDialog(h unsafe.Pointer) *QPrintPreviewDialog { + return newQPrintPreviewDialog((*C.QPrintPreviewDialog)(h)) +} + +// NewQPrintPreviewDialog constructs a new QPrintPreviewDialog object. +func NewQPrintPreviewDialog() *QPrintPreviewDialog { + ret := C.QPrintPreviewDialog_new() + return newQPrintPreviewDialog(ret) +} + +// NewQPrintPreviewDialog2 constructs a new QPrintPreviewDialog object. +func NewQPrintPreviewDialog2(printer *QPrinter) *QPrintPreviewDialog { + ret := C.QPrintPreviewDialog_new2(printer.cPointer()) + return newQPrintPreviewDialog(ret) +} + +// NewQPrintPreviewDialog3 constructs a new QPrintPreviewDialog object. +func NewQPrintPreviewDialog3(parent *qt.QWidget) *QPrintPreviewDialog { + ret := C.QPrintPreviewDialog_new3((*C.QWidget)(parent.UnsafePointer())) + return newQPrintPreviewDialog(ret) +} + +// NewQPrintPreviewDialog4 constructs a new QPrintPreviewDialog object. +func NewQPrintPreviewDialog4(parent *qt.QWidget, flags qt.WindowType) *QPrintPreviewDialog { + ret := C.QPrintPreviewDialog_new4((*C.QWidget)(parent.UnsafePointer()), (C.int)(flags)) + return newQPrintPreviewDialog(ret) +} + +// NewQPrintPreviewDialog5 constructs a new QPrintPreviewDialog object. +func NewQPrintPreviewDialog5(printer *QPrinter, parent *qt.QWidget) *QPrintPreviewDialog { + ret := C.QPrintPreviewDialog_new5(printer.cPointer(), (*C.QWidget)(parent.UnsafePointer())) + return newQPrintPreviewDialog(ret) +} + +// NewQPrintPreviewDialog6 constructs a new QPrintPreviewDialog object. +func NewQPrintPreviewDialog6(printer *QPrinter, parent *qt.QWidget, flags qt.WindowType) *QPrintPreviewDialog { + ret := C.QPrintPreviewDialog_new6(printer.cPointer(), (*C.QWidget)(parent.UnsafePointer()), (C.int)(flags)) + return newQPrintPreviewDialog(ret) +} + +func (this *QPrintPreviewDialog) MetaObject() *qt.QMetaObject { + return qt.UnsafeNewQMetaObject(unsafe.Pointer(C.QPrintPreviewDialog_MetaObject(this.h))) +} + +func (this *QPrintPreviewDialog) Metacast(param1 string) unsafe.Pointer { + param1_Cstring := C.CString(param1) + defer C.free(unsafe.Pointer(param1_Cstring)) + return C.QPrintPreviewDialog_Metacast(this.h, param1_Cstring) +} + +func QPrintPreviewDialog_Tr(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms *C.struct_miqt_string = C.QPrintPreviewDialog_Tr(s_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QPrintPreviewDialog_TrUtf8(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms *C.struct_miqt_string = C.QPrintPreviewDialog_TrUtf8(s_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrintPreviewDialog) Printer() *QPrinter { + return UnsafeNewQPrinter(unsafe.Pointer(C.QPrintPreviewDialog_Printer(this.h))) +} + +func (this *QPrintPreviewDialog) SetVisible(visible bool) { + C.QPrintPreviewDialog_SetVisible(this.h, (C.bool)(visible)) +} + +func (this *QPrintPreviewDialog) Done(result int) { + C.QPrintPreviewDialog_Done(this.h, (C.int)(result)) +} + +func (this *QPrintPreviewDialog) PaintRequested(printer *QPrinter) { + C.QPrintPreviewDialog_PaintRequested(this.h, printer.cPointer()) +} +func (this *QPrintPreviewDialog) OnPaintRequested(slot func(printer *QPrinter)) { + C.QPrintPreviewDialog_connect_PaintRequested(this.h, C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QPrintPreviewDialog_PaintRequested +func miqt_exec_callback_QPrintPreviewDialog_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 QPrintPreviewDialog_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.QPrintPreviewDialog_Tr2(s_Cstring, c_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QPrintPreviewDialog_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.QPrintPreviewDialog_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 QPrintPreviewDialog_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.QPrintPreviewDialog_TrUtf82(s_Cstring, c_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QPrintPreviewDialog_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.QPrintPreviewDialog_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 +} + +// Delete this object from C++ memory. +func (this *QPrintPreviewDialog) Delete() { + C.QPrintPreviewDialog_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 *QPrintPreviewDialog) GoGC() { + runtime.SetFinalizer(this, func(this *QPrintPreviewDialog) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/qprintsupport/gen_qprintpreviewdialog.h b/qt/qprintsupport/gen_qprintpreviewdialog.h new file mode 100644 index 00000000..14fc4a03 --- /dev/null +++ b/qt/qprintsupport/gen_qprintpreviewdialog.h @@ -0,0 +1,53 @@ +#ifndef GEN_QPRINTPREVIEWDIALOG_H +#define GEN_QPRINTPREVIEWDIALOG_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QMetaObject; +class QPrintPreviewDialog; +class QPrinter; +class QWidget; +#else +typedef struct QMetaObject QMetaObject; +typedef struct QPrintPreviewDialog QPrintPreviewDialog; +typedef struct QPrinter QPrinter; +typedef struct QWidget QWidget; +#endif + +QPrintPreviewDialog* QPrintPreviewDialog_new(); +QPrintPreviewDialog* QPrintPreviewDialog_new2(QPrinter* printer); +QPrintPreviewDialog* QPrintPreviewDialog_new3(QWidget* parent); +QPrintPreviewDialog* QPrintPreviewDialog_new4(QWidget* parent, int flags); +QPrintPreviewDialog* QPrintPreviewDialog_new5(QPrinter* printer, QWidget* parent); +QPrintPreviewDialog* QPrintPreviewDialog_new6(QPrinter* printer, QWidget* parent, int flags); +QMetaObject* QPrintPreviewDialog_MetaObject(const QPrintPreviewDialog* self); +void* QPrintPreviewDialog_Metacast(QPrintPreviewDialog* self, const char* param1); +struct miqt_string* QPrintPreviewDialog_Tr(const char* s); +struct miqt_string* QPrintPreviewDialog_TrUtf8(const char* s); +QPrinter* QPrintPreviewDialog_Printer(QPrintPreviewDialog* self); +void QPrintPreviewDialog_SetVisible(QPrintPreviewDialog* self, bool visible); +void QPrintPreviewDialog_Done(QPrintPreviewDialog* self, int result); +void QPrintPreviewDialog_PaintRequested(QPrintPreviewDialog* self, QPrinter* printer); +void QPrintPreviewDialog_connect_PaintRequested(QPrintPreviewDialog* self, intptr_t slot); +struct miqt_string* QPrintPreviewDialog_Tr2(const char* s, const char* c); +struct miqt_string* QPrintPreviewDialog_Tr3(const char* s, const char* c, int n); +struct miqt_string* QPrintPreviewDialog_TrUtf82(const char* s, const char* c); +struct miqt_string* QPrintPreviewDialog_TrUtf83(const char* s, const char* c, int n); +void QPrintPreviewDialog_Delete(QPrintPreviewDialog* self); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/qprintsupport/gen_qprintpreviewwidget.cpp b/qt/qprintsupport/gen_qprintpreviewwidget.cpp new file mode 100644 index 00000000..22cd37df --- /dev/null +++ b/qt/qprintsupport/gen_qprintpreviewwidget.cpp @@ -0,0 +1,214 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qprintpreviewwidget.h" +#include "_cgo_export.h" + +QPrintPreviewWidget* QPrintPreviewWidget_new(QPrinter* printer) { + return new QPrintPreviewWidget(printer); +} + +QPrintPreviewWidget* QPrintPreviewWidget_new2() { + return new QPrintPreviewWidget(); +} + +QPrintPreviewWidget* QPrintPreviewWidget_new3(QPrinter* printer, QWidget* parent) { + return new QPrintPreviewWidget(printer, parent); +} + +QPrintPreviewWidget* QPrintPreviewWidget_new4(QPrinter* printer, QWidget* parent, int flags) { + return new QPrintPreviewWidget(printer, parent, static_cast(flags)); +} + +QPrintPreviewWidget* QPrintPreviewWidget_new5(QWidget* parent) { + return new QPrintPreviewWidget(parent); +} + +QPrintPreviewWidget* QPrintPreviewWidget_new6(QWidget* parent, int flags) { + return new QPrintPreviewWidget(parent, static_cast(flags)); +} + +QMetaObject* QPrintPreviewWidget_MetaObject(const QPrintPreviewWidget* self) { + return (QMetaObject*) self->metaObject(); +} + +void* QPrintPreviewWidget_Metacast(QPrintPreviewWidget* self, const char* param1) { + return self->qt_metacast(param1); +} + +struct miqt_string* QPrintPreviewWidget_Tr(const char* s) { + QString _ret = QPrintPreviewWidget::tr(s); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrintPreviewWidget_TrUtf8(const char* s) { + QString _ret = QPrintPreviewWidget::trUtf8(s); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +double QPrintPreviewWidget_ZoomFactor(const QPrintPreviewWidget* self) { + qreal _ret = self->zoomFactor(); + return static_cast(_ret); +} + +int QPrintPreviewWidget_Orientation(const QPrintPreviewWidget* self) { + QPrinter::Orientation _ret = self->orientation(); + return static_cast(_ret); +} + +int QPrintPreviewWidget_ViewMode(const QPrintPreviewWidget* self) { + QPrintPreviewWidget::ViewMode _ret = self->viewMode(); + return static_cast(_ret); +} + +int QPrintPreviewWidget_ZoomMode(const QPrintPreviewWidget* self) { + QPrintPreviewWidget::ZoomMode _ret = self->zoomMode(); + return static_cast(_ret); +} + +int QPrintPreviewWidget_CurrentPage(const QPrintPreviewWidget* self) { + return self->currentPage(); +} + +int QPrintPreviewWidget_PageCount(const QPrintPreviewWidget* self) { + return self->pageCount(); +} + +void QPrintPreviewWidget_SetVisible(QPrintPreviewWidget* self, bool visible) { + self->setVisible(visible); +} + +void QPrintPreviewWidget_Print(QPrintPreviewWidget* self) { + self->print(); +} + +void QPrintPreviewWidget_ZoomIn(QPrintPreviewWidget* self) { + self->zoomIn(); +} + +void QPrintPreviewWidget_ZoomOut(QPrintPreviewWidget* self) { + self->zoomOut(); +} + +void QPrintPreviewWidget_SetZoomFactor(QPrintPreviewWidget* self, double zoomFactor) { + self->setZoomFactor(static_cast(zoomFactor)); +} + +void QPrintPreviewWidget_SetOrientation(QPrintPreviewWidget* self, int orientation) { + self->setOrientation(static_cast(orientation)); +} + +void QPrintPreviewWidget_SetViewMode(QPrintPreviewWidget* self, int viewMode) { + self->setViewMode(static_cast(viewMode)); +} + +void QPrintPreviewWidget_SetZoomMode(QPrintPreviewWidget* self, int zoomMode) { + self->setZoomMode(static_cast(zoomMode)); +} + +void QPrintPreviewWidget_SetCurrentPage(QPrintPreviewWidget* self, int pageNumber) { + self->setCurrentPage(static_cast(pageNumber)); +} + +void QPrintPreviewWidget_FitToWidth(QPrintPreviewWidget* self) { + self->fitToWidth(); +} + +void QPrintPreviewWidget_FitInView(QPrintPreviewWidget* self) { + self->fitInView(); +} + +void QPrintPreviewWidget_SetLandscapeOrientation(QPrintPreviewWidget* self) { + self->setLandscapeOrientation(); +} + +void QPrintPreviewWidget_SetPortraitOrientation(QPrintPreviewWidget* self) { + self->setPortraitOrientation(); +} + +void QPrintPreviewWidget_SetSinglePageViewMode(QPrintPreviewWidget* self) { + self->setSinglePageViewMode(); +} + +void QPrintPreviewWidget_SetFacingPagesViewMode(QPrintPreviewWidget* self) { + self->setFacingPagesViewMode(); +} + +void QPrintPreviewWidget_SetAllPagesViewMode(QPrintPreviewWidget* self) { + self->setAllPagesViewMode(); +} + +void QPrintPreviewWidget_UpdatePreview(QPrintPreviewWidget* self) { + self->updatePreview(); +} + +void QPrintPreviewWidget_PaintRequested(QPrintPreviewWidget* self, QPrinter* printer) { + self->paintRequested(printer); +} + +void QPrintPreviewWidget_connect_PaintRequested(QPrintPreviewWidget* self, intptr_t slot) { + QPrintPreviewWidget::connect(self, static_cast(&QPrintPreviewWidget::paintRequested), self, [=](QPrinter* printer) { + QPrinter* sigval1 = printer; + miqt_exec_callback_QPrintPreviewWidget_PaintRequested(slot, sigval1); + }); +} + +void QPrintPreviewWidget_PreviewChanged(QPrintPreviewWidget* self) { + self->previewChanged(); +} + +void QPrintPreviewWidget_connect_PreviewChanged(QPrintPreviewWidget* self, intptr_t slot) { + QPrintPreviewWidget::connect(self, static_cast(&QPrintPreviewWidget::previewChanged), self, [=]() { + miqt_exec_callback_QPrintPreviewWidget_PreviewChanged(slot); + }); +} + +struct miqt_string* QPrintPreviewWidget_Tr2(const char* s, const char* c) { + QString _ret = QPrintPreviewWidget::tr(s, c); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrintPreviewWidget_Tr3(const char* s, const char* c, int n) { + QString _ret = QPrintPreviewWidget::tr(s, c, static_cast(n)); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrintPreviewWidget_TrUtf82(const char* s, const char* c) { + QString _ret = QPrintPreviewWidget::trUtf8(s, c); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +struct miqt_string* QPrintPreviewWidget_TrUtf83(const char* s, const char* c, int n) { + QString _ret = QPrintPreviewWidget::trUtf8(s, c, static_cast(n)); + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray _b = _ret.toUtf8(); + return miqt_strdup(_b.data(), _b.length()); +} + +void QPrintPreviewWidget_ZoomIn1(QPrintPreviewWidget* self, double zoom) { + self->zoomIn(static_cast(zoom)); +} + +void QPrintPreviewWidget_ZoomOut1(QPrintPreviewWidget* self, double zoom) { + self->zoomOut(static_cast(zoom)); +} + +void QPrintPreviewWidget_Delete(QPrintPreviewWidget* self) { + delete self; +} + diff --git a/qt/qprintsupport/gen_qprintpreviewwidget.go b/qt/qprintsupport/gen_qprintpreviewwidget.go new file mode 100644 index 00000000..7f02f444 --- /dev/null +++ b/qt/qprintsupport/gen_qprintpreviewwidget.go @@ -0,0 +1,321 @@ +package qprintsupport + +/* + +#include "gen_qprintpreviewwidget.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/qt" + "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 + *qt.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: qt.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 *qt.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 *qt.QWidget, flags qt.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 *qt.QWidget) *QPrintPreviewWidget { + ret := C.QPrintPreviewWidget_new5((*C.QWidget)(parent.UnsafePointer())) + return newQPrintPreviewWidget(ret) +} + +// NewQPrintPreviewWidget6 constructs a new QPrintPreviewWidget object. +func NewQPrintPreviewWidget6(parent *qt.QWidget, flags qt.WindowType) *QPrintPreviewWidget { + ret := C.QPrintPreviewWidget_new6((*C.QWidget)(parent.UnsafePointer()), (C.int)(flags)) + return newQPrintPreviewWidget(ret) +} + +func (this *QPrintPreviewWidget) MetaObject() *qt.QMetaObject { + return qt.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 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)) + return _ret +} + +func QPrintPreviewWidget_TrUtf8(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms *C.struct_miqt_string = C.QPrintPreviewWidget_TrUtf8(s_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func (this *QPrintPreviewWidget) ZoomFactor() float64 { + return (float64)(C.QPrintPreviewWidget_ZoomFactor(this.h)) +} + +func (this *QPrintPreviewWidget) Orientation() QPrinter__Orientation { + return (QPrinter__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 QPrinter__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)) + 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)) + return _ret +} + +func QPrintPreviewWidget_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.QPrintPreviewWidget_TrUtf82(s_Cstring, c_Cstring) + _ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms)) + return _ret +} + +func QPrintPreviewWidget_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.QPrintPreviewWidget_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 *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) + }) +} diff --git a/qt/qprintsupport/gen_qprintpreviewwidget.h b/qt/qprintsupport/gen_qprintpreviewwidget.h new file mode 100644 index 00000000..d69a32a1 --- /dev/null +++ b/qt/qprintsupport/gen_qprintpreviewwidget.h @@ -0,0 +1,77 @@ +#ifndef GEN_QPRINTPREVIEWWIDGET_H +#define GEN_QPRINTPREVIEWWIDGET_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QMetaObject; +class QPrintPreviewWidget; +class QPrinter; +class QWidget; +#else +typedef struct QMetaObject QMetaObject; +typedef struct QPrintPreviewWidget QPrintPreviewWidget; +typedef struct QPrinter QPrinter; +typedef struct QWidget QWidget; +#endif + +QPrintPreviewWidget* QPrintPreviewWidget_new(QPrinter* printer); +QPrintPreviewWidget* QPrintPreviewWidget_new2(); +QPrintPreviewWidget* QPrintPreviewWidget_new3(QPrinter* printer, QWidget* parent); +QPrintPreviewWidget* QPrintPreviewWidget_new4(QPrinter* printer, QWidget* parent, int flags); +QPrintPreviewWidget* QPrintPreviewWidget_new5(QWidget* parent); +QPrintPreviewWidget* QPrintPreviewWidget_new6(QWidget* parent, int flags); +QMetaObject* QPrintPreviewWidget_MetaObject(const QPrintPreviewWidget* self); +void* QPrintPreviewWidget_Metacast(QPrintPreviewWidget* self, const char* param1); +struct miqt_string* QPrintPreviewWidget_Tr(const char* s); +struct miqt_string* QPrintPreviewWidget_TrUtf8(const char* s); +double QPrintPreviewWidget_ZoomFactor(const QPrintPreviewWidget* self); +int QPrintPreviewWidget_Orientation(const QPrintPreviewWidget* self); +int QPrintPreviewWidget_ViewMode(const QPrintPreviewWidget* self); +int QPrintPreviewWidget_ZoomMode(const QPrintPreviewWidget* self); +int QPrintPreviewWidget_CurrentPage(const QPrintPreviewWidget* self); +int QPrintPreviewWidget_PageCount(const QPrintPreviewWidget* self); +void QPrintPreviewWidget_SetVisible(QPrintPreviewWidget* self, bool visible); +void QPrintPreviewWidget_Print(QPrintPreviewWidget* self); +void QPrintPreviewWidget_ZoomIn(QPrintPreviewWidget* self); +void QPrintPreviewWidget_ZoomOut(QPrintPreviewWidget* self); +void QPrintPreviewWidget_SetZoomFactor(QPrintPreviewWidget* self, double zoomFactor); +void QPrintPreviewWidget_SetOrientation(QPrintPreviewWidget* self, int orientation); +void QPrintPreviewWidget_SetViewMode(QPrintPreviewWidget* self, int viewMode); +void QPrintPreviewWidget_SetZoomMode(QPrintPreviewWidget* self, int zoomMode); +void QPrintPreviewWidget_SetCurrentPage(QPrintPreviewWidget* self, int pageNumber); +void QPrintPreviewWidget_FitToWidth(QPrintPreviewWidget* self); +void QPrintPreviewWidget_FitInView(QPrintPreviewWidget* self); +void QPrintPreviewWidget_SetLandscapeOrientation(QPrintPreviewWidget* self); +void QPrintPreviewWidget_SetPortraitOrientation(QPrintPreviewWidget* self); +void QPrintPreviewWidget_SetSinglePageViewMode(QPrintPreviewWidget* self); +void QPrintPreviewWidget_SetFacingPagesViewMode(QPrintPreviewWidget* self); +void QPrintPreviewWidget_SetAllPagesViewMode(QPrintPreviewWidget* self); +void QPrintPreviewWidget_UpdatePreview(QPrintPreviewWidget* self); +void QPrintPreviewWidget_PaintRequested(QPrintPreviewWidget* self, QPrinter* printer); +void QPrintPreviewWidget_connect_PaintRequested(QPrintPreviewWidget* self, intptr_t slot); +void QPrintPreviewWidget_PreviewChanged(QPrintPreviewWidget* self); +void QPrintPreviewWidget_connect_PreviewChanged(QPrintPreviewWidget* self, intptr_t slot); +struct miqt_string* QPrintPreviewWidget_Tr2(const char* s, const char* c); +struct miqt_string* QPrintPreviewWidget_Tr3(const char* s, const char* c, int n); +struct miqt_string* QPrintPreviewWidget_TrUtf82(const char* s, const char* c); +struct miqt_string* QPrintPreviewWidget_TrUtf83(const char* s, const char* c, int n); +void QPrintPreviewWidget_ZoomIn1(QPrintPreviewWidget* self, double zoom); +void QPrintPreviewWidget_ZoomOut1(QPrintPreviewWidget* self, double zoom); +void QPrintPreviewWidget_Delete(QPrintPreviewWidget* self); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif