Add more QWidget methods
This commit is contained in:
parent
81eeaa3a20
commit
8ddc4172cd
@ -491,6 +491,52 @@
|
||||
QStyle* style = this->instance->style(); \
|
||||
return QStyleWrap::constructor.New( \
|
||||
{Napi::External<QStyle>::New(env, style)}); \
|
||||
} \
|
||||
Napi::Value isWindow(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
bool result = this->instance->isWindow(); \
|
||||
return Napi::Boolean::New(env, result); \
|
||||
} \
|
||||
Napi::Value isWindowModified(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
bool result = this->instance->isWindowModified(); \
|
||||
return Napi::Boolean::New(env, result); \
|
||||
} \
|
||||
Napi::Value isHidden(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
bool result = this->instance->isHidden(); \
|
||||
return Napi::Boolean::New(env, result); \
|
||||
} \
|
||||
Napi::Value setDisabled(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
bool disable = info[0].As<Napi::Boolean>().Value(); \
|
||||
this->instance->setDisabled(disable); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value setHidden(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
bool hidden = info[0].As<Napi::Boolean>().Value(); \
|
||||
this->instance->setHidden(hidden); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value setVisible(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
bool visible = info[0].As<Napi::Boolean>().Value(); \
|
||||
this->instance->setVisible(visible); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value setWindowModified(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
bool modified = info[0].As<Napi::Boolean>().Value(); \
|
||||
this->instance->setWindowModified(modified); \
|
||||
return env.Null(); \
|
||||
}
|
||||
|
||||
#endif // QWIDGET_WRAPPED_METHODS_DECLARATION
|
||||
@ -560,7 +606,14 @@
|
||||
InstanceMethod("setMinimumWidth", &WidgetWrapName::setMinimumWidth), \
|
||||
InstanceMethod("setMaximumWidth", &WidgetWrapName::setMaximumWidth), \
|
||||
InstanceMethod("setMinimumHeight", &WidgetWrapName::setMinimumHeight), \
|
||||
InstanceMethod("style", &WidgetWrapName::style),
|
||||
InstanceMethod("style", &WidgetWrapName::style), \
|
||||
InstanceMethod("isWindow", &WidgetWrapName::isWindow), \
|
||||
InstanceMethod("isWindowModified", &WidgetWrapName::isWindowModified), \
|
||||
InstanceMethod("isHidden", &WidgetWrapName::isHidden), \
|
||||
InstanceMethod("setDisabled", &WidgetWrapName::setDisabled), \
|
||||
InstanceMethod("setHidden", &WidgetWrapName::setHidden), \
|
||||
InstanceMethod("setVisible", &WidgetWrapName::setVisible), \
|
||||
InstanceMethod("setWindowModified", &WidgetWrapName::setWindowModified),
|
||||
|
||||
#endif // QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE
|
||||
|
||||
|
||||
@ -135,8 +135,9 @@ export abstract class NodeWidget<Signals extends QWidgetSignals> extends YogaWid
|
||||
// TODO: int grabShortcut(const QKeySequence &key, Qt::ShortcutContext context = Qt::WindowShortcut)
|
||||
// TODO: QGraphicsEffect * graphicsEffect() const
|
||||
// TODO: QGraphicsProxyWidget * graphicsProxyWidget() const
|
||||
// TODO: bool hasEditFocus() const
|
||||
// TODO: bool hasFocus() const
|
||||
hasFocus(): boolean {
|
||||
return this.property('focus').toBool();
|
||||
}
|
||||
// TODO: virtual bool hasHeightForWidth() const
|
||||
hasMouseTracking(): boolean {
|
||||
return this.native.hasMouseTracking();
|
||||
@ -158,17 +159,31 @@ export abstract class NodeWidget<Signals extends QWidgetSignals> extends YogaWid
|
||||
return this.native.isEnabled();
|
||||
}
|
||||
// TODO: bool isEnabledTo(const QWidget *ancestor) const
|
||||
// TODO: bool isFullScreen() const
|
||||
// TODO: bool isHidden() const
|
||||
// TODO: bool isMaximized() const
|
||||
// TODO: bool isMinimized() const
|
||||
// TODO: bool isModal() const
|
||||
isFullScreen(): boolean {
|
||||
return this.property('fullScreen').toBool();
|
||||
}
|
||||
isHidden(): boolean {
|
||||
return this.native.isHidden();
|
||||
}
|
||||
isMaximized(): boolean {
|
||||
return this.property('maximized').toBool();
|
||||
}
|
||||
isMinimized(): boolean {
|
||||
return this.property('minimized').toBool();
|
||||
}
|
||||
isModal(): boolean {
|
||||
return this.property('modal').toBool();
|
||||
}
|
||||
isVisible(): boolean {
|
||||
return this.native.isVisible();
|
||||
}
|
||||
// TODO: bool isVisibleTo(const QWidget *ancestor) const
|
||||
// TODO: bool isWindow() const
|
||||
// TODO: bool isWindowModified() const
|
||||
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
|
||||
@ -354,7 +369,6 @@ export abstract class NodeWidget<Signals extends QWidgetSignals> extends YogaWid
|
||||
}
|
||||
// TODO: void setWindowFlags(Qt::WindowFlags type)
|
||||
setWindowIcon(icon: QIcon): void {
|
||||
//TODO:getter
|
||||
this.native.setWindowIcon(icon.native);
|
||||
}
|
||||
// TODO: void setWindowModality(Qt::WindowModality windowModality)
|
||||
@ -445,21 +459,29 @@ export abstract class NodeWidget<Signals extends QWidgetSignals> extends YogaWid
|
||||
// react:⛔️
|
||||
this.native.repaint();
|
||||
}
|
||||
// TODO: void setDisabled(bool disable)
|
||||
setDisabled(disable: boolean): void {
|
||||
this.native.setDisabled(disable);
|
||||
}
|
||||
setEnabled(enabled: boolean): void {
|
||||
this.native.setEnabled(enabled);
|
||||
}
|
||||
setFocus(reason = FocusReason.OtherFocusReason): void {
|
||||
this.native.setFocus(reason);
|
||||
}
|
||||
// TODO: void setHidden(bool hidden)
|
||||
setHidden(hidden: boolean): void {
|
||||
this.native.setHidden(hidden);
|
||||
}
|
||||
setStyleSheet(styleSheet: string): void {
|
||||
const preparedSheet = StyleSheet.create(styleSheet);
|
||||
this.native.setStyleSheet(preparedSheet);
|
||||
}
|
||||
// TODO: void setStyleSheet(const QString &styleSheet)
|
||||
// TODO: virtual void setVisible(bool visible)
|
||||
// TODO: void setWindowModified(bool)
|
||||
setVisible(visible: boolean): void {
|
||||
this.native.setVisible(visible);
|
||||
}
|
||||
setWindowModified(modified: boolean): void {
|
||||
this.native.setWindowModified(modified);
|
||||
}
|
||||
setWindowTitle(title: string): void {
|
||||
return this.native.setWindowTitle(title);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user