@dark-engine/platform-desktop
Version:
Dark renderer to desktop platforms like Windows, Linux, macOS via Nodegui and Qt
48 lines (47 loc) • 1.41 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
exports.detectIsDialog = exports.QDarkDialog = exports.Dialog = void 0;
const nodegui_1 = require('@nodegui/nodegui');
const core_1 = require('@dark-engine/core');
const factory_1 = require('../factory');
const Dialog = (0, core_1.component)(props => (0, factory_1.qDialog)(props), {
displayName: 'Dialog',
});
exports.Dialog = Dialog;
class QDarkDialog extends nodegui_1.QDialog {
flexLayout = new nodegui_1.FlexLayout();
constructor() {
super();
this.setMinimumWidth(10);
this.setMinimumHeight(10);
this.flexLayout.setFlexNode(this.getFlexNode());
this.setLayout(this.flexLayout);
}
detectIsContainer() {
return true;
}
setOpen(value) {
value ? this.open() : this.close();
}
getFlexLayout() {
return this.flexLayout;
}
appendChild(child) {
if (detectIsDialog(child)) return;
this.flexLayout.addWidget(child);
}
insertBefore(child, sibling) {
if (detectIsDialog(child)) return;
this.flexLayout.insertChildBefore(child, sibling);
}
removeChild(child) {
this.flexLayout.removeWidget(child);
child.close();
}
}
exports.QDarkDialog = QDarkDialog;
function detectIsDialog(value) {
return value instanceof nodegui_1.QDialog || nodegui_1.QDialog.isPrototypeOf(value);
}
exports.detectIsDialog = detectIsDialog;
//# sourceMappingURL=dialog.js.map