maxSize,minSize,repaint,update
This commit is contained in:
parent
85af0c209a
commit
22178c074a
@ -84,6 +84,44 @@ Napi::Value setEnabled(const Napi::CallbackInfo& info){ \
|
||||
this->instance->setEnabled(enabled.Value()); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value setFixedSize(const Napi::CallbackInfo& info){ \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
int width = info[0].As<Napi::Number>().Int32Value(); \
|
||||
int height = info[1].As<Napi::Number>().Int32Value(); \
|
||||
this->instance->setFixedSize(width, height); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value setMaximumSize(const Napi::CallbackInfo& info){ \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
int width = info[0].As<Napi::Number>().Int32Value(); \
|
||||
int height = info[1].As<Napi::Number>().Int32Value(); \
|
||||
this->instance->setMaximumSize(width, height); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value setMinimumSize(const Napi::CallbackInfo& info){ \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
int width = info[0].As<Napi::Number>().Int32Value(); \
|
||||
int height = info[1].As<Napi::Number>().Int32Value(); \
|
||||
this->instance->setMinimumSize(width, height); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value repaint(const Napi::CallbackInfo& info){ \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
this->instance->repaint(); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value update(const Napi::CallbackInfo& info){ \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
this->instance->update(); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
|
||||
|
||||
|
||||
#endif //QWIDGET_WRAPPED_METHODS_DECLARATION
|
||||
|
||||
@ -101,7 +139,11 @@ Napi::Value setEnabled(const Napi::CallbackInfo& info){ \
|
||||
InstanceMethod("setObjectName",&WidgetWrapName::setObjectName), \
|
||||
InstanceMethod("setMouseTracking",&WidgetWrapName::setMouseTracking), \
|
||||
InstanceMethod("setEnabled",&WidgetWrapName::setEnabled), \
|
||||
|
||||
InstanceMethod("setFixedSize",&WidgetWrapName::setFixedSize), \
|
||||
InstanceMethod("setMaximumSize",&WidgetWrapName::setMaximumSize), \
|
||||
InstanceMethod("setMinimumSize",&WidgetWrapName::setMinimumSize), \
|
||||
InstanceMethod("repaint",&WidgetWrapName::repaint), \
|
||||
InstanceMethod("update",&WidgetWrapName::update), \
|
||||
|
||||
#endif // QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ Napi::Object QMainWindowWrap::init(Napi::Env env, Napi::Object exports) {
|
||||
Napi::Function func = DefineClass(env, CLASSNAME, {
|
||||
QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QMainWindowWrap)
|
||||
InstanceMethod("setCentralWidget",&QMainWindowWrap::setCentralWidget),
|
||||
InstanceMethod("setFixedSize",&QMainWindowWrap::setFixedSize),
|
||||
});
|
||||
constructor = Napi::Persistent(func);
|
||||
exports.Set(CLASSNAME, func);
|
||||
@ -60,13 +59,3 @@ Napi::Value QMainWindowWrap::setCentralWidget(const Napi::CallbackInfo& info){
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
Napi::Value QMainWindowWrap::setFixedSize(const Napi::CallbackInfo& info){
|
||||
Napi::Env env = info.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
int width = info[0].As<Napi::Number>().Int32Value();
|
||||
int height = info[1].As<Napi::Number>().Int32Value();
|
||||
this->instance->setFixedSize(width, height);
|
||||
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ public:
|
||||
static Napi::FunctionReference constructor;
|
||||
//wrapped methods
|
||||
Napi::Value setCentralWidget(const Napi::CallbackInfo& info);
|
||||
Napi::Value setFixedSize(const Napi::CallbackInfo& info);
|
||||
|
||||
QWIDGET_WRAPPED_METHODS_DECLARATION
|
||||
};
|
||||
|
||||
@ -36,6 +36,21 @@ export abstract class NodeWidget extends EventWidget {
|
||||
setEnabled = (enabled: boolean) => {
|
||||
this.native.setEnabled(enabled);
|
||||
};
|
||||
setFixedSize = (width: number, height: number) => {
|
||||
this.native.setFixedSize(width, height);
|
||||
};
|
||||
setMaximumSize = (maxw: number, maxh: number) => {
|
||||
this.native.setMaximumSize(maxw, maxh);
|
||||
};
|
||||
setMinimumSize = (minw: number, minh: number) => {
|
||||
this.native.setMinimumSize(minw, minh);
|
||||
};
|
||||
repaint = () => {
|
||||
this.native.repaint();
|
||||
};
|
||||
update = () => {
|
||||
this.native.update();
|
||||
};
|
||||
}
|
||||
|
||||
export class QWidget extends NodeWidget {
|
||||
|
||||
@ -22,7 +22,6 @@ export class QMainWindow extends NodeWidget {
|
||||
this.parent = parent;
|
||||
// bind member functions
|
||||
this.setCentralWidget.bind(this);
|
||||
this.setFixedSize.bind(this);
|
||||
this.setLayout = (parentLayout: NodeLayout) => {
|
||||
if (this.centralWidget) {
|
||||
this.centralWidget.setLayout(parentLayout);
|
||||
@ -33,11 +32,8 @@ export class QMainWindow extends NodeWidget {
|
||||
};
|
||||
}
|
||||
setCentralWidget(widget: NodeWidget) {
|
||||
this.native.setCentralWidget(widget.native, widget.getFlexNode());
|
||||
this.centralWidget = widget;
|
||||
this.native.setCentralWidget(
|
||||
this.centralWidget.native,
|
||||
widget.getFlexNode()
|
||||
);
|
||||
}
|
||||
get layout() {
|
||||
if (this.centralWidget) {
|
||||
@ -46,7 +42,4 @@ export class QMainWindow extends NodeWidget {
|
||||
return super.layout;
|
||||
}
|
||||
}
|
||||
setFixedSize(width: number, height: number) {
|
||||
this.native.setFixedSize(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user