nodeguy/src/lib/QtWidgets/QMenu.ts
Atul R d1e5d499fb
Inherit implemented Qt signals from base classes (#290)
* Adds abstract signals

* basic layout and filedialogs

* Adds all remaining signal heirarchies

* fix lint
2019-12-23 01:26:02 +05:30

33 lines
960 B
TypeScript

import { NativeElement } from '../core/Component';
import { NodeWidget, QWidgetSignals } from './QWidget';
import addon from '../utils/addon';
import { QAction } from './QAction';
export type QMenuSignals = QWidgetSignals;
export class QMenu extends NodeWidget<QMenuSignals> {
native: NativeElement;
actions: Set<QAction>;
constructor();
constructor(parent: NodeWidget<any>);
constructor(parent?: NodeWidget<any>) {
let native;
if (parent) {
native = new addon.QMenu(parent.native);
} else {
native = new addon.QMenu();
}
super(native);
this.native = native;
this.setNodeParent(parent);
this.actions = new Set();
}
setTitle(title: string): void {
this.native.setTitle(title);
}
addAction(action: QAction): QAction {
this.native.addAction(action.native);
this.actions.add(action);
return action;
}
}