2024-08-25 04:08:24 +00:00
|
|
|
#include <QFont>
|
|
|
|
#include <QGlyphRun>
|
|
|
|
#include <QList>
|
|
|
|
#include <QPaintDevice>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QPointF>
|
|
|
|
#include <QRawFont>
|
|
|
|
#include <QRectF>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QTextBlock>
|
|
|
|
#include <QTextFormat>
|
|
|
|
#include <QTextInlineObject>
|
|
|
|
#include <QTextLayout>
|
2024-08-29 07:01:51 +00:00
|
|
|
#define WORKAROUND_INNER_CLASS_DEFINITION_QTextLayout__FormatRange
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QTextLine>
|
|
|
|
#include <QTextOption>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "qtextlayout.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qtextlayout.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextInlineObject* QTextInlineObject_new() {
|
|
|
|
return new QTextInlineObject();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextInlineObject_IsValid(const QTextInlineObject* self) {
|
|
|
|
return self->isValid();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QRectF* QTextInlineObject_Rect(const QTextInlineObject* self) {
|
|
|
|
QRectF ret = self->rect();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QRectF*>(new QRectF(ret));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextInlineObject_Width(const QTextInlineObject* self) {
|
|
|
|
return self->width();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextInlineObject_Ascent(const QTextInlineObject* self) {
|
|
|
|
return self->ascent();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextInlineObject_Descent(const QTextInlineObject* self) {
|
|
|
|
return self->descent();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextInlineObject_Height(const QTextInlineObject* self) {
|
|
|
|
return self->height();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uintptr_t QTextInlineObject_TextDirection(const QTextInlineObject* self) {
|
|
|
|
Qt::LayoutDirection ret = self->textDirection();
|
2024-08-29 07:01:51 +00:00
|
|
|
return static_cast<uintptr_t>(ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextInlineObject_SetWidth(QTextInlineObject* self, double w) {
|
|
|
|
self->setWidth(static_cast<qreal>(w));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextInlineObject_SetAscent(QTextInlineObject* self, double a) {
|
|
|
|
self->setAscent(static_cast<qreal>(a));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextInlineObject_SetDescent(QTextInlineObject* self, double d) {
|
|
|
|
self->setDescent(static_cast<qreal>(d));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextInlineObject_TextPosition(const QTextInlineObject* self) {
|
|
|
|
return self->textPosition();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextInlineObject_FormatIndex(const QTextInlineObject* self) {
|
|
|
|
return self->formatIndex();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextFormat* QTextInlineObject_Format(const QTextInlineObject* self) {
|
|
|
|
QTextFormat ret = self->format();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QTextFormat*>(new QTextFormat(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextInlineObject_Delete(QTextInlineObject* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextLayout* QTextLayout_new() {
|
|
|
|
return new QTextLayout();
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextLayout* QTextLayout_new2(const char* text, size_t text_Strlen) {
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
return new QTextLayout(text_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextLayout* QTextLayout_new3(const char* text, size_t text_Strlen, QFont* font) {
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
return new QTextLayout(text_QString, *font);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextLayout* QTextLayout_new4(QTextBlock* b) {
|
|
|
|
return new QTextLayout(*b);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextLayout* QTextLayout_new5(const char* text, size_t text_Strlen, QFont* font, QPaintDevice* paintdevice) {
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
return new QTextLayout(text_QString, *font, paintdevice);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_SetFont(QTextLayout* self, QFont* f) {
|
|
|
|
self->setFont(*f);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QFont* QTextLayout_Font(const QTextLayout* self) {
|
|
|
|
QFont ret = self->font();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QFont*>(new QFont(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_SetRawFont(QTextLayout* self, QRawFont* rawFont) {
|
|
|
|
self->setRawFont(*rawFont);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_SetText(QTextLayout* self, const char* stringVal, size_t stringVal_Strlen) {
|
|
|
|
QString stringVal_QString = QString::fromUtf8(stringVal, stringVal_Strlen);
|
|
|
|
self->setText(stringVal_QString);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLayout_Text(const QTextLayout* self, char** _out, int* _out_Strlen) {
|
|
|
|
QString ret = self->text();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_SetTextOption(QTextLayout* self, QTextOption* option) {
|
|
|
|
self->setTextOption(*option);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextOption* QTextLayout_TextOption(const QTextLayout* self) {
|
|
|
|
const QTextOption& ret = self->textOption();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Cast returned reference into pointer
|
|
|
|
return const_cast<QTextOption*>(&ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_SetPreeditArea(QTextLayout* self, int position, const char* text, size_t text_Strlen) {
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
self->setPreeditArea(static_cast<int>(position), text_QString);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLayout_PreeditAreaPosition(const QTextLayout* self) {
|
|
|
|
return self->preeditAreaPosition();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLayout_PreeditAreaText(const QTextLayout* self, char** _out, int* _out_Strlen) {
|
|
|
|
QString ret = self->preeditAreaText();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QTextLayout_SetAdditionalFormats(QTextLayout* self, QTextLayout__FormatRange** overrides, size_t overrides_len) {
|
|
|
|
QList<QTextLayout::FormatRange> overrides_QList;
|
|
|
|
overrides_QList.reserve(overrides_len);
|
|
|
|
for(size_t i = 0; i < overrides_len; ++i) {
|
|
|
|
overrides_QList.push_back(*(overrides[i]));
|
|
|
|
}
|
|
|
|
self->setAdditionalFormats(overrides_QList);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLayout_AdditionalFormats(const QTextLayout* self, QTextLayout__FormatRange*** _out, size_t* _out_len) {
|
|
|
|
QList<QTextLayout::FormatRange> ret = self->additionalFormats();
|
2024-08-29 07:01:51 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QTextLayout__FormatRange** __out = static_cast<QTextLayout__FormatRange**>(malloc(sizeof(QTextLayout__FormatRange**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QTextLayout::FormatRange(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QTextLayout_ClearAdditionalFormats(QTextLayout* self) {
|
|
|
|
self->clearAdditionalFormats();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QTextLayout_SetFormats(QTextLayout* self, QTextLayout__FormatRange** overrides, size_t overrides_len) {
|
|
|
|
QVector<QTextLayout::FormatRange> overrides_QList;
|
|
|
|
overrides_QList.reserve(overrides_len);
|
|
|
|
for(size_t i = 0; i < overrides_len; ++i) {
|
|
|
|
overrides_QList.push_back(*(overrides[i]));
|
|
|
|
}
|
|
|
|
self->setFormats(overrides_QList);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLayout_Formats(const QTextLayout* self, QTextLayout__FormatRange*** _out, size_t* _out_len) {
|
|
|
|
QVector<QTextLayout::FormatRange> ret = self->formats();
|
2024-08-29 07:01:51 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QTextLayout__FormatRange** __out = static_cast<QTextLayout__FormatRange**>(malloc(sizeof(QTextLayout__FormatRange**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QTextLayout::FormatRange(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QTextLayout_ClearFormats(QTextLayout* self) {
|
|
|
|
self->clearFormats();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_SetCacheEnabled(QTextLayout* self, bool enable) {
|
|
|
|
self->setCacheEnabled(enable);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextLayout_CacheEnabled(const QTextLayout* self) {
|
|
|
|
return self->cacheEnabled();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_SetCursorMoveStyle(QTextLayout* self, uintptr_t style) {
|
|
|
|
self->setCursorMoveStyle(static_cast<Qt::CursorMoveStyle>(style));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uintptr_t QTextLayout_CursorMoveStyle(const QTextLayout* self) {
|
|
|
|
Qt::CursorMoveStyle ret = self->cursorMoveStyle();
|
2024-08-29 07:01:51 +00:00
|
|
|
return static_cast<uintptr_t>(ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_BeginLayout(QTextLayout* self) {
|
|
|
|
self->beginLayout();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_EndLayout(QTextLayout* self) {
|
|
|
|
self->endLayout();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_ClearLayout(QTextLayout* self) {
|
|
|
|
self->clearLayout();
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextLine* QTextLayout_CreateLine(QTextLayout* self) {
|
|
|
|
QTextLine ret = self->createLine();
|
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QTextLine*>(new QTextLine(ret));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLayout_LineCount(const QTextLayout* self) {
|
|
|
|
return self->lineCount();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextLine* QTextLayout_LineAt(const QTextLayout* self, int i) {
|
|
|
|
QTextLine ret = self->lineAt(static_cast<int>(i));
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QTextLine*>(new QTextLine(ret));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextLine* QTextLayout_LineForTextPosition(const QTextLayout* self, int pos) {
|
|
|
|
QTextLine ret = self->lineForTextPosition(static_cast<int>(pos));
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QTextLine*>(new QTextLine(ret));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextLayout_IsValidCursorPosition(const QTextLayout* self, int pos) {
|
|
|
|
return self->isValidCursorPosition(static_cast<int>(pos));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLayout_NextCursorPosition(const QTextLayout* self, int oldPos) {
|
|
|
|
return self->nextCursorPosition(static_cast<int>(oldPos));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLayout_PreviousCursorPosition(const QTextLayout* self, int oldPos) {
|
|
|
|
return self->previousCursorPosition(static_cast<int>(oldPos));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLayout_LeftCursorPosition(const QTextLayout* self, int oldPos) {
|
|
|
|
return self->leftCursorPosition(static_cast<int>(oldPos));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLayout_RightCursorPosition(const QTextLayout* self, int oldPos) {
|
|
|
|
return self->rightCursorPosition(static_cast<int>(oldPos));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLayout_Draw(const QTextLayout* self, QPainter* p, QPointF* pos) {
|
|
|
|
self->draw(p, *pos);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLayout_DrawCursor(const QTextLayout* self, QPainter* p, QPointF* pos, int cursorPosition) {
|
|
|
|
self->drawCursor(p, *pos, static_cast<int>(cursorPosition));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLayout_DrawCursor2(const QTextLayout* self, QPainter* p, QPointF* pos, int cursorPosition, int width) {
|
|
|
|
self->drawCursor(p, *pos, static_cast<int>(cursorPosition), static_cast<int>(width));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QPointF* QTextLayout_Position(const QTextLayout* self) {
|
|
|
|
QPointF ret = self->position();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QPointF*>(new QPointF(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_SetPosition(QTextLayout* self, QPointF* p) {
|
|
|
|
self->setPosition(*p);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QRectF* QTextLayout_BoundingRect(const QTextLayout* self) {
|
|
|
|
QRectF ret = self->boundingRect();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QRectF*>(new QRectF(ret));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLayout_MinimumWidth(const QTextLayout* self) {
|
|
|
|
return self->minimumWidth();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLayout_MaximumWidth(const QTextLayout* self) {
|
|
|
|
return self->maximumWidth();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLayout_GlyphRuns(const QTextLayout* self, QGlyphRun*** _out, size_t* _out_len) {
|
|
|
|
QList<QGlyphRun> ret = self->glyphRuns();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QGlyphRun** __out = static_cast<QGlyphRun**>(malloc(sizeof(QGlyphRun**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QGlyphRun(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_SetFlags(QTextLayout* self, int flags) {
|
|
|
|
self->setFlags(static_cast<int>(flags));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLayout_NextCursorPosition2(const QTextLayout* self, int oldPos, uintptr_t mode) {
|
|
|
|
return self->nextCursorPosition(static_cast<int>(oldPos), static_cast<QTextLayout::CursorMode>(mode));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLayout_PreviousCursorPosition2(const QTextLayout* self, int oldPos, uintptr_t mode) {
|
|
|
|
return self->previousCursorPosition(static_cast<int>(oldPos), static_cast<QTextLayout::CursorMode>(mode));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLayout_Draw3(const QTextLayout* self, QPainter* p, QPointF* pos, QTextLayout__FormatRange** selections, size_t selections_len) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QVector<QTextLayout::FormatRange> selections_QList;
|
|
|
|
selections_QList.reserve(selections_len);
|
|
|
|
for(size_t i = 0; i < selections_len; ++i) {
|
|
|
|
selections_QList.push_back(*(selections[i]));
|
|
|
|
}
|
2024-09-11 05:41:09 +00:00
|
|
|
self->draw(p, *pos, selections_QList);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLayout_Draw4(const QTextLayout* self, QPainter* p, QPointF* pos, QTextLayout__FormatRange** selections, size_t selections_len, QRectF* clip) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QVector<QTextLayout::FormatRange> selections_QList;
|
|
|
|
selections_QList.reserve(selections_len);
|
|
|
|
for(size_t i = 0; i < selections_len; ++i) {
|
|
|
|
selections_QList.push_back(*(selections[i]));
|
|
|
|
}
|
2024-09-11 05:41:09 +00:00
|
|
|
self->draw(p, *pos, selections_QList, *clip);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLayout_GlyphRuns1(const QTextLayout* self, int from, QGlyphRun*** _out, size_t* _out_len) {
|
|
|
|
QList<QGlyphRun> ret = self->glyphRuns(static_cast<int>(from));
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QGlyphRun** __out = static_cast<QGlyphRun**>(malloc(sizeof(QGlyphRun**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QGlyphRun(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLayout_GlyphRuns2(const QTextLayout* self, int from, int length, QGlyphRun*** _out, size_t* _out_len) {
|
|
|
|
QList<QGlyphRun> ret = self->glyphRuns(static_cast<int>(from), static_cast<int>(length));
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QGlyphRun** __out = static_cast<QGlyphRun**>(malloc(sizeof(QGlyphRun**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QGlyphRun(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLayout_Delete(QTextLayout* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextLine* QTextLine_new() {
|
|
|
|
return new QTextLine();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextLine_IsValid(const QTextLine* self) {
|
|
|
|
return self->isValid();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QRectF* QTextLine_Rect(const QTextLine* self) {
|
|
|
|
QRectF ret = self->rect();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QRectF*>(new QRectF(ret));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_X(const QTextLine* self) {
|
|
|
|
return self->x();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_Y(const QTextLine* self) {
|
|
|
|
return self->y();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_Width(const QTextLine* self) {
|
|
|
|
return self->width();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_Ascent(const QTextLine* self) {
|
|
|
|
return self->ascent();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_Descent(const QTextLine* self) {
|
|
|
|
return self->descent();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_Height(const QTextLine* self) {
|
|
|
|
return self->height();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_Leading(const QTextLine* self) {
|
|
|
|
return self->leading();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLine_SetLeadingIncluded(QTextLine* self, bool included) {
|
|
|
|
self->setLeadingIncluded(included);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextLine_LeadingIncluded(const QTextLine* self) {
|
|
|
|
return self->leadingIncluded();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_NaturalTextWidth(const QTextLine* self) {
|
|
|
|
return self->naturalTextWidth();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_HorizontalAdvance(const QTextLine* self) {
|
|
|
|
return self->horizontalAdvance();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QRectF* QTextLine_NaturalTextRect(const QTextLine* self) {
|
|
|
|
QRectF ret = self->naturalTextRect();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QRectF*>(new QRectF(ret));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_CursorToX(const QTextLine* self, int* cursorPos) {
|
|
|
|
return self->cursorToX(static_cast<int*>(cursorPos));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_CursorToXWithCursorPos(const QTextLine* self, int cursorPos) {
|
|
|
|
return self->cursorToX(static_cast<int>(cursorPos));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLine_XToCursor(const QTextLine* self, double x) {
|
|
|
|
return self->xToCursor(static_cast<qreal>(x));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QTextLine_SetLineWidth(QTextLine* self, double width) {
|
|
|
|
self->setLineWidth(static_cast<qreal>(width));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLine_SetNumColumns(QTextLine* self, int columns) {
|
|
|
|
self->setNumColumns(static_cast<int>(columns));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLine_SetNumColumns2(QTextLine* self, int columns, double alignmentWidth) {
|
|
|
|
self->setNumColumns(static_cast<int>(columns), static_cast<qreal>(alignmentWidth));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLine_SetPosition(QTextLine* self, QPointF* pos) {
|
|
|
|
self->setPosition(*pos);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QPointF* QTextLine_Position(const QTextLine* self) {
|
|
|
|
QPointF ret = self->position();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QPointF*>(new QPointF(ret));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLine_TextStart(const QTextLine* self) {
|
|
|
|
return self->textStart();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLine_TextLength(const QTextLine* self) {
|
|
|
|
return self->textLength();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLine_LineNumber(const QTextLine* self) {
|
|
|
|
return self->lineNumber();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLine_Draw(const QTextLine* self, QPainter* p, QPointF* point) {
|
|
|
|
self->draw(p, *point);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLine_GlyphRuns(const QTextLine* self, QGlyphRun*** _out, size_t* _out_len) {
|
|
|
|
QList<QGlyphRun> ret = self->glyphRuns();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QGlyphRun** __out = static_cast<QGlyphRun**>(malloc(sizeof(QGlyphRun**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QGlyphRun(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_CursorToX2(const QTextLine* self, int* cursorPos, uintptr_t edge) {
|
|
|
|
return self->cursorToX(static_cast<int*>(cursorPos), static_cast<QTextLine::Edge>(edge));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QTextLine_CursorToX22(const QTextLine* self, int cursorPos, uintptr_t edge) {
|
|
|
|
return self->cursorToX(static_cast<int>(cursorPos), static_cast<QTextLine::Edge>(edge));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextLine_XToCursor2(const QTextLine* self, double x, uintptr_t param2) {
|
|
|
|
return self->xToCursor(static_cast<qreal>(x), static_cast<QTextLine::CursorPosition>(param2));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLine_Draw3(const QTextLine* self, QPainter* p, QPointF* point, QTextLayout__FormatRange* selection) {
|
|
|
|
self->draw(p, *point, selection);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLine_GlyphRuns1(const QTextLine* self, int from, QGlyphRun*** _out, size_t* _out_len) {
|
|
|
|
QList<QGlyphRun> ret = self->glyphRuns(static_cast<int>(from));
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QGlyphRun** __out = static_cast<QGlyphRun**>(malloc(sizeof(QGlyphRun**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QGlyphRun(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextLine_GlyphRuns2(const QTextLine* self, int from, int length, QGlyphRun*** _out, size_t* _out_len) {
|
|
|
|
QList<QGlyphRun> ret = self->glyphRuns(static_cast<int>(from), static_cast<int>(length));
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QGlyphRun** __out = static_cast<QGlyphRun**>(malloc(sizeof(QGlyphRun**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QGlyphRun(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextLine_Delete(QTextLine* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QTextLayout__FormatRange_Delete(QTextLayout__FormatRange* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|