diff --git a/src/MenuBar/MenuBar.php b/src/MenuBar/MenuBar.php index 9885233..cfc2873 100644 --- a/src/MenuBar/MenuBar.php +++ b/src/MenuBar/MenuBar.php @@ -20,12 +20,18 @@ class MenuBar protected string $label = ''; - protected bool $onlyShowContextWindow = false; + protected string $tooltip = ''; + + protected bool $resizable = true; + + protected bool $onlyShowContextMenu = false; protected ?Menu $contextMenu = null; protected bool $alwaysOnTop = false; + protected ?string $event = null; + protected bool $showDockIcon = false; protected Client $client; @@ -51,28 +57,35 @@ public function icon(string $icon): self public function onlyShowContextMenu(bool $onlyContextMenu = true): self { - $this->onlyShowContextWindow = $onlyContextMenu; + $this->onlyShowContextMenu = $onlyContextMenu; return $this; } - public function url(string $url): self + public function showDockIcon($value = true): self { - $this->url = $url; + $this->showDockIcon = $value; return $this; } - public function showDockIcon($value = true): self + public function label(string $label = ''): self { - $this->showDockIcon = $value; + $this->label = $label; return $this; } - public function label(string $label = ''): self + public function tooltip(string $tooltip = ''): self { - $this->label = $label; + $this->tooltip = $tooltip; + + return $this; + } + + public function resizable(bool $resizable = true): static + { + $this->resizable = $resizable; return $this; } @@ -84,6 +97,13 @@ public function alwaysOnTop($alwaysOnTop = true): self return $this; } + public function event(string $event): self + { + $this->event = $event; + + return $this; + } + public function withContextMenu(Menu $menu): self { $this->contextMenu = $menu; @@ -100,15 +120,18 @@ public function toArray(): array 'x' => $this->x, 'y' => $this->y, 'label' => $this->label, + 'tooltip' => $this->tooltip, + 'resizable' => $this->resizable, 'width' => $this->width, 'height' => $this->height, 'vibrancy' => $this->vibrancy, 'showDockIcon' => $this->showDockIcon, 'transparency' => $this->transparent, 'backgroundColor' => $this->backgroundColor, - 'onlyShowContextWindow' => $this->onlyShowContextWindow, + 'onlyShowContextMenu' => $this->onlyShowContextMenu, 'contextMenu' => ! is_null($this->contextMenu) ? $this->contextMenu->toArray()['submenu'] : null, 'alwaysOnTop' => $this->alwaysOnTop, + 'event' => $this->event, ]; } } diff --git a/src/MenuBar/MenuBarManager.php b/src/MenuBar/MenuBarManager.php index 04aedb0..b10992d 100644 --- a/src/MenuBar/MenuBarManager.php +++ b/src/MenuBar/MenuBarManager.php @@ -31,6 +31,20 @@ public function label(string $label) ]); } + public function tooltip(string $tooltip) + { + $this->client->post('menu-bar/tooltip', [ + 'tooltip' => $tooltip, + ]); + } + + public function icon(string $icon) + { + $this->client->post('menu-bar/icon', [ + 'icon' => $icon, + ]); + } + public function contextMenu(Menu $contextMenu) { $this->client->post('menu-bar/context-menu', [