2024-08-25 04:08:24 +00:00
|
|
|
#include <QImage>
|
|
|
|
#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 <QTextBlockFormat>
|
|
|
|
#include <QTextCharFormat>
|
|
|
|
#include <QTextCursor>
|
|
|
|
#include <QTextDocument>
|
|
|
|
#include <QTextDocumentFragment>
|
|
|
|
#include <QTextFrame>
|
|
|
|
#include <QTextFrameFormat>
|
|
|
|
#include <QTextImageFormat>
|
|
|
|
#include <QTextList>
|
|
|
|
#include <QTextListFormat>
|
|
|
|
#include <QTextTable>
|
|
|
|
#include <QTextTableFormat>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "qtextcursor.h"
|
|
|
|
#include "gen_qtextcursor.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
QTextCursor* QTextCursor_new() {
|
|
|
|
return new QTextCursor();
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextCursor* QTextCursor_new2(QTextDocument* document) {
|
|
|
|
return new QTextCursor(document);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextCursor* QTextCursor_new3(QTextFrame* frame) {
|
|
|
|
return new QTextCursor(frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextCursor* QTextCursor_new4(QTextBlock* block) {
|
|
|
|
return new QTextCursor(*block);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextCursor* QTextCursor_new5(QTextCursor* cursor) {
|
|
|
|
return new QTextCursor(*cursor);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_OperatorAssign(QTextCursor* self, QTextCursor* other) {
|
|
|
|
self->operator=(*other);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_Swap(QTextCursor* self, QTextCursor* other) {
|
|
|
|
self->swap(*other);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_IsNull(const QTextCursor* self) {
|
|
|
|
return self->isNull();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_SetPosition(QTextCursor* self, int pos) {
|
|
|
|
self->setPosition(static_cast<int>(pos));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextCursor_Position(const QTextCursor* self) {
|
|
|
|
return self->position();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextCursor_PositionInBlock(const QTextCursor* self) {
|
|
|
|
return self->positionInBlock();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextCursor_Anchor(const QTextCursor* self) {
|
|
|
|
return self->anchor();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QTextCursor_InsertText(QTextCursor* self, struct miqt_string* text) {
|
|
|
|
QString text_QString = QString::fromUtf8(&text->data, text->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->insertText(text_QString);
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QTextCursor_InsertText2(QTextCursor* self, struct miqt_string* text, QTextCharFormat* format) {
|
|
|
|
QString text_QString = QString::fromUtf8(&text->data, text->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->insertText(text_QString, *format);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
bool QTextCursor_MovePosition(QTextCursor* self, uintptr_t op) {
|
|
|
|
return self->movePosition(static_cast<QTextCursor::MoveOperation>(op));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_VisualNavigation(const QTextCursor* self) {
|
|
|
|
return self->visualNavigation();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_SetVisualNavigation(QTextCursor* self, bool b) {
|
|
|
|
self->setVisualNavigation(b);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_SetVerticalMovementX(QTextCursor* self, int x) {
|
|
|
|
self->setVerticalMovementX(static_cast<int>(x));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextCursor_VerticalMovementX(const QTextCursor* self) {
|
|
|
|
return self->verticalMovementX();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_SetKeepPositionOnInsert(QTextCursor* self, bool b) {
|
|
|
|
self->setKeepPositionOnInsert(b);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_KeepPositionOnInsert(const QTextCursor* self) {
|
|
|
|
return self->keepPositionOnInsert();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_DeleteChar(QTextCursor* self) {
|
|
|
|
self->deleteChar();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_DeletePreviousChar(QTextCursor* self) {
|
|
|
|
self->deletePreviousChar();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QTextCursor_Select(QTextCursor* self, uintptr_t selection) {
|
|
|
|
self->select(static_cast<QTextCursor::SelectionType>(selection));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_HasSelection(const QTextCursor* self) {
|
|
|
|
return self->hasSelection();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_HasComplexSelection(const QTextCursor* self) {
|
|
|
|
return self->hasComplexSelection();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_RemoveSelectedText(QTextCursor* self) {
|
|
|
|
self->removeSelectedText();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_ClearSelection(QTextCursor* self) {
|
|
|
|
self->clearSelection();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextCursor_SelectionStart(const QTextCursor* self) {
|
|
|
|
return self->selectionStart();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextCursor_SelectionEnd(const QTextCursor* self) {
|
|
|
|
return self->selectionEnd();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QTextCursor_SelectedText(const QTextCursor* self) {
|
|
|
|
QString _ret = self->selectedText();
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextDocumentFragment* QTextCursor_Selection(const QTextCursor* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QTextDocumentFragment _ret = self->selection();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
2024-09-14 22:29:05 +00:00
|
|
|
return static_cast<QTextDocumentFragment*>(new QTextDocumentFragment(_ret));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QTextCursor_SelectedTableCells(const QTextCursor* self, int* firstRow, int* numRows, int* firstColumn, int* numColumns) {
|
|
|
|
self->selectedTableCells(static_cast<int*>(firstRow), static_cast<int*>(numRows), static_cast<int*>(firstColumn), static_cast<int*>(numColumns));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextBlock* QTextCursor_Block(const QTextCursor* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QTextBlock _ret = self->block();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
2024-09-14 22:29:05 +00:00
|
|
|
return static_cast<QTextBlock*>(new QTextBlock(_ret));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextCharFormat* QTextCursor_CharFormat(const QTextCursor* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QTextCharFormat _ret = self->charFormat();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
2024-09-14 22:29:05 +00:00
|
|
|
return static_cast<QTextCharFormat*>(new QTextCharFormat(_ret));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_SetCharFormat(QTextCursor* self, QTextCharFormat* format) {
|
|
|
|
self->setCharFormat(*format);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_MergeCharFormat(QTextCursor* self, QTextCharFormat* modifier) {
|
|
|
|
self->mergeCharFormat(*modifier);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextBlockFormat* QTextCursor_BlockFormat(const QTextCursor* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QTextBlockFormat _ret = self->blockFormat();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
2024-09-14 22:29:05 +00:00
|
|
|
return static_cast<QTextBlockFormat*>(new QTextBlockFormat(_ret));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_SetBlockFormat(QTextCursor* self, QTextBlockFormat* format) {
|
|
|
|
self->setBlockFormat(*format);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_MergeBlockFormat(QTextCursor* self, QTextBlockFormat* modifier) {
|
|
|
|
self->mergeBlockFormat(*modifier);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextCharFormat* QTextCursor_BlockCharFormat(const QTextCursor* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QTextCharFormat _ret = self->blockCharFormat();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
2024-09-14 22:29:05 +00:00
|
|
|
return static_cast<QTextCharFormat*>(new QTextCharFormat(_ret));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_SetBlockCharFormat(QTextCursor* self, QTextCharFormat* format) {
|
|
|
|
self->setBlockCharFormat(*format);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_MergeBlockCharFormat(QTextCursor* self, QTextCharFormat* modifier) {
|
|
|
|
self->mergeBlockCharFormat(*modifier);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_AtBlockStart(const QTextCursor* self) {
|
|
|
|
return self->atBlockStart();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_AtBlockEnd(const QTextCursor* self) {
|
|
|
|
return self->atBlockEnd();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_AtStart(const QTextCursor* self) {
|
|
|
|
return self->atStart();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_AtEnd(const QTextCursor* self) {
|
|
|
|
return self->atEnd();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_InsertBlock(QTextCursor* self) {
|
|
|
|
self->insertBlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_InsertBlockWithFormat(QTextCursor* self, QTextBlockFormat* format) {
|
|
|
|
self->insertBlock(*format);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_InsertBlock2(QTextCursor* self, QTextBlockFormat* format, QTextCharFormat* charFormat) {
|
|
|
|
self->insertBlock(*format, *charFormat);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextList* QTextCursor_InsertList(QTextCursor* self, QTextListFormat* format) {
|
|
|
|
return self->insertList(*format);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QTextList* QTextCursor_InsertListWithStyle(QTextCursor* self, uintptr_t style) {
|
|
|
|
return self->insertList(static_cast<QTextListFormat::Style>(style));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
QTextList* QTextCursor_CreateList(QTextCursor* self, QTextListFormat* format) {
|
|
|
|
return self->createList(*format);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QTextList* QTextCursor_CreateListWithStyle(QTextCursor* self, uintptr_t style) {
|
|
|
|
return self->createList(static_cast<QTextListFormat::Style>(style));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextList* QTextCursor_CurrentList(const QTextCursor* self) {
|
|
|
|
return self->currentList();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QTextTable* QTextCursor_InsertTable(QTextCursor* self, int rows, int cols, QTextTableFormat* format) {
|
|
|
|
return self->insertTable(static_cast<int>(rows), static_cast<int>(cols), *format);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextTable* QTextCursor_InsertTable2(QTextCursor* self, int rows, int cols) {
|
|
|
|
return self->insertTable(static_cast<int>(rows), static_cast<int>(cols));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextTable* QTextCursor_CurrentTable(const QTextCursor* self) {
|
|
|
|
return self->currentTable();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QTextFrame* QTextCursor_InsertFrame(QTextCursor* self, QTextFrameFormat* format) {
|
|
|
|
return self->insertFrame(*format);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextFrame* QTextCursor_CurrentFrame(const QTextCursor* self) {
|
|
|
|
return self->currentFrame();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_InsertFragment(QTextCursor* self, QTextDocumentFragment* fragment) {
|
|
|
|
self->insertFragment(*fragment);
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QTextCursor_InsertHtml(QTextCursor* self, struct miqt_string* html) {
|
|
|
|
QString html_QString = QString::fromUtf8(&html->data, html->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->insertHtml(html_QString);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QTextCursor_InsertImage(QTextCursor* self, QTextImageFormat* format, uintptr_t alignment) {
|
|
|
|
self->insertImage(*format, static_cast<QTextFrameFormat::Position>(alignment));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_InsertImageWithFormat(QTextCursor* self, QTextImageFormat* format) {
|
2024-08-25 04:08:24 +00:00
|
|
|
self->insertImage(*format);
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QTextCursor_InsertImageWithName(QTextCursor* self, struct miqt_string* name) {
|
|
|
|
QString name_QString = QString::fromUtf8(&name->data, name->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->insertImage(name_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_InsertImageWithImage(QTextCursor* self, QImage* image) {
|
|
|
|
self->insertImage(*image);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_BeginEditBlock(QTextCursor* self) {
|
|
|
|
self->beginEditBlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_JoinPreviousEditBlock(QTextCursor* self) {
|
|
|
|
self->joinPreviousEditBlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_EndEditBlock(QTextCursor* self) {
|
|
|
|
self->endEditBlock();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_OperatorNotEqual(const QTextCursor* self, QTextCursor* rhs) {
|
|
|
|
return self->operator!=(*rhs);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_OperatorLesser(const QTextCursor* self, QTextCursor* rhs) {
|
|
|
|
return self->operator<(*rhs);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_OperatorLesserOrEqual(const QTextCursor* self, QTextCursor* rhs) {
|
|
|
|
return self->operator<=(*rhs);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_OperatorEqual(const QTextCursor* self, QTextCursor* rhs) {
|
|
|
|
return self->operator==(*rhs);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_OperatorGreaterOrEqual(const QTextCursor* self, QTextCursor* rhs) {
|
|
|
|
return self->operator>=(*rhs);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_OperatorGreater(const QTextCursor* self, QTextCursor* rhs) {
|
|
|
|
return self->operator>(*rhs);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCursor_IsCopyOf(const QTextCursor* self, QTextCursor* other) {
|
|
|
|
return self->isCopyOf(*other);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextCursor_BlockNumber(const QTextCursor* self) {
|
|
|
|
return self->blockNumber();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextCursor_ColumnNumber(const QTextCursor* self) {
|
|
|
|
return self->columnNumber();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextDocument* QTextCursor_Document(const QTextCursor* self) {
|
|
|
|
return self->document();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_SetPosition2(QTextCursor* self, int pos, uintptr_t mode) {
|
|
|
|
self->setPosition(static_cast<int>(pos), static_cast<QTextCursor::MoveMode>(mode));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QTextCursor_MovePosition2(QTextCursor* self, uintptr_t op, uintptr_t param2) {
|
|
|
|
return self->movePosition(static_cast<QTextCursor::MoveOperation>(op), static_cast<QTextCursor::MoveMode>(param2));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QTextCursor_MovePosition3(QTextCursor* self, uintptr_t op, uintptr_t param2, int n) {
|
|
|
|
return self->movePosition(static_cast<QTextCursor::MoveOperation>(op), static_cast<QTextCursor::MoveMode>(param2), static_cast<int>(n));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QTextCursor_InsertImage2(QTextCursor* self, QImage* image, struct miqt_string* name) {
|
|
|
|
QString name_QString = QString::fromUtf8(&name->data, name->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->insertImage(*image, name_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCursor_Delete(QTextCursor* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|