forked from nodegui/nodegui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnutils.h
More file actions
48 lines (40 loc) · 1.31 KB
/
nutils.h
File metadata and controls
48 lines (40 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#ifdef _WINDLL
#ifdef ENABLE_DLL_EXPORT
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif
#else
#define DLL_EXPORT
#endif
#include <napi.h>
#include <QPointer>
#include <QVariant>
#include "core/FlexLayout/flexutils.h"
#include "deps/yoga/YGNode.h"
namespace extrautils {
DLL_EXPORT QVariant* convertToQVariant(Napi::Env& env, Napi::Value& value);
DLL_EXPORT bool isNapiValueInt(Napi::Env& env, Napi::Value& num);
DLL_EXPORT std::string getNapiObjectClassName(Napi::Object& object);
DLL_EXPORT void* configureQWidget(QWidget* widget, YGNodeRef node,
bool isLeafNode = false);
DLL_EXPORT void* configureQObject(QObject* object);
DLL_EXPORT void* configureComponent(void* component);
template <typename T>
void safeDelete(QPointer<T>& component) {
if (!component.isNull()) {
delete component;
}
}
void initAppSettings();
} // namespace extrautils
class DLL_EXPORT NUtilsWrap : public Napi::ObjectWrap<NUtilsWrap> {
public:
static Napi::Object init(Napi::Env env, Napi::Object exports);
NUtilsWrap(const Napi::CallbackInfo& info);
static Napi::FunctionReference constructor;
};
namespace StaticNUtilsWrapMethods {
DLL_EXPORT Napi::Value isNapiExternal(const Napi::CallbackInfo& info);
} // namespace StaticNUtilsWrapMethods