1 | /// <reference types="node" />
|
2 | import { EventEmitter } from 'events';
|
3 | import { BrowserWindow, Tray } from 'electron';
|
4 | import Positioner from 'electron-positioner';
|
5 | import type { Options } from './types';
|
6 | /**
|
7 | * The main Menubar class.
|
8 | *
|
9 | * @noInheritDoc
|
10 | */
|
11 | export declare class Menubar extends EventEmitter {
|
12 | private _app;
|
13 | private _browserWindow?;
|
14 | private _blurTimeout;
|
15 | private _isVisible;
|
16 | private _cachedBounds?;
|
17 | private _options;
|
18 | private _positioner;
|
19 | private _tray?;
|
20 | constructor(app: Electron.App, options?: Partial<Options>);
|
21 | /**
|
22 | * The Electron [App](https://electronjs.org/docs/api/app)
|
23 | * instance.
|
24 | */
|
25 | get app(): Electron.App;
|
26 | /**
|
27 | * The [electron-positioner](https://github.com/jenslind/electron-positioner)
|
28 | * instance.
|
29 | */
|
30 | get positioner(): Positioner;
|
31 | /**
|
32 | * The Electron [Tray](https://electronjs.org/docs/api/tray) instance.
|
33 | */
|
34 | get tray(): Tray;
|
35 | /**
|
36 | * The Electron [BrowserWindow](https://electronjs.org/docs/api/browser-window)
|
37 | * instance, if it's present.
|
38 | */
|
39 | get window(): BrowserWindow | undefined;
|
40 | /**
|
41 | * Retrieve a menubar option.
|
42 | *
|
43 | * @param key - The option key to retrieve, see {@link Options}.
|
44 | */
|
45 | getOption<K extends keyof Options>(key: K): Options[K];
|
46 | /**
|
47 | * Hide the menubar window.
|
48 | */
|
49 | hideWindow(): void;
|
50 | /**
|
51 | * Change an option after menubar is created.
|
52 | *
|
53 | * @param key - The option key to modify, see {@link Options}.
|
54 | * @param value - The value to set.
|
55 | */
|
56 | setOption<K extends keyof Options>(key: K, value: Options[K]): void;
|
57 | /**
|
58 | * Show the menubar window.
|
59 | *
|
60 | * @param trayPos - The bounds to show the window in.
|
61 | */
|
62 | showWindow(trayPos?: Electron.Rectangle): Promise<void>;
|
63 | private appReady;
|
64 | /**
|
65 | * Callback on tray icon click or double-click.
|
66 | *
|
67 | * @param e
|
68 | * @param bounds
|
69 | */
|
70 | private clicked;
|
71 | private createWindow;
|
72 | private windowClear;
|
73 | }
|
74 |
|
\ | No newline at end of file |