Adds abstract scroll area

This commit is contained in:
Atul R 2019-08-24 11:14:17 +02:00
parent 6d3e436070
commit dcb2aa5d8b
22 changed files with 95 additions and 353 deletions

View File

@ -0,0 +1,43 @@
#pragma once
#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h"
#include "deps/spdlog/spdlog.h"
/*
This macro adds common QAbstractScrollArea exported methods
The exported methods are taken into this macro to avoid writing them in each and every widget we export.
*/
#ifndef QABSTRACTSCROLLAREA_WRAPPED_METHODS_DECLARATION
#define QABSTRACTSCROLLAREA_WRAPPED_METHODS_DECLARATION \
\
Napi::Value setViewport(const Napi::CallbackInfo& info) { \
Napi::Env env = info.Env(); \
Napi::HandleScope scope(env); \
Napi::Object viewPortObject = info[0].As<Napi::Object>(); \
QWidgetWrap* viewPortWidgetWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(viewPortObject); \
QWidget* viewPort = viewPortWidgetWrap->getInternalInstance(); \
this->instance->setViewport(viewPort); \
return env.Null(); \
} \
\
Napi::Value viewport(const Napi::CallbackInfo& info) { \
Napi::Env env = info.Env(); \
Napi::HandleScope scope(env); \
QWidget* viewPort = this->instance->viewport(); \
NWidget* nviewPort = reinterpret_cast<NWidget*>(viewPort); \
auto instance = QWidgetWrap::constructor.New({ Napi::External<NWidget>::New(env, nviewPort) }); \
return instance; \
} \
\
#endif //QABSTRACTSCROLLAREA_WRAPPED_METHODS_DECLARATION
#ifndef QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE
#define QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE(WidgetWrapName) \
\
InstanceMethod("setViewport", &WidgetWrapName::setViewport), \
InstanceMethod("viewport",&WidgetWrapName::viewport), \
#endif // QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE

View File

@ -15,6 +15,7 @@ Napi::Object QPlainTextEditWrap::init(Napi::Env env, Napi::Object exports) {
InstanceMethod("toPlainText",&QPlainTextEditWrap::toPlainText),
InstanceMethod("clear", &QPlainTextEditWrap::clear),
QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QPlainTextEditWrap)
QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE(QPlainTextEditWrap)
});
constructor = Napi::Persistent(func);
exports.Set(CLASSNAME, func);

View File

