@@ -20,12 +20,18 @@ class MenuBar
2020
2121 protected string $ label = '' ;
2222
23- protected bool $ onlyShowContextWindow = false ;
23+ protected string $ tooltip = '' ;
24+
25+ protected bool $ resizable = true ;
26+
27+ protected bool $ onlyShowContextMenu = false ;
2428
2529 protected ?Menu $ contextMenu = null ;
2630
2731 protected bool $ alwaysOnTop = false ;
2832
33+ protected ?string $ event = null ;
34+
2935 protected bool $ showDockIcon = false ;
3036
3137 protected Client $ client ;
@@ -51,28 +57,35 @@ public function icon(string $icon): self
5157
5258 public function onlyShowContextMenu (bool $ onlyContextMenu = true ): self
5359 {
54- $ this ->onlyShowContextWindow = $ onlyContextMenu ;
60+ $ this ->onlyShowContextMenu = $ onlyContextMenu ;
5561
5662 return $ this ;
5763 }
5864
59- public function url ( string $ url ): self
65+ public function showDockIcon ( $ value = true ): self
6066 {
61- $ this ->url = $ url ;
67+ $ this ->showDockIcon = $ value ;
6268
6369 return $ this ;
6470 }
6571
66- public function showDockIcon ( $ value = true ): self
72+ public function label ( string $ label = '' ): self
6773 {
68- $ this ->showDockIcon = $ value ;
74+ $ this ->label = $ label ;
6975
7076 return $ this ;
7177 }
7278
73- public function label (string $ label = '' ): self
79+ public function tooltip (string $ tooltip = '' ): self
7480 {
75- $ this ->label = $ label ;
81+ $ this ->tooltip = $ tooltip ;
82+
83+ return $ this ;
84+ }
85+
86+ public function resizable (bool $ resizable = true ): static
87+ {
88+ $ this ->resizable = $ resizable ;
7689
7790 return $ this ;
7891 }
@@ -84,6 +97,13 @@ public function alwaysOnTop($alwaysOnTop = true): self
8497 return $ this ;
8598 }
8699
100+ public function event (string $ event ): self
101+ {
102+ $ this ->event = $ event ;
103+
104+ return $ this ;
105+ }
106+
87107 public function withContextMenu (Menu $ menu ): self
88108 {
89109 $ this ->contextMenu = $ menu ;
@@ -100,15 +120,18 @@ public function toArray(): array
100120 'x ' => $ this ->x ,
101121 'y ' => $ this ->y ,
102122 'label ' => $ this ->label ,
123+ 'tooltip ' => $ this ->tooltip ,
124+ 'resizable ' => $ this ->resizable ,
103125 'width ' => $ this ->width ,
104126 'height ' => $ this ->height ,
105127 'vibrancy ' => $ this ->vibrancy ,
106128 'showDockIcon ' => $ this ->showDockIcon ,
107129 'transparency ' => $ this ->transparent ,
108130 'backgroundColor ' => $ this ->backgroundColor ,
109- 'onlyShowContextWindow ' => $ this ->onlyShowContextWindow ,
131+ 'onlyShowContextMenu ' => $ this ->onlyShowContextMenu ,
110132 'contextMenu ' => ! is_null ($ this ->contextMenu ) ? $ this ->contextMenu ->toArray ()['submenu ' ] : null ,
111133 'alwaysOnTop ' => $ this ->alwaysOnTop ,
134+ 'event ' => $ this ->event ,
112135 ];
113136 }
114137}
0 commit comments