nodeguy/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_wrap.h
2022-05-09 22:12:52 +02:00

41 lines
1.1 KiB
C++

#pragma once
#include <napi.h>
#include <QPointer>
#include "Extras/Export/export.h"
#include "QtWidgets/QWidget/qwidget_macro.h"
#include "nwidget.hpp"
// NodeWidgetWrap is exactly like QWidgetWrap but it is used only to unwrap any
// N<SomeWidget> to QWidget*
class DLL_EXPORT NodeWidgetWrap : public Napi::ObjectWrap<NodeWidgetWrap> {
QWIDGET_WRAPPED_METHODS_DECLARATION
private:
QPointer<NWidget> instance;
public:
NodeWidgetWrap(const Napi::CallbackInfo& info)
: Napi::ObjectWrap<NodeWidgetWrap>(info){};
QWidget* getInternalInstance() { return this->instance; };
// class constructor
static Napi::FunctionReference constructor;
// wrapped methods
};
class DLL_EXPORT QWidgetWrap : public Napi::ObjectWrap<QWidgetWrap> {
QWIDGET_WRAPPED_METHODS_DECLARATION
private:
QPointer<QWidget> instance;
public:
static Napi::Object init(Napi::Env env, Napi::Object exports);
QWidgetWrap(const Napi::CallbackInfo& info);
~QWidgetWrap();
QWidget* getInternalInstance();
// class constructor
static Napi::FunctionReference constructor;
// wrapped methods
};