2024-08-25 04:08:24 +00:00
|
|
|
#include <QIcon>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QToolBox>
|
|
|
|
#include <QWidget>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "qtoolbox.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qtoolbox.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QToolBox* QToolBox_new() {
|
|
|
|
return new QToolBox();
|
|
|
|
}
|
|
|
|
|
|
|
|
QToolBox* QToolBox_new2(QWidget* parent) {
|
|
|
|
return new QToolBox(parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
QToolBox* QToolBox_new3(QWidget* parent, int f) {
|
|
|
|
return new QToolBox(parent, static_cast<Qt::WindowFlags>(f));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
QMetaObject* QToolBox_MetaObject(QToolBox* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return (QMetaObject*) const_cast<const QToolBox*>(self)->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QToolBox_Tr(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QToolBox::tr(s);
|
|
|
|
// 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 QToolBox_TrUtf8(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QToolBox::trUtf8(s);
|
|
|
|
// 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();
|
|
|
|
}
|
|
|
|
|
|
|
|
int QToolBox_AddItem(QToolBox* self, QWidget* widget, const char* text, size_t text_Strlen) {
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
return self->addItem(widget, text_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
int QToolBox_AddItem2(QToolBox* self, QWidget* widget, QIcon* icon, const char* text, size_t text_Strlen) {
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
return self->addItem(widget, *icon, text_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
int QToolBox_InsertItem(QToolBox* self, int index, QWidget* widget, const char* text, size_t text_Strlen) {
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
return self->insertItem(static_cast<int>(index), widget, text_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
int QToolBox_InsertItem2(QToolBox* self, int index, QWidget* widget, QIcon* icon, const char* text, size_t text_Strlen) {
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
return self->insertItem(static_cast<int>(index), widget, *icon, text_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QToolBox_RemoveItem(QToolBox* self, int index) {
|
|
|
|
self->removeItem(static_cast<int>(index));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QToolBox_SetItemEnabled(QToolBox* self, int index, bool enabled) {
|
|
|
|
self->setItemEnabled(static_cast<int>(index), enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QToolBox_IsItemEnabled(QToolBox* self, int index) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QToolBox*>(self)->isItemEnabled(static_cast<int>(index));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QToolBox_SetItemText(QToolBox* self, int index, const char* text, size_t text_Strlen) {
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
self->setItemText(static_cast<int>(index), text_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QToolBox_ItemText(QToolBox* self, int index, char** _out, int* _out_Strlen) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QString ret = const_cast<const QToolBox*>(self)->itemText(static_cast<int>(index));
|
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 QToolBox_SetItemIcon(QToolBox* self, int index, QIcon* icon) {
|
|
|
|
self->setItemIcon(static_cast<int>(index), *icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon* QToolBox_ItemIcon(QToolBox* self, int index) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QIcon ret = const_cast<const QToolBox*>(self)->itemIcon(static_cast<int>(index));
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QIcon*>(new QIcon(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QToolBox_SetItemToolTip(QToolBox* self, int index, const char* toolTip, size_t toolTip_Strlen) {
|
|
|
|
QString toolTip_QString = QString::fromUtf8(toolTip, toolTip_Strlen);
|
|
|
|
self->setItemToolTip(static_cast<int>(index), toolTip_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QToolBox_ItemToolTip(QToolBox* self, int index, char** _out, int* _out_Strlen) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QString ret = const_cast<const QToolBox*>(self)->itemToolTip(static_cast<int>(index));
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
int QToolBox_CurrentIndex(QToolBox* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QToolBox*>(self)->currentIndex();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QWidget* QToolBox_CurrentWidget(QToolBox* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QToolBox*>(self)->currentWidget();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QWidget* QToolBox_Widget(QToolBox* self, int index) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QToolBox*>(self)->widget(static_cast<int>(index));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QToolBox_IndexOf(QToolBox* self, QWidget* widget) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QToolBox*>(self)->indexOf(widget);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QToolBox_Count(QToolBox* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QToolBox*>(self)->count();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QToolBox_SetCurrentIndex(QToolBox* self, int index) {
|
|
|
|
self->setCurrentIndex(static_cast<int>(index));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QToolBox_SetCurrentWidget(QToolBox* self, QWidget* widget) {
|
|
|
|
self->setCurrentWidget(widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QToolBox_CurrentChanged(QToolBox* self, int index) {
|
|
|
|
self->currentChanged(static_cast<int>(index));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QToolBox_connect_CurrentChanged(QToolBox* self, void* slot) {
|
|
|
|
QToolBox::connect(self, static_cast<void (QToolBox::*)(int)>(&QToolBox::currentChanged), self, [=](int index) {
|
|
|
|
miqt_exec_callback(slot, 0, nullptr);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QToolBox_Tr2(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QToolBox::tr(s, c);
|
|
|
|
// 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 QToolBox_Tr3(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QToolBox::tr(s, c, static_cast<int>(n));
|
|
|
|
// 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 QToolBox_TrUtf82(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QToolBox::trUtf8(s, c);
|
|
|
|
// 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 QToolBox_TrUtf83(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QToolBox::trUtf8(s, c, static_cast<int>(n));
|
|
|
|
// 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 QToolBox_Delete(QToolBox* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|