@ -3,7 +3,7 @@
#include <napi.h>
#include "nplaintextedit.h"
#include "src/cpp/QtWidgets/QWidget/qwidget_macro.h"
#include "src/cpp/QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h"
class QPlainTextEditWrap : public Napi::ObjectWrap<QPlainTextEditWrap>{
private:
@ -18,6 +18,7 @@ class QPlainTextEditWrap : public Napi::ObjectWrap<QPlainTextEditWrap>{
//wrapped methods
QWIDGET_WRAPPED_METHODS_DECLARATION
QABSTRACTSCROLLAREA_WRAPPED_METHODS_DECLARATION
Napi::Value setPlainText(const Napi::CallbackInfo& info);
Napi::Value toPlainText(const Napi::CallbackInfo &info);
Napi::Value clear(const Napi::CallbackInfo &info);

View File

@ -1,4 +1,4 @@
#include "QSpinBox_wrap.h"
#include "qspinbox_wrap.h"
#include "src/cpp/QtWidgets/QWidget/qwidget_wrap.h"
#include "src/cpp/QtGui/QIcon/qicon_wrap.h"
#include "src/cpp/Extras/Utils/nutils.h"

View File

@ -1,326 +0,0 @@
/****************************************************************************
** Meta object code from reading C++ file 'nwidget.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "nwidget.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'nwidget.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.12.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_NWidget_t {
QByteArrayData data[45];
char stringdata0[485];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_NWidget_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_NWidget_t qt_meta_stringdata_NWidget = {
{
QT_MOC_LITERAL(0, 0, 7), // "NWidget"
QT_MOC_LITERAL(1, 8, 7), // "display"
QT_MOC_LITERAL(2, 16, 10), // "alignItems"
QT_MOC_LITERAL(3, 27, 12), // "alignContent"
QT_MOC_LITERAL(4, 40, 9), // "alignSelf"
QT_MOC_LITERAL(5, 50, 14), // "justifyContent"
QT_MOC_LITERAL(6, 65, 9), // "direction"
QT_MOC_LITERAL(7, 75, 13), // "flexDirection"
QT_MOC_LITERAL(8, 89, 8), // "overflow"
QT_MOC_LITERAL(9, 98, 8), // "position"
QT_MOC_LITERAL(10, 107, 8), // "flexWrap"
QT_MOC_LITERAL(11, 116, 4), // "flex"
QT_MOC_LITERAL(12, 121, 8), // "flexGrow"
QT_MOC_LITERAL(13, 130, 10), // "flexShrink"
QT_MOC_LITERAL(14, 141, 11), // "aspectRatio"
QT_MOC_LITERAL(15, 153, 3), // "top"
QT_MOC_LITERAL(16, 157, 5), // "right"
QT_MOC_LITERAL(17, 163, 6), // "bottom"
QT_MOC_LITERAL(18, 170, 4), // "left"
QT_MOC_LITERAL(19, 175, 9), // "flexBasis"
QT_MOC_LITERAL(20, 185, 8), // "minWidth"
QT_MOC_LITERAL(21, 194, 9), // "minHeight"
QT_MOC_LITERAL(22, 204, 8), // "maxWidth"
QT_MOC_LITERAL(23, 213, 9), // "maxHeight"
QT_MOC_LITERAL(24, 223, 10), // "paddingTop"
QT_MOC_LITERAL(25, 234, 12), // "paddingRight"
QT_MOC_LITERAL(26, 247, 13), // "paddingBottom"
QT_MOC_LITERAL(27, 261, 11), // "paddingLeft"
QT_MOC_LITERAL(28, 273, 17), // "paddingHorizontal"
QT_MOC_LITERAL(29, 291, 15), // "paddingVertical"
QT_MOC_LITERAL(30, 307, 7), // "padding"
QT_MOC_LITERAL(31, 315, 9), // "marginTop"
QT_MOC_LITERAL(32, 325, 11), // "marginRight"
QT_MOC_LITERAL(33, 337, 12), // "marginBottom"
QT_MOC_LITERAL(34, 350, 10), // "marginLeft"
QT_MOC_LITERAL(35, 361, 16), // "marginHorizontal"
QT_MOC_LITERAL(36, 378, 14), // "marginVertical"
QT_MOC_LITERAL(37, 393, 6), // "margin"
QT_MOC_LITERAL(38, 400, 9), // "borderTop"
QT_MOC_LITERAL(39, 410, 11), // "borderRight"
QT_MOC_LITERAL(40, 422, 12), // "borderBottom"
QT_MOC_LITERAL(41, 435, 10), // "borderLeft"
QT_MOC_LITERAL(42, 446, 16), // "borderHorizontal"
QT_MOC_LITERAL(43, 463, 14), // "borderVertical"
QT_MOC_LITERAL(44, 478, 6) // "border"
},
"NWidget\0display\0alignItems\0alignContent\0"
"alignSelf\0justifyContent\0direction\0"
"flexDirection\0overflow\0position\0"
"flexWrap\0flex\0flexGrow\0flexShrink\0"
"aspectRatio\0top\0right\0bottom\0left\0"
"flexBasis\0minWidth\0minHeight\0maxWidth\0"
"maxHeight\0paddingTop\0paddingRight\0"
"paddingBottom\0paddingLeft\0paddingHorizontal\0"
"paddingVertical\0padding\0marginTop\0"
"marginRight\0marginBottom\0marginLeft\0"
"marginHorizontal\0marginVertical\0margin\0"
"borderTop\0borderRight\0borderBottom\0"
"borderLeft\0borderHorizontal\0borderVertical\0"
"border"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_NWidget[] = {
// content:
8, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
44, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::QString, 0x00095003,
2, QMetaType::QString, 0x00095003,
3, QMetaType::QString, 0x00095003,
4, QMetaType::QString, 0x00095003,
5, QMetaType::QString, 0x00095003,
6, QMetaType::QString, 0x00095003,
7, QMetaType::QString, 0x00095003,
8, QMetaType::QString, 0x00095003,
9, QMetaType::QString, 0x00095003,
10, QMetaType::QString, 0x00095003,
11, QMetaType::Float, 0x00095003,
12, QMetaType::Float, 0x00095003,
13, QMetaType::Float, 0x00095003,
14, QMetaType::Float, 0x00095003,
15, QMetaType::QString, 0x00095003,
16, QMetaType::QString, 0x00095003,
17, QMetaType::QString, 0x00095003,
18, QMetaType::QString, 0x00095003,
19, QMetaType::QString, 0x00095003,
20, QMetaType::QString, 0x00095003,
21, QMetaType::QString, 0x00095003,
22, QMetaType::QString, 0x00095003,
23, QMetaType::QString, 0x00095003,
24, QMetaType::QString, 0x00095003,
25, QMetaType::QString, 0x00095003,
26, QMetaType::QString, 0x00095003,
27, QMetaType::QString, 0x00095003,
28, QMetaType::QString, 0x00095003,
29, QMetaType::QString, 0x00095003,
30, QMetaType::QString, 0x00095003,
31, QMetaType::QString, 0x00095003,
32, QMetaType::QString, 0x00095003,
33, QMetaType::QString, 0x00095003,
34, QMetaType::QString, 0x00095003,
35, QMetaType::QString, 0x00095003,
36, QMetaType::QString, 0x00095003,
37, QMetaType::QString, 0x00095003,
38, QMetaType::Float, 0x00095003,
39, QMetaType::Float, 0x00095003,
40, QMetaType::Float, 0x00095003,
41, QMetaType::Float, 0x00095003,
42, QMetaType::Float, 0x00095003,
43, QMetaType::Float, 0x00095003,
44, QMetaType::Float, 0x00095003,
0 // eod
};
void NWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
auto *_t = static_cast<NWidget *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QString*>(_v) = _t->_yDisplay; break;
case 1: *reinterpret_cast< QString*>(_v) = _t->_yAlignItems; break;
case 2: *reinterpret_cast< QString*>(_v) = _t->_yAlignContent; break;
case 3: *reinterpret_cast< QString*>(_v) = _t->_yAlignSelf; break;
case 4: *reinterpret_cast< QString*>(_v) = _t->_yJustifyContent; break;
case 5: *reinterpret_cast< QString*>(_v) = _t->_yDirection; break;
case 6: *reinterpret_cast< QString*>(_v) = _t->_yFlexDirection; break;
case 7: *reinterpret_cast< QString*>(_v) = _t->_yOverflow; break;
case 8: *reinterpret_cast< QString*>(_v) = _t->_yPosition; break;
case 9: *reinterpret_cast< QString*>(_v) = _t->_yFlexWrap; break;
case 10: *reinterpret_cast< float*>(_v) = _t->_yFlex; break;
case 11: *reinterpret_cast< float*>(_v) = _t->_yFlexGrow; break;
case 12: *reinterpret_cast< float*>(_v) = _t->_yFlexShrink; break;
case 13: *reinterpret_cast< float*>(_v) = _t->_yAspectRatio; break;
case 14: *reinterpret_cast< QString*>(_v) = _t->_yTop; break;
case 15: *reinterpret_cast< QString*>(_v) = _t->_yRight; break;
case 16: *reinterpret_cast< QString*>(_v) = _t->_yBottom; break;
case 17: *reinterpret_cast< QString*>(_v) = _t->_yLeft; break;
case 18: *reinterpret_cast< QString*>(_v) = _t->_yFlexBasis; break;
case 19: *reinterpret_cast< QString*>(_v) = _t->_yMinWidth; break;
case 20: *reinterpret_cast< QString*>(_v) = _t->_yMinHeight; break;
case 21: *reinterpret_cast< QString*>(_v) = _t->_yMaxWidth; break;
case 22: *reinterpret_cast< QString*>(_v) = _t->_yMaxHeight; break;
case 23: *reinterpret_cast< QString*>(_v) = _t->_yPaddingTop; break;
case 24: *reinterpret_cast< QString*>(_v) = _t->_yPaddingRight; break;
case 25: *reinterpret_cast< QString*>(_v) = _t->_yPaddingBottom; break;
case 26: *reinterpret_cast< QString*>(_v) = _t->_yPaddingLeft; break;
case 27: *reinterpret_cast< QString*>(_v) = _t->_yPaddingHorizontal; break;
case 28: *reinterpret_cast< QString*>(_v) = _t->_yPaddingVertical; break;
case 29: *reinterpret_cast< QString*>(_v) = _t->_yPadding; break;
case 30: *reinterpret_cast< QString*>(_v) = _t->_yMarginTop; break;
case 31: *reinterpret_cast< QString*>(_v) = _t->_yMarginRight; break;
case 32: *reinterpret_cast< QString*>(_v) = _t->_yMarginBottom; break;
case 33: *reinterpret_cast< QString*>(_v) = _t->_yMarginLeft; break;
case 34: *reinterpret_cast< QString*>(_v) = _t->_yMarginHorizontal; break;
case 35: *reinterpret_cast< QString*>(_v) = _t->_yMarginVertical; break;
case 36: *reinterpret_cast< QString*>(_v) = _t->_yMargin; break;
case 37: *reinterpret_cast< float*>(_v) = _t->_yBorderTop; break;
case 38: *reinterpret_cast< float*>(_v) = _t->_yBorderRight; break;
case 39: *reinterpret_cast< float*>(_v) = _t->_yBorderBottom; break;
case 40: *reinterpret_cast< float*>(_v) = _t->_yBorderLeft; break;
case 41: *reinterpret_cast< float*>(_v) = _t->_yBorderHorizontal; break;
case 42: *reinterpret_cast< float*>(_v) = _t->_yBorderVertical; break;
case 43: *reinterpret_cast< float*>(_v) = _t->_yBorder; break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
auto *_t = static_cast<NWidget *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setYDisplay(*reinterpret_cast< QString*>(_v)); break;
case 1: _t->setYAlignItems(*reinterpret_cast< QString*>(_v)); break;
case 2: _t->setYAlignContent(*reinterpret_cast< QString*>(_v)); break;
case 3: _t->setYAlignSelf(*reinterpret_cast< QString*>(_v)); break;
case 4: _t->setYJustifyContent(*reinterpret_cast< QString*>(_v)); break;
case 5: _t->setYDirection(*reinterpret_cast< QString*>(_v)); break;
case 6: _t->setYFlexDirection(*reinterpret_cast< QString*>(_v)); break;
case 7: _t->setYOverflow(*reinterpret_cast< QString*>(_v)); break;
case 8: _t->setYPosition(*reinterpret_cast< QString*>(_v)); break;
case 9: _t->setYFlexWrap(*reinterpret_cast< QString*>(_v)); break;
case 10: _t->setYFlex(*reinterpret_cast< float*>(_v)); break;
case 11: _t->setYFlexGrow(*reinterpret_cast< float*>(_v)); break;
case 12: _t->setYFlexShrink(*reinterpret_cast< float*>(_v)); break;
case 13: _t->setYAspectRatio(*reinterpret_cast< float*>(_v)); break;
case 14: _t->setYNodeTop(*reinterpret_cast< QString*>(_v)); break;
case 15: _t->setYNodeRight(*reinterpret_cast< QString*>(_v)); break;
case 16: _t->setYNodeBottom(*reinterpret_cast< QString*>(_v)); break;
case 17: _t->setYNodeLeft(*reinterpret_cast< QString*>(_v)); break;
case 18: _t->setYFlexBasis(*reinterpret_cast< QString*>(_v)); break;
case 19: _t->setYMinWidth(*reinterpret_cast< QString*>(_v)); break;
case 20: _t->setYMinHeight(*reinterpret_cast< QString*>(_v)); break;
case 21: _t->setYMaxWidth(*reinterpret_cast< QString*>(_v)); break;
case 22: _t->setYMaxHeight(*reinterpret_cast< QString*>(_v)); break;
case 23: _t->setYPaddingTop(*reinterpret_cast< QString*>(_v)); break;
case 24: _t->setYPaddingRight(*reinterpret_cast< QString*>(_v)); break;
case 25: _t->setYPaddingBottom(*reinterpret_cast< QString*>(_v)); break;
case 26: _t->setYPaddingLeft(*reinterpret_cast< QString*>(_v)); break;
case 27: _t->setYPaddingHorizontal(*reinterpret_cast< QString*>(_v)); break;
case 28: _t->setYPaddingVertical(*reinterpret_cast< QString*>(_v)); break;
case 29: _t->setYPadding(*reinterpret_cast< QString*>(_v)); break;
case 30: _t->setYMarginTop(*reinterpret_cast< QString*>(_v)); break;
case 31: _t->setYMarginRight(*reinterpret_cast< QString*>(_v)); break;
case 32: _t->setYMarginBottom(*reinterpret_cast< QString*>(_v)); break;
case 33: _t->setYMarginLeft(*reinterpret_cast< QString*>(_v)); break;
case 34: _t->setYMarginHorizontal(*reinterpret_cast< QString*>(_v)); break;
case 35: _t->setYMarginVertical(*reinterpret_cast< QString*>(_v)); break;
case 36: _t->setYMarginAll(*reinterpret_cast< QString*>(_v)); break;
case 37: _t->setYBorderTop(*reinterpret_cast< float*>(_v)); break;
case 38: _t->setYBorderRight(*reinterpret_cast< float*>(_v)); break;
case 39: _t->setYBorderBottom(*reinterpret_cast< float*>(_v)); break;
case 40: _t->setYBorderLeft(*reinterpret_cast< float*>(_v)); break;
case 41: _t->setYBorderHorizontal(*reinterpret_cast< float*>(_v)); break;
case 42: _t->setYBorderVertical(*reinterpret_cast< float*>(_v)); break;
case 43: _t->setYBorder(*reinterpret_cast< float*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject NWidget::staticMetaObject = { {
&QWidget::staticMetaObject,
qt_meta_stringdata_NWidget.data,
qt_meta_data_NWidget,
qt_static_metacall,
nullptr,
nullptr
} };
const QMetaObject *NWidget::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *NWidget::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_NWidget.stringdata0))
return static_cast<void*>(this);
if (!strcmp(_clname, "YogaWidget"))
return static_cast< YogaWidget*>(this);
return QWidget::qt_metacast(_clname);
}
int NWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 44;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 44;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 44;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 44;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 44;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 44;
}
#endif // QT_NO_PROPERTIES
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE

View File

@ -23,10 +23,14 @@ QWidgetWrap::QWidgetWrap(const Napi::CallbackInfo& info): Napi::ObjectWrap<QWidg
Napi::Env env = info.Env();
Napi::HandleScope scope(env);
if(info.Length() == 1) {
Napi::Object parentObject = info[0].As<Napi::Object>();
QWidgetWrap* parentWidgetWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
this->instance = new NWidget(parentWidgetWrap->getInternalInstance()); //this sets the parent to current widget
}else if (info.Length() == 0){
if(info[0].IsExternal()){
this->instance = info[0].As<Napi::External<NWidget>>().Data();
} else {
Napi::Object parentObject = info[0].As<Napi::Object>();
QWidgetWrap* parentWidgetWrap = Napi::ObjectWrap<QWidgetWrap>::Unwrap(parentObject);
this->instance = new NWidget(parentWidgetWrap->getInternalInstance()); //this sets the parent to current widget
}
} else if (info.Length() == 0){
this->instance = new NWidget();
}else {
Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException();

View File

@ -1,11 +1,11 @@
// enums
export * from "./lib/QtEnums";
export { QApplication } from "./lib/QtGui/QApplication";
export { QWidget, QWidgetEvents } from "./lib/QtGui/QWidget";
export { QWidget, QWidgetEvents } from "./lib/QtWidgets/QWidget";
export { QPixmap } from "./lib/QtGui/QPixmap";
export { QIcon } from "./lib/QtGui/QIcon";
// Abstract:
export { NodeWidget } from "./lib/QtGui/QWidget";
export { NodeWidget } from "./lib/QtWidgets/QWidget";
export { NodeLayout } from "./lib/QtWidgets/QLayout";
// Widgets:
export { QCheckBox, QCheckBoxEvents } from "./lib/QtWidgets/QCheckBox";
@ -14,7 +14,7 @@ export { QLineEdit, QLineEditEvents } from "./lib/QtWidgets/QLineEdit";
export { QMainWindow, QMainWindowEvents } from "./lib/QtWidgets/QMainWindow";
export { QProgressBar, QProgressBarEvents } from "./lib/QtWidgets/QProgressBar";
export { QPushButton, QPushButtonEvents } from "./lib/QtWidgets/QPushButton";
export { QSpinBox , QSpinBoxEvents } from "./lib/QtWidgets/QSpinBox";
export { QSpinBox, QSpinBoxEvents } from "./lib/QtWidgets/QSpinBox";
export { QRadioButton, QRadioButtonEvents } from "./lib/QtWidgets/QRadioButton";
export {
QPlainTextEdit,

View File

@ -0,0 +1,11 @@
import { NodeWidget, QWidget } from "../QWidget";
export abstract class QAbstractScrollArea extends NodeWidget {
setViewport = (widget: NodeWidget) => {
this.native.setViewport(widget.native);
};
viewport = (): QWidget => {
const nativeWidget = this.native.viewport();
return new QWidget(nativeWidget);
};
}

View File

@ -1,5 +1,5 @@
import addon from "../../core/addon";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,5 +1,5 @@
import addon from "../../core/addon";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../QWidget";
import { NodeLayout } from "../QLayout";
import { NativeElement } from "../../core/Component";

View File

@ -1,5 +1,5 @@
import addon from "../../core/addon";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";
import { QPixmap } from "../../QtGui/QPixmap";

View File

@ -1,5 +1,5 @@
import { Component } from "../../core/Component";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../QWidget";
// All Layouts should extend this abstract class.
export abstract class NodeLayout extends Component {

View File

@ -1,5 +1,5 @@
import addon from "../../core/addon";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,5 +1,5 @@
import addon from "../../core/addon";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";
import { NodeLayout } from "../QLayout";

View File

@ -1,14 +1,15 @@
import addon from "../../core/addon";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";
import { QAbstractScrollArea } from "../QAbstractScrollArea";
export const QPlainTextEditEvents = Object.freeze({
...BaseWidgetEvents,
textChanged: "textChanged",
textChanged: "textChanged"
});
export class QPlainTextEdit extends NodeWidget {
export class QPlainTextEdit extends QAbstractScrollArea {
native: NativeElement;
constructor(parent?: NodeWidget) {
let native;

View File

@ -1,5 +1,5 @@
import addon from "../../core/addon";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";
import { Orientation } from "../../QtEnums";

View File

@ -1,5 +1,5 @@
import addon from "../../core/addon";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";
import { QIcon } from "../../QtGui/QIcon";

View File

@ -1,5 +1,5 @@
import addon from "../../core/addon";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,5 +1,5 @@
import addon from "../../core/addon";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";
import { QIcon } from "../../QtGui/QIcon";

View File

@ -1,5 +1,5 @@
import addon from "../../core/addon";
import { NodeLayout } from "../../QtWidgets/QLayout";
import { NodeLayout } from "../QLayout";
import { EventWidget, BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";
import { FlexLayout } from "../../core/FlexLayout";
@ -9,6 +9,7 @@ import {
StyleSheet,
prepareInlineStyleSheet
} from "../../core/Style/StyleSheet";
import { checkIfNativeElement } from "../../utils";
// All Widgets should extend from NodeWidget
// Implement all native QWidget methods here so that all widgets get access to those aswell
export abstract class NodeWidget extends EventWidget {
@ -105,11 +106,17 @@ export abstract class NodeWidget extends EventWidget {
};
}
type arg = NodeWidget | NativeElement;
export class QWidget extends NodeWidget {
native: NativeElement;
constructor(parent?: QWidget) {
constructor(arg?: arg) {
let native;
if (parent) {
let parent;
if (checkIfNativeElement(arg)) {
native = arg as NativeElement;
} else if (arg as NodeWidget) {
parent = arg as NodeWidget;
native = new addon.QWidget(parent.native);
} else {
native = new addon.QWidget();

View File

@ -1,5 +1,5 @@
import addon from "../addon";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../../QtWidgets/QWidget";
import { NodeLayout } from "../../QtWidgets/QLayout";
import { FlexNode } from "../YogaWidget";
import { NativeElement } from "../Component";

View File

@ -1,7 +1,7 @@
import postcss from "postcss";
import cuid from "cuid";
import nodeguiAutoPrefixer from "postcss-nodegui-autoprefixer";
import { NodeWidget } from "../../QtGui/QWidget";
import { NodeWidget } from "../../QtWidgets/QWidget";
export class StyleSheet {
static create = async (cssString: string): Promise<string> => {
const { css } = await postcss([nodeguiAutoPrefixer()])