UNPKG

@dark-engine/platform-desktop

Version:

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

37 lines (36 loc) 1.03 kB
import { QWidget, FlexLayout as QFlexLayout } from '@nodegui/nodegui'; import { component } from '@dark-engine/core'; import { qFlexLayout } from '../factory'; import { detectIsDialog } from './dialog'; const FlexLayout = component(props => qFlexLayout(props), { displayName: 'FlexLayout', }); class QDarkFlexLayout extends QWidget { flexLayout = new QFlexLayout(); constructor() { super(); this.flexLayout.setFlexNode(this.getFlexNode()); this.setLayout(this.flexLayout); } detectIsContainer() { return true; } 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) { if (detectIsDialog(child)) return; this.flexLayout.removeWidget(child); child.close(); } } export { FlexLayout, QDarkFlexLayout }; //# sourceMappingURL=flex-layout.js.map