UNPKG

@dark-engine/platform-desktop

Version:

Dark renderer to desktop platforms like Windows, Linux, macOS via Nodegui and Qt

43 lines (42 loc) 1.15 kB
import { QDialog, FlexLayout } from '@nodegui/nodegui'; import { component } from '@dark-engine/core'; import { qDialog } from '../factory'; const Dialog = component(props => qDialog(props), { displayName: 'Dialog', }); class QDarkDialog extends QDialog { flexLayout = new 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(); } } function detectIsDialog(value) { return value instanceof QDialog || QDialog.isPrototypeOf(value); } export { Dialog, QDarkDialog, detectIsDialog }; //# sourceMappingURL=dialog.js.map