#include #include #define WORKAROUND_INNER_CLASS_DEFINITION_QPagedPaintDevice__Margins #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "gen_qprinter.h" #ifdef __cplusplus extern "C" { #endif int miqt_exec_callback_QPrinter_DevType(void*, intptr_t); void miqt_exec_callback_QPrinter_SetPageSize(void*, intptr_t, int); void miqt_exec_callback_QPrinter_SetPageSizeMM(void*, intptr_t, QSizeF*); bool miqt_exec_callback_QPrinter_NewPage(void*, intptr_t); QPaintEngine* miqt_exec_callback_QPrinter_PaintEngine(void*, intptr_t); void miqt_exec_callback_QPrinter_SetMargins(void*, intptr_t, QPagedPaintDevice__Margins*); int miqt_exec_callback_QPrinter_Metric(void*, intptr_t, int); void miqt_exec_callback_QPrinter_InitPainter(void*, intptr_t, QPainter*); QPaintDevice* miqt_exec_callback_QPrinter_Redirected(void*, intptr_t, QPoint*); QPainter* miqt_exec_callback_QPrinter_SharedPainter(void*, intptr_t); #ifdef __cplusplus } /* extern C */ #endif class MiqtVirtualQPrinter final : public QPrinter { public: MiqtVirtualQPrinter(): QPrinter() {}; MiqtVirtualQPrinter(const QPrinterInfo& printer): QPrinter(printer) {}; MiqtVirtualQPrinter(QPrinter::PrinterMode mode): QPrinter(mode) {}; MiqtVirtualQPrinter(const QPrinterInfo& printer, QPrinter::PrinterMode mode): QPrinter(printer, mode) {}; virtual ~MiqtVirtualQPrinter() override = default; // cgo.Handle value for overwritten implementation intptr_t handle__DevType = 0; // Subclass to allow providing a Go implementation virtual int devType() const override { if (handle__DevType == 0) { return QPrinter::devType(); } int callback_return_value = miqt_exec_callback_QPrinter_DevType(const_cast(this), handle__DevType); return static_cast(callback_return_value); } // Wrapper to allow calling protected method int virtualbase_DevType() const { return QPrinter::devType(); } // cgo.Handle value for overwritten implementation intptr_t handle__SetPageSize = 0; // Subclass to allow providing a Go implementation virtual void setPageSize(QPagedPaintDevice::PageSize pageSize) override { if (handle__SetPageSize == 0) { QPrinter::setPageSize(pageSize); return; } QPagedPaintDevice::PageSize pageSize_ret = pageSize; int sigval1 = static_cast(pageSize_ret); miqt_exec_callback_QPrinter_SetPageSize(this, handle__SetPageSize, sigval1); } // Wrapper to allow calling protected method void virtualbase_SetPageSize(int pageSize) { QPrinter::setPageSize(static_cast(pageSize)); } // cgo.Handle value for overwritten implementation intptr_t handle__SetPageSizeMM = 0; // Subclass to allow providing a Go implementation virtual void setPageSizeMM(const QSizeF& size) override { if (handle__SetPageSizeMM == 0) { QPrinter::setPageSizeMM(size); return; } const QSizeF& size_ret = size; // Cast returned reference into pointer QSizeF* sigval1 = const_cast(&size_ret); miqt_exec_callback_QPrinter_SetPageSizeMM(this, handle__SetPageSizeMM, sigval1); } // Wrapper to allow calling protected method void virtualbase_SetPageSizeMM(QSizeF* size) { QPrinter::setPageSizeMM(*size); } // cgo.Handle value for overwritten implementation intptr_t handle__NewPage = 0; // Subclass to allow providing a Go implementation virtual bool newPage() override { if (handle__NewPage == 0) { return QPrinter::newPage(); } bool callback_return_value = miqt_exec_callback_QPrinter_NewPage(this, handle__NewPage); return callback_return_value; } // Wrapper to allow calling protected method bool virtualbase_NewPage() { return QPrinter::newPage(); } // cgo.Handle value for overwritten implementation intptr_t handle__PaintEngine = 0; // Subclass to allow providing a Go implementation virtual QPaintEngine* paintEngine() const override { if (handle__PaintEngine == 0) { return QPrinter::paintEngine(); } QPaintEngine* callback_return_value = miqt_exec_callback_QPrinter_PaintEngine(const_cast(this), handle__PaintEngine); return callback_return_value; } // Wrapper to allow calling protected method QPaintEngine* virtualbase_PaintEngine() const { return QPrinter::paintEngine(); } // cgo.Handle value for overwritten implementation intptr_t handle__SetMargins = 0; // Subclass to allow providing a Go implementation virtual void setMargins(const QPagedPaintDevice::Margins& m) override { if (handle__SetMargins == 0) { QPrinter::setMargins(m); return; } const QPagedPaintDevice::Margins& m_ret = m; // Cast returned reference into pointer QPagedPaintDevice__Margins* sigval1 = const_cast(&m_ret); miqt_exec_callback_QPrinter_SetMargins(this, handle__SetMargins, sigval1); } // Wrapper to allow calling protected method void virtualbase_SetMargins(QPagedPaintDevice__Margins* m) { QPrinter::setMargins(*m); } // cgo.Handle value for overwritten implementation intptr_t handle__Metric = 0; // Subclass to allow providing a Go implementation virtual int metric(QPaintDevice::PaintDeviceMetric param1) const override { if (handle__Metric == 0) { return QPrinter::metric(param1); } QPaintDevice::PaintDeviceMetric param1_ret = param1; int sigval1 = static_cast(param1_ret); int callback_return_value = miqt_exec_callback_QPrinter_Metric(const_cast(this), handle__Metric, sigval1); return static_cast(callback_return_value); } // Wrapper to allow calling protected method int virtualbase_Metric(int param1) const { return QPrinter::metric(static_cast(param1)); } // cgo.Handle value for overwritten implementation intptr_t handle__InitPainter = 0; // Subclass to allow providing a Go implementation virtual void initPainter(QPainter* painter) const override { if (handle__InitPainter == 0) { QPrinter::initPainter(painter); return; } QPainter* sigval1 = painter; miqt_exec_callback_QPrinter_InitPainter(const_cast(this), handle__InitPainter, sigval1); } // Wrapper to allow calling protected method void virtualbase_InitPainter(QPainter* painter) const { QPrinter::initPainter(painter); } // cgo.Handle value for overwritten implementation intptr_t handle__Redirected = 0; // Subclass to allow providing a Go implementation virtual QPaintDevice* redirected(QPoint* offset) const override { if (handle__Redirected == 0) { return QPrinter::redirected(offset); } QPoint* sigval1 = offset; QPaintDevice* callback_return_value = miqt_exec_callback_QPrinter_Redirected(const_cast(this), handle__Redirected, sigval1); return callback_return_value; } // Wrapper to allow calling protected method QPaintDevice* virtualbase_Redirected(QPoint* offset) const { return QPrinter::redirected(offset); } // cgo.Handle value for overwritten implementation intptr_t handle__SharedPainter = 0; // Subclass to allow providing a Go implementation virtual QPainter* sharedPainter() const override { if (handle__SharedPainter == 0) { return QPrinter::sharedPainter(); } QPainter* callback_return_value = miqt_exec_callback_QPrinter_SharedPainter(const_cast(this), handle__SharedPainter); return callback_return_value; } // Wrapper to allow calling protected method QPainter* virtualbase_SharedPainter() const { return QPrinter::sharedPainter(); } }; QPrinter* QPrinter_new() { return new MiqtVirtualQPrinter(); } QPrinter* QPrinter_new2(QPrinterInfo* printer) { return new MiqtVirtualQPrinter(*printer); } QPrinter* QPrinter_new3(int mode) { return new MiqtVirtualQPrinter(static_cast(mode)); } QPrinter* QPrinter_new4(QPrinterInfo* printer, int mode) { return new MiqtVirtualQPrinter(*printer, static_cast(mode)); } void QPrinter_virtbase(QPrinter* src, QPagedPaintDevice** outptr_QPagedPaintDevice) { *outptr_QPagedPaintDevice = static_cast(src); } 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(); struct miqt_string _ms; _ms.len = _b.length(); _ms.data = static_cast(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } 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(); struct miqt_string _ms; _ms.len = _b.length(); _ms.data = static_cast(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } 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(); struct miqt_string _ms; _ms.len = _b.length(); _ms.data = static_cast(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } 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(); struct miqt_string _ms; _ms.len = _b.length(); _ms.data = static_cast(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } 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(); struct miqt_string _ms; _ms.len = _b.length(); _ms.data = static_cast(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } 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(); struct miqt_string _ms; _ms.len = _b.length(); _ms.data = static_cast(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } 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 /* of int */ 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; _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(); struct miqt_string _ms; _ms.len = _b.length(); _ms.data = static_cast(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } 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)); } bool QPrinter_override_virtual_DevType(void* self, intptr_t slot) { MiqtVirtualQPrinter* self_cast = dynamic_cast( (QPrinter*)(self) ); if (self_cast == nullptr) { return false; } self_cast->handle__DevType = slot; return true; } int QPrinter_virtualbase_DevType(const void* self) { return ( (const MiqtVirtualQPrinter*)(self) )->virtualbase_DevType(); } bool QPrinter_override_virtual_SetPageSize(void* self, intptr_t slot) { MiqtVirtualQPrinter* self_cast = dynamic_cast( (QPrinter*)(self) ); if (self_cast == nullptr) { return false; } self_cast->handle__SetPageSize = slot; return true; } void QPrinter_virtualbase_SetPageSize(void* self, int pageSize) { ( (MiqtVirtualQPrinter*)(self) )->virtualbase_SetPageSize(pageSize); } bool QPrinter_override_virtual_SetPageSizeMM(void* self, intptr_t slot) { MiqtVirtualQPrinter* self_cast = dynamic_cast( (QPrinter*)(self) ); if (self_cast == nullptr) { return false; } self_cast->handle__SetPageSizeMM = slot; return true; } void QPrinter_virtualbase_SetPageSizeMM(void* self, QSizeF* size) { ( (MiqtVirtualQPrinter*)(self) )->virtualbase_SetPageSizeMM(size); } bool QPrinter_override_virtual_NewPage(void* self, intptr_t slot) { MiqtVirtualQPrinter* self_cast = dynamic_cast( (QPrinter*)(self) ); if (self_cast == nullptr) { return false; } self_cast->handle__NewPage = slot; return true; } bool QPrinter_virtualbase_NewPage(void* self) { return ( (MiqtVirtualQPrinter*)(self) )->virtualbase_NewPage(); } bool QPrinter_override_virtual_PaintEngine(void* self, intptr_t slot) { MiqtVirtualQPrinter* self_cast = dynamic_cast( (QPrinter*)(self) ); if (self_cast == nullptr) { return false; } self_cast->handle__PaintEngine = slot; return true; } QPaintEngine* QPrinter_virtualbase_PaintEngine(const void* self) { return ( (const MiqtVirtualQPrinter*)(self) )->virtualbase_PaintEngine(); } bool QPrinter_override_virtual_SetMargins(void* self, intptr_t slot) { MiqtVirtualQPrinter* self_cast = dynamic_cast( (QPrinter*)(self) ); if (self_cast == nullptr) { return false; } self_cast->handle__SetMargins = slot; return true; } void QPrinter_virtualbase_SetMargins(void* self, QPagedPaintDevice__Margins* m) { ( (MiqtVirtualQPrinter*)(self) )->virtualbase_SetMargins(m); } bool QPrinter_override_virtual_Metric(void* self, intptr_t slot) { MiqtVirtualQPrinter* self_cast = dynamic_cast( (QPrinter*)(self) ); if (self_cast == nullptr) { return false; } self_cast->handle__Metric = slot; return true; } int QPrinter_virtualbase_Metric(const void* self, int param1) { return ( (const MiqtVirtualQPrinter*)(self) )->virtualbase_Metric(param1); } bool QPrinter_override_virtual_InitPainter(void* self, intptr_t slot) { MiqtVirtualQPrinter* self_cast = dynamic_cast( (QPrinter*)(self) ); if (self_cast == nullptr) { return false; } self_cast->handle__InitPainter = slot; return true; } void QPrinter_virtualbase_InitPainter(const void* self, QPainter* painter) { ( (const MiqtVirtualQPrinter*)(self) )->virtualbase_InitPainter(painter); } bool QPrinter_override_virtual_Redirected(void* self, intptr_t slot) { MiqtVirtualQPrinter* self_cast = dynamic_cast( (QPrinter*)(self) ); if (self_cast == nullptr) { return false; } self_cast->handle__Redirected = slot; return true; } QPaintDevice* QPrinter_virtualbase_Redirected(const void* self, QPoint* offset) { return ( (const MiqtVirtualQPrinter*)(self) )->virtualbase_Redirected(offset); } bool QPrinter_override_virtual_SharedPainter(void* self, intptr_t slot) { MiqtVirtualQPrinter* self_cast = dynamic_cast( (QPrinter*)(self) ); if (self_cast == nullptr) { return false; } self_cast->handle__SharedPainter = slot; return true; } QPainter* QPrinter_virtualbase_SharedPainter(const void* self) { return ( (const MiqtVirtualQPrinter*)(self) )->virtualbase_SharedPainter(); } void QPrinter_Delete(QPrinter* self) { delete self; }