Add QWidget methods setFocusProxy(), isAncestorOf(), isEnabledTo(), isVisibleTo(), & stackUnder()
This commit is contained in:
parent
0db724d40c
commit
37d000ee44
@ -607,6 +607,14 @@
|
||||
return env.Null(); \
|
||||
} \
|
||||
} \
|
||||
Napi::Value setFocusProxy(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::Object widgetObject = info[0].As<Napi::Object>(); \
|
||||
NodeWidgetWrap* widgetWrap = \
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(widgetObject); \
|
||||
this->instance->setFocusProxy(widgetWrap->getInternalInstance()); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value focusWidget(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
QWidget* result = this->instance->focusWidget(); \
|
||||
@ -666,6 +674,42 @@
|
||||
} else { \
|
||||
return env.Null(); \
|
||||
} \
|
||||
} \
|
||||
Napi::Value isAncestorOf(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::Object childWidgetObject = info[0].As<Napi::Object>(); \
|
||||
NodeWidgetWrap* childWidgetWrap = \
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(childWidgetObject); \
|
||||
QWidget* child = childWidgetWrap->getInternalInstance(); \
|
||||
bool result = this->instance->isAncestorOf(child); \
|
||||
return Napi::Boolean::New(env, result); \
|
||||
} \
|
||||
Napi::Value isEnabledTo(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::Object ancestorWidgetObject = info[0].As<Napi::Object>(); \
|
||||
NodeWidgetWrap* ancestorWidgetWrap = \
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(ancestorWidgetObject); \
|
||||
QWidget* ancestor = ancestorWidgetWrap->getInternalInstance(); \
|
||||
bool result = this->instance->isEnabledTo(ancestor); \
|
||||
return Napi::Boolean::New(env, result); \
|
||||
} \
|
||||
Napi::Value isVisibleTo(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::Object ancestorWidgetObject = info[0].As<Napi::Object>(); \
|
||||
NodeWidgetWrap* ancestorWidgetWrap = \
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(ancestorWidgetObject); \
|
||||
QWidget* ancestor = ancestorWidgetWrap->getInternalInstance(); \
|
||||
bool result = this->instance->isVisibleTo(ancestor); \
|
||||
return Napi::Boolean::New(env, result); \
|
||||
} \
|
||||
Napi::Value stackUnder(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::Object wWidgetObject = info[0].As<Napi::Object>(); \
|
||||
NodeWidgetWrap* wWidgetWrap = \
|
||||
Napi::ObjectWrap<NodeWidgetWrap>::Unwrap(wWidgetObject); \
|
||||
QWidget* w = wWidgetWrap->getInternalInstance(); \
|
||||
this->instance->stackUnder(w); \
|
||||
return env.Null(); \
|
||||
}
|
||||
|
||||
#endif // QWIDGET_WRAPPED_METHODS_DECLARATION
|
||||
@ -762,6 +806,7 @@
|
||||
InstanceMethod("contentsRect", &WidgetWrapName::contentsRect), \
|
||||
InstanceMethod("childAt", &WidgetWrapName::childAt), \
|
||||
InstanceMethod("focusProxy", &WidgetWrapName::focusProxy), \
|
||||
InstanceMethod("setFocusProxy", &WidgetWrapName::setFocusProxy), \
|
||||
InstanceMethod("focusWidget", &WidgetWrapName::focusWidget), \
|
||||
InstanceMethod("nativeParentWidget", \
|
||||
&WidgetWrapName::nativeParentWidget), \
|
||||
@ -769,7 +814,11 @@
|
||||
InstanceMethod("parentWidget", &WidgetWrapName::parentWidget), \
|
||||
InstanceMethod("previousInFocusChain", \
|
||||
&WidgetWrapName::previousInFocusChain), \
|
||||
InstanceMethod("window", &WidgetWrapName::window),
|
||||
InstanceMethod("window", &WidgetWrapName::window), \
|
||||
InstanceMethod("isAncestorOf", &WidgetWrapName::isAncestorOf), \
|
||||
InstanceMethod("isEnabledTo", &WidgetWrapName::isEnabledTo), \
|
||||
InstanceMethod("isVisibleTo", &WidgetWrapName::isVisibleTo), \
|
||||
InstanceMethod("stackUnder", &WidgetWrapName::stackUnder),
|
||||
|
||||
#endif // QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE
|
||||
|
||||
|
||||
@ -115,7 +115,6 @@ export class QWidget<Signals extends QWidgetSignals = QWidgetSignals> extends Yo
|
||||
childAt(x: number, y: number): QWidget {
|
||||
return wrapperCache.getWrapper(this.native.childAt(x, y)) as QWidget;
|
||||
}
|
||||
// TODO: QWidget * childAt(const QPoint &p) const
|
||||
childrenRect(): QRect {
|
||||
return QRect.fromQVariant(this.property('childrenRect'));
|
||||
}
|
||||
@ -201,11 +200,15 @@ export class QWidget<Signals extends QWidgetSignals = QWidgetSignals> extends Yo
|
||||
isActiveWindow(): boolean {
|
||||
return this.property('isActiveWindow').toBool();
|
||||
}
|
||||
// TODO: bool isAncestorOf(const QWidget *child) const
|
||||
isAncestorOf(child: QWidget): boolean {
|
||||
return this.native.isAncestorOf(child);
|
||||
}
|
||||
isEnabled(): boolean {
|
||||
return this.property('enabled').toBool();
|
||||
}
|
||||
// TODO: bool isEnabledTo(const QWidget *ancestor) const
|
||||
isEnabledTo(ancestor: QWidget): boolean {
|
||||
return this.native.isEnabledTo(ancestor);
|
||||
}
|
||||
isFullScreen(): boolean {
|
||||
return this.property('fullScreen').toBool();
|
||||
}
|
||||
@ -224,14 +227,15 @@ export class QWidget<Signals extends QWidgetSignals = QWidgetSignals> extends Yo
|
||||
isVisible(): boolean {
|
||||
return this.property('visible').toBool();
|
||||
}
|
||||
// TODO: bool isVisibleTo(const QWidget *ancestor) const
|
||||
isVisibleTo(ancestor: QWidget): boolean {
|
||||
return this.native.isVisibleTo(ancestor);
|
||||
}
|
||||
isWindow(): boolean {
|
||||
return this.native.isWindow();
|
||||
}
|
||||
isWindowModified(): boolean {
|
||||
return this.native.isWindowModified();
|
||||
}
|
||||
// TODO: QLayout * layout() const
|
||||
// TODO: Qt::LayoutDirection layoutDirection() const
|
||||
// TODO: QLocale locale() const
|
||||
mapFrom(parent: QWidget, pos: QPoint): QPoint {
|
||||
@ -378,7 +382,9 @@ export class QWidget<Signals extends QWidgetSignals = QWidgetSignals> extends Yo
|
||||
setFocusPolicy(policy: FocusPolicy): void {
|
||||
this.setProperty('focusPolicy', policy);
|
||||
}
|
||||
// TODO: void setFocusProxy(QWidget *w)
|
||||
setFocusProxy(widget: QWidget): void {
|
||||
this.native.setFocusProxy(widget);
|
||||
}
|
||||
setFont(font: QFont): void {
|
||||
this.native.setProperty('font', font.native);
|
||||
}
|
||||
@ -509,7 +515,9 @@ export class QWidget<Signals extends QWidgetSignals = QWidgetSignals> extends Yo
|
||||
}
|
||||
// PROP: QWidget
|
||||
// TODO: QSizePolicy sizePolicy() const
|
||||
// TODO: void stackUnder(QWidget *w)
|
||||
stackUnder(w: QWidget): void {
|
||||
this.native.stackUnder(w);
|
||||
}
|
||||
statusTip(): string {
|
||||
return this.property('statusTip').toString();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user