UNPKG

@dark-engine/platform-desktop

Version:

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

41 lines (40 loc) 1.33 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); exports.detectIsSystemTrayIcon = exports.QDarkSystemTrayIcon = exports.SystemTrayIcon = void 0; const nodegui_1 = require('@nodegui/nodegui'); const core_1 = require('@dark-engine/core'); const factory_1 = require('../factory'); const utils_1 = require('../utils'); const menu_1 = require('./menu'); const SystemTrayIcon = (0, core_1.component)(props => (0, factory_1.qSystemTrayIcon)(props), { displayName: 'SystemTrayIcon', }); exports.SystemTrayIcon = SystemTrayIcon; class QDarkSystemTrayIcon extends nodegui_1.QSystemTrayIcon { constructor() { super(); globalThis.tray = this; } detectIsContainer() { return true; } setVisible(value) { value ? this.show() : this.hide(); } appendChild(child) { if (!(0, menu_1.detectIsMenu)(child)) return console.warn(`SystemTrayIcon supports only Menu as its children`); this.setContextMenu(child); } insertBefore() { (0, utils_1.throwUnsupported)(this); } removeChild() { (0, utils_1.throwUnsupported)(this); } } exports.QDarkSystemTrayIcon = QDarkSystemTrayIcon; function detectIsSystemTrayIcon(value) { return value instanceof QDarkSystemTrayIcon; } exports.detectIsSystemTrayIcon = detectIsSystemTrayIcon; //# sourceMappingURL=system-tray-icon.js.map