UNPKG

@dark-engine/platform-desktop

Version:

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

33 lines (32 loc) 873 B
import { QMenu } from '@nodegui/nodegui'; import { component } from '@dark-engine/core'; import { qMenu } from '../factory'; import { QDarkAction } from './action'; import { throwUnsupported } from '../utils'; const Menu = component(props => qMenu(props), { displayName: 'Menu' }); class QDarkMenu extends QMenu { detectIsContainer() { return true; } appendChild(child) { if (child instanceof QDarkAction) { this.addAction(child); } else { console.warn('Menu supports only Action as its children!'); throwUnsupported(this); } } insertBefore() { throwUnsupported(this); } removeChild(child) { if (child instanceof QDarkAction) { this.removeAction(child); } } } function detectIsMenu(value) { return value instanceof QDarkMenu; } export { Menu, QDarkMenu, detectIsMenu }; //# sourceMappingURL=menu.js.map