Re arrange folders to make more sense (#180)
* Re-arranged qtgui and core * Re arranges qt widgets
This commit is contained in:
parent
f56bf965ee
commit
6035b5d038
@ -1,4 +1,4 @@
|
||||
import { EventWidget } from '../../core/EventWidget';
|
||||
import { EventWidget } from '../core/EventWidget';
|
||||
|
||||
export abstract class QObject extends EventWidget {
|
||||
inherits(className: string): boolean {
|
||||
@ -1,7 +1,7 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { Component, NativeElement } from '../../core/Component';
|
||||
import { checkIfNativeElement } from '../../utils/helpers';
|
||||
import { QClipboard } from '../QClipboard';
|
||||
import addon from '../utils/addon';
|
||||
import { Component, NativeElement } from '../core/Component';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { QClipboard } from './QClipboard';
|
||||
|
||||
type arg = NativeElement;
|
||||
export class QApplication extends Component {
|
||||
@ -1,5 +1,5 @@
|
||||
import { Component, NativeElement } from '../../core/Component';
|
||||
import { checkIfNativeElement } from '../../utils/helpers';
|
||||
import { Component, NativeElement } from '../core/Component';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
|
||||
export class QClipboard extends Component {
|
||||
native: NativeElement;
|
||||
@ -1,6 +1,6 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { Component, NativeElement } from '../../core/Component';
|
||||
import { QPixmap } from '../QPixmap';
|
||||
import addon from '../utils/addon';
|
||||
import { Component, NativeElement } from '../core/Component';
|
||||
import { QPixmap } from './QPixmap';
|
||||
|
||||
type arg = NativeElement | number | QPixmap;
|
||||
export class QCursor extends Component {
|
||||
@ -1,6 +1,6 @@
|
||||
import addon from '../../../utils/addon';
|
||||
import { NativeElement } from '../../../core/Component';
|
||||
import { NativeEvent } from '../../../core/EventWidget';
|
||||
import addon from '../../utils/addon';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { NativeEvent } from '../../core/EventWidget';
|
||||
|
||||
export class QKeyEvent {
|
||||
native: NativeElement;
|
||||
@ -1,6 +1,6 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { Component, NativeElement } from '../../core/Component';
|
||||
import { QPixmap } from '../../QtGui/QPixmap';
|
||||
import addon from '../utils/addon';
|
||||
import { Component, NativeElement } from '../core/Component';
|
||||
import { QPixmap } from './QPixmap';
|
||||
|
||||
export enum QIconMode {
|
||||
Normal,
|
||||
@ -1,5 +1,5 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { Component, NativeElement } from '../../core/Component';
|
||||
import addon from '../utils/addon';
|
||||
import { Component, NativeElement } from '../core/Component';
|
||||
|
||||
export class QKeySequence extends Component {
|
||||
native: NativeElement;
|
||||
@ -1,7 +1,7 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { Component, NativeElement } from '../../core/Component';
|
||||
import { AspectRatioMode } from '../../QtEnums';
|
||||
import { checkIfNativeElement } from '../../utils/helpers';
|
||||
import addon from '../utils/addon';
|
||||
import { Component, NativeElement } from '../core/Component';
|
||||
import { AspectRatioMode } from '../QtEnums';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
|
||||
export type ImageFormats = 'BMP' | 'GIF' | 'JPG' | 'JPEG' | 'PNG' | 'PBM' | 'PGM' | 'PPM' | 'XBM' | 'XPM';
|
||||
export type ReadWriteImageFormats = 'BMP' | 'JPG' | 'JPEG' | 'PNG' | 'PBM' | 'XBM' | 'XPM';
|
||||
@ -1,4 +1,4 @@
|
||||
import { NodeWidget, QWidget } from '../QWidget';
|
||||
import { NodeWidget, QWidget } from './QWidget';
|
||||
|
||||
export abstract class QAbstractScrollArea extends NodeWidget {
|
||||
viewportWidget?: NodeWidget;
|
||||
@ -1,5 +1,5 @@
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { Orientation } from '../../QtEnums';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { Orientation } from '../QtEnums';
|
||||
|
||||
export abstract class QAbstractSlider extends NodeWidget {
|
||||
setSingleStep(step: number): void {
|
||||
@ -1,11 +1,11 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { QMenu } from '../QMenu';
|
||||
import { QIcon } from '../../QtGui/QIcon';
|
||||
import { QKeySequence } from '../../QtGui/QKeySequence';
|
||||
import { ShortcutContext } from '../../QtEnums';
|
||||
import { QObject } from '../../QtCore/QObject';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QMenu } from './QMenu';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
import { QKeySequence } from '../QtGui/QKeySequence';
|
||||
import { ShortcutContext } from '../QtEnums';
|
||||
import { QObject } from '../QtCore/QObject';
|
||||
|
||||
export const QActionEvents = Object.freeze({
|
||||
triggered: 'triggered',
|
||||
@ -1,7 +1,7 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
|
||||
export const QCheckBoxEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -1,8 +1,8 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { QAbstractSlider } from '../QAbstractSlider';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QAbstractSlider } from './QAbstractSlider';
|
||||
|
||||
export const QDialEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -1,7 +1,7 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { NodeLayout } from '../QLayout';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeLayout } from './QLayout';
|
||||
import { NativeElement } from '../core/Component';
|
||||
|
||||
export class QGridLayout extends NodeLayout {
|
||||
native: NativeElement;
|
||||
@ -1,8 +1,8 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { QPixmap } from '../../QtGui/QPixmap';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QPixmap } from '../QtGui/QPixmap';
|
||||
|
||||
export const QLabelEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -1,5 +1,5 @@
|
||||
import { Component } from '../../core/Component';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { Component } from '../core/Component';
|
||||
import { NodeWidget } from './QWidget';
|
||||
|
||||
// All Layouts should extend this abstract class.
|
||||
export abstract class NodeLayout extends Component {
|
||||
@ -1,7 +1,7 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
|
||||
export const QLineEditEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -1,9 +1,9 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { NodeLayout } from '../QLayout';
|
||||
import { QMenuBar } from '../QMenuBar';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { NodeLayout } from './QLayout';
|
||||
import { QMenuBar } from './QMenuBar';
|
||||
|
||||
export const QMainWindowEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -22,8 +22,7 @@ export class QMainWindow extends NodeWidget {
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.nodeParent = parent;
|
||||
// bind member functions
|
||||
this.setCentralWidget.bind(this);
|
||||
|
||||
this.setLayout = (parentLayout: NodeLayout): void => {
|
||||
if (this.centralWidget) {
|
||||
this.centralWidget.setLayout(parentLayout);
|
||||
@ -1,9 +1,9 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { QAbstractScrollArea } from '../QAbstractScrollArea';
|
||||
import { QTextOptionWrapMode } from '../../QtGui/QTextOption';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QAbstractScrollArea } from './QAbstractScrollArea';
|
||||
import { QTextOptionWrapMode } from '../QtGui/QTextOption';
|
||||
|
||||
export const QPlainTextEditEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -1,8 +1,8 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { Orientation } from '../../QtEnums';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { Orientation } from '../QtEnums';
|
||||
|
||||
export const QProgressBarEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -1,8 +1,8 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { QIcon } from '../../QtGui/QIcon';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
|
||||
export const QPushButtonEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -1,7 +1,7 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
|
||||
export const QRadioButtonEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -18,8 +18,6 @@ export class QRadioButton extends NodeWidget {
|
||||
super(native);
|
||||
this.native = native;
|
||||
this.nodeParent = parent;
|
||||
// bind member functions
|
||||
this.setText.bind(this);
|
||||
}
|
||||
setText(text: string | number): void {
|
||||
// react:✓ TODO://getter
|
||||
@ -1,8 +1,8 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { QAbstractScrollArea } from '../QAbstractScrollArea';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QAbstractScrollArea } from './QAbstractScrollArea';
|
||||
|
||||
export const QScrollAreaEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -1,9 +1,9 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { QKeySequence } from '../../QtGui/QKeySequence';
|
||||
import { ShortcutContext } from '../../QtEnums';
|
||||
import { QObject } from '../../QtCore/QObject';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QKeySequence } from '../QtGui/QKeySequence';
|
||||
import { ShortcutContext } from '../QtEnums';
|
||||
import { QObject } from '../QtCore/QObject';
|
||||
|
||||
export const QShortcutEvents = Object.freeze({
|
||||
activated: 'activated',
|
||||
@ -1,7 +1,7 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
|
||||
export const QSpinBoxEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -1,10 +1,10 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { QIcon } from '../../QtGui/QIcon';
|
||||
import { QMenu } from '../QMenu';
|
||||
import { QObject } from '../../QtCore/QObject';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
import { QMenu } from './QMenu';
|
||||
import { QObject } from '../QtCore/QObject';
|
||||
|
||||
export const QSystemTrayIconEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -1,9 +1,9 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { QIcon } from '../../QtGui/QIcon';
|
||||
import { TabPosition } from '../../QtEnums';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
import { TabPosition } from '../QtEnums';
|
||||
|
||||
export const QTabWidgetEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
@ -25,8 +25,6 @@ export class QTabWidget extends NodeWidget {
|
||||
super(native);
|
||||
this.nodeParent = parent;
|
||||
this.native = native;
|
||||
// bind member functions
|
||||
this.addTab.bind(this);
|
||||
}
|
||||
|
||||
addTab(page: NodeWidget, icon: QIcon, label: string): void {
|
||||
@ -1,15 +1,15 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeLayout } from '../QLayout';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
import { NativeElement } from '../../core/Component';
|
||||
import { FlexLayout } from '../../core/FlexLayout';
|
||||
import { WidgetAttribute, WindowType } from '../../QtEnums';
|
||||
import { QIcon } from '../../QtGui/QIcon';
|
||||
import { QCursor } from '../../QtGui/QCursor';
|
||||
import { CursorShape, WindowState } from '../../QtEnums';
|
||||
import { applyStyleSheet, StyleSheet, prepareInlineStyleSheet } from '../../core/Style/StyleSheet';
|
||||
import { checkIfNativeElement } from '../../utils/helpers';
|
||||
import { YogaWidget } from '../../core/YogaWidget';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeLayout } from './QLayout';
|
||||
import { BaseWidgetEvents } from '../core/EventWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { FlexLayout } from '../core/FlexLayout';
|
||||
import { WidgetAttribute, WindowType } from '../QtEnums';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
import { QCursor } from '../QtGui/QCursor';
|
||||
import { CursorShape, WindowState } from '../QtEnums';
|
||||
import { applyStyleSheet, StyleSheet, prepareInlineStyleSheet } from '../core/Style/StyleSheet';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { YogaWidget } from '../core/YogaWidget';
|
||||
// All Widgets should extend from NodeWidget
|
||||
// Implement all native QWidget methods here so that all widgets get access to those aswell
|
||||
export abstract class NodeWidget extends YogaWidget {
|
||||
@ -1,10 +1,10 @@
|
||||
const { QLabel } = require('./index');
|
||||
const { QPixmap } = require('../../QtGui/QPixmap');
|
||||
import { QLabel } from '../QLabel';
|
||||
import { QPixmap } from '../../QtGui/QPixmap';
|
||||
|
||||
describe('QLabel', () => {
|
||||
let label = new QLabel();
|
||||
const label = new QLabel();
|
||||
afterAll(() => {
|
||||
label.close();
|
||||
label = null;
|
||||
});
|
||||
it('instantiate a label instance', () => {
|
||||
const label = new QLabel();
|
||||
@ -1,11 +1,10 @@
|
||||
const { QMainWindow } = require('./index');
|
||||
const { QWidget } = require('../QWidget');
|
||||
import { QMainWindow } from '../QMainWindow';
|
||||
import { QWidget } from '../QWidget';
|
||||
|
||||
describe('QMainWindow', () => {
|
||||
let win = new QMainWindow();
|
||||
const win = new QMainWindow();
|
||||
afterAll(() => {
|
||||
win.close();
|
||||
win = null;
|
||||
});
|
||||
it('should be able to instantiate a window instance', () => {
|
||||
const win = new QMainWindow();
|
||||
@ -1,4 +1,4 @@
|
||||
import { QWidget } from '.';
|
||||
import { QWidget } from '../QWidget';
|
||||
|
||||
describe('QWidget', () => {
|
||||
const view = new QWidget();
|
||||
@ -1,5 +1,5 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import { NativeElement, Component } from '../Component';
|
||||
import { NativeElement, Component } from './Component';
|
||||
|
||||
export type NativeEvent = {};
|
||||
export abstract class EventWidget extends Component {
|
||||
@ -1,8 +1,8 @@
|
||||
import addon from '../../utils/addon';
|
||||
import { NodeWidget } from '../../QtWidgets/QWidget';
|
||||
import { NodeLayout } from '../../QtWidgets/QLayout';
|
||||
import { FlexNode } from '../YogaWidget';
|
||||
import { NativeElement } from '../Component';
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from '../QtWidgets/QWidget';
|
||||
import { NodeLayout } from '../QtWidgets/QLayout';
|
||||
import { FlexNode } from './YogaWidget';
|
||||
import { NativeElement } from './Component';
|
||||
|
||||
export class FlexLayout extends NodeLayout {
|
||||
native: NativeElement = new addon.FlexLayout();
|
||||
@ -1,4 +1,4 @@
|
||||
import { QObject } from '../../QtCore/QObject';
|
||||
import { QObject } from '../QtCore/QObject';
|
||||
|
||||
export type FlexNode = {};
|
||||
export abstract class YogaWidget extends QObject {
|
||||
@ -33,8 +33,8 @@ EventWidget adds `addEventListener` method to the widget which can be called
|
||||
like this:
|
||||
|
||||
```js
|
||||
button.addEventListener("clicked", () => {
|
||||
console.log("clicked");
|
||||
button.addEventListener('clicked', () => {
|
||||
console.log('clicked');
|
||||
});
|
||||
```
|
||||
|
||||
@ -44,44 +44,42 @@ So the user can then use it as below:
|
||||
|
||||
```js
|
||||
button.addEventListener(QPushButtonEvents.clicked, () => {
|
||||
console.log("clicked");
|
||||
console.log('clicked');
|
||||
});
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
import addon from "../../core/addon";
|
||||
import { NodeWidget } from "../../QtGui/QWidget";
|
||||
import { BaseWidgetEvents } from "../../core/EventWidget";
|
||||
import addon from '../../core/addon';
|
||||
import { NodeWidget } from '../../QtGui/QWidget';
|
||||
import { BaseWidgetEvents } from '../../core/EventWidget';
|
||||
|
||||
export const QPushButtonEvents = Object.freeze({
|
||||
...BaseWidgetEvents,
|
||||
clicked: "clicked",
|
||||
pressed: "pressed",
|
||||
released: "released",
|
||||
toggled: "toggled"
|
||||
...BaseWidgetEvents,
|
||||
clicked: 'clicked',
|
||||
pressed: 'pressed',
|
||||
released: 'released',
|
||||
toggled: 'toggled',
|
||||
});
|
||||
|
||||
export class QPushButton extends NodeWidget {
|
||||
native: NativeElement;
|
||||
constructor(parent?: NodeWidget) {
|
||||
let native;
|
||||
if (parent) {
|
||||
native = new addon.QPushButton(parent.native);
|
||||
} else {
|
||||
native = new addon.QPushButton();
|
||||
native: NativeElement;
|
||||
constructor(parent?: NodeWidget) {
|
||||
let native;
|
||||
if (parent) {
|
||||
native = new addon.QPushButton(parent.native);
|
||||
} else {
|
||||
native = new addon.QPushButton();
|
||||
}
|
||||
super(native);
|
||||
this.parent = parent;
|
||||
this.native = native;
|
||||
}
|
||||
super(native);
|
||||
this.parent = parent;
|
||||
this.native = native;
|
||||
// bind member functions
|
||||
this.setText.bind(this);
|
||||
}
|
||||
|
||||
setText(text: string | number) {
|
||||
this.native.setText(`${text}`);
|
||||
}
|
||||
setText(text: string | number) {
|
||||
this.native.setText(`${text}`);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user