diff --git a/src/cpp/include/nodegui/QtGui/QWindow/qwindow_wrap.h b/src/cpp/include/nodegui/QtGui/QWindow/qwindow_wrap.h index 3576d5c92..08d0e63c1 100644 --- a/src/cpp/include/nodegui/QtGui/QWindow/qwindow_wrap.h +++ b/src/cpp/include/nodegui/QtGui/QWindow/qwindow_wrap.h @@ -40,4 +40,10 @@ class DLL_EXPORT QWindowWrap : public Napi::ObjectWrap, // wrapped methods Napi::Value screen(const Napi::CallbackInfo& info); + Napi::Value showFullScreen(const Napi::CallbackInfo& info); + Napi::Value showMaximized(const Napi::CallbackInfo& info); + Napi::Value showMinimized(const Napi::CallbackInfo& info); + Napi::Value showNormal(const Napi::CallbackInfo& info); + Napi::Value startSystemMove(const Napi::CallbackInfo& info); + Napi::Value startSystemResize(const Napi::CallbackInfo& info); }; diff --git a/src/cpp/lib/QtGui/QWindow/qwindow_wrap.cpp b/src/cpp/lib/QtGui/QWindow/qwindow_wrap.cpp index 023420736..a42b35c2b 100644 --- a/src/cpp/lib/QtGui/QWindow/qwindow_wrap.cpp +++ b/src/cpp/lib/QtGui/QWindow/qwindow_wrap.cpp @@ -9,10 +9,16 @@ Napi::FunctionReference QWindowWrap::constructor; Napi::Object QWindowWrap::init(Napi::Env env, Napi::Object exports) { Napi::HandleScope scope(env); char CLASSNAME[] = "QWindow"; - Napi::Function func = - DefineClass(env, CLASSNAME, - {InstanceMethod("screen", &QWindowWrap::screen), - QOBJECT_WRAPPED_METHODS_EXPORT_DEFINE(QWindowWrap)}); + Napi::Function func = DefineClass( + env, CLASSNAME, + {InstanceMethod("screen", &QWindowWrap::screen), + InstanceMethod("showFullScreen", &QWindowWrap::showFullScreen), + InstanceMethod("showMaximized", &QWindowWrap::showMaximized), + InstanceMethod("showMinimized", &QWindowWrap::showMinimized), + InstanceMethod("showNormal", &QWindowWrap::showNormal), + InstanceMethod("startSystemMove", &QWindowWrap::startSystemMove), + InstanceMethod("startSystemResize", &QWindowWrap::startSystemResize), + QOBJECT_WRAPPED_METHODS_EXPORT_DEFINE(QWindowWrap)}); constructor = Napi::Persistent(func); exports.Set(CLASSNAME, func); return exports; @@ -55,3 +61,40 @@ Napi::Value QWindowWrap::screen(const Napi::CallbackInfo& info) { return env.Null(); } } + +Napi::Value QWindowWrap::showFullScreen(const Napi::CallbackInfo& info) { + Napi::Env env = info.Env(); + this->instance->showFullScreen(); + return env.Null(); +} + +Napi::Value QWindowWrap::showMaximized(const Napi::CallbackInfo& info) { + Napi::Env env = info.Env(); + this->instance->showMaximized(); + return env.Null(); +} + +Napi::Value QWindowWrap::showMinimized(const Napi::CallbackInfo& info) { + Napi::Env env = info.Env(); + this->instance->showMinimized(); + return env.Null(); +} + +Napi::Value QWindowWrap::showNormal(const Napi::CallbackInfo& info) { + Napi::Env env = info.Env(); + this->instance->showNormal(); + return env.Null(); +} + +Napi::Value QWindowWrap::startSystemMove(const Napi::CallbackInfo& info) { + Napi::Env env = info.Env(); + bool result = this->instance->startSystemMove(); + return Napi::Boolean::New(env, result); +} + +Napi::Value QWindowWrap::startSystemResize(const Napi::CallbackInfo& info) { + Napi::Env env = info.Env(); + uint edge = info[0].As().Uint32Value(); + bool result = this->instance->startSystemResize(static_cast(edge)); + return Napi::Boolean::New(env, result); +} diff --git a/src/lib/QtGui/QWindow.ts b/src/lib/QtGui/QWindow.ts index f5cd4b888..a6baff12f 100644 --- a/src/lib/QtGui/QWindow.ts +++ b/src/lib/QtGui/QWindow.ts @@ -3,6 +3,7 @@ import { checkIfNativeElement, registerNativeWrapFunction } from '../utils/helpe import { NodeObject, QObjectSignals } from '../QtCore/QObject'; import { QScreen } from './QScreen'; import { wrapperCache } from '../core/WrapperCache'; +import { Edge } from '../QtEnums'; export class QWindow extends NodeObject { native: NativeElement; @@ -19,6 +20,47 @@ export class QWindow extends NodeObject { screen(): QScreen { return wrapperCache.get(QScreen, this.native.screen()); } + // *** Public Slots *** + // CLASS: QWindow + // TODO: void alert(int msec) + // TODO: bool close() + // TODO: void hide() + // TODO: void lower() + // TODO: void raise() + // TODO: void requestActivate() + // TODO: void requestUpdate() + // TODO: void setGeometry(const QRect &rect) + // TODO: void setGeometry(int posx, int posy, int w, int h) + // TODO: void setHeight(int arg) + // TODO: void setMaximumHeight(int h) + // TODO: void setMaximumWidth(int w) + // TODO: void setMinimumHeight(int h) + // TODO: void setMinimumWidth(int w) + // TODO: void setTitle(const QString &) + // TODO: void setVisible(bool visible) + // TODO: void setWidth(int arg) + // TODO: void setX(int arg) + // TODO: void setY(int arg) + // TODO: void show() + + showFullScreen(): void { + this.native.showFullScreen(); + } + showMaximized(): void { + this.native.showMaximized(); + } + showMinimized(): void { + this.native.showMinimized(); + } + showNormal(): void { + this.native.showNormal(); + } + startSystemMove(): boolean { + return this.native.startSystemMove(); + } + startSystemResize(edges: Edge): boolean { + return this.native.startSystemResize(edges); + } } export interface QWindowSignals extends QObjectSignals {