8000 MenuBars continued (#420) · NativePHP/laravel@49dee31 · GitHub
[go: up one dir, main page]

Skip to content

Commit 49dee31

Browse files
authored
MenuBars continued (#420)
* Remove `event` prop * Standardise events * Fix styling * Fix class name --------- Co-authored-by: simonhamp <simonhamp@users.noreply.github.com>
1 parent 79f8966 commit 49dee31

File tree

4 files changed

+49
-11
lines changed

4 files changed

+49
-11
lines changed

src/Events/MenuBar/MenuBarClicked.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Native\Laravel\Events\MenuBar;
4+
5+
use Illuminate\Broadcasting\Channel;
6+
use Illuminate\Broadcasting\InteractsWithSockets;
7+
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
8+
use Illuminate\Foundation\Events\Dispatchable;
9+
use Illuminate\Queue\SerializesModels;
10+
11+
class MenuBarClicked implements ShouldBroadcastNow
12+
{
13+
use Dispatchable, InteractsWithSockets, SerializesModels;
14+
15+
public function __construct(public array $combo, public array $bounds, public array $position) {}
16+
17+
public function broadcastOn()
18+
{
19+
return [
20+
new Channel('nativephp'),
21+
];
22+
}
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Native\Laravel\Events\MenuBar;
4+
5+
use Illuminate\Broadcasting\Channel;
6+
use Illuminate\Broadcasting\InteractsWithSockets;
7+
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
8+
use Illuminate\Foundation\Events\Dispatchable;
9+
use Illuminate\Queue\SerializesModels;
10+
11+
class MenuBarDoubleClicked implements ShouldBroadcastNow
12+
{
13+
use Dispatchable, InteractsWithSockets, SerializesModels;
14+
15+
public function __construct(public array $combo, public array $bounds) {}
16+
17+
public function broadcastOn()
18+
{
19+
return [
20+
new Channel('nativephp'),
21+
];
22+
}
23+
}

src/Events/MenuBar/MenuBarContextMenuOpened.php renamed to src/Events/MenuBar/MenuBarRightClicked.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
use Illuminate\Foundation\Events\Dispatchable;
99
use Illuminate\Queue\SerializesModels;
1010

11-
class MenuBarContextMenuOpened implements ShouldBroadcastNow
11+
class MenuBarRightClicked implements ShouldBroadcastNow
1212
{
1313
use Dispatchable, InteractsWithSockets, SerializesModels;
1414

15+
public function __construct(public array $combo, public array $bounds) {}
16+
1517
public function broadcastOn()
1618
{
1719
return [

src/MenuBar/MenuBar.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ class MenuBar
3030

3131
protected bool $alwaysOnTop = false;
3232

33-
protected ?string $event = null;
34-
3533
protected bool $showDockIcon = false;
3634

3735
protected Client $client;
@@ -97,13 +95,6 @@ public function alwaysOnTop($alwaysOnTop = true): self
9795
return $this;
9896
}
9997

100-
public function event(string $event): self
101-
{
102-
$this->event = $event;
103-
104-
return $this;
105-
}
106-
10798
public function withContextMenu(Menu $menu): self
10899
{
109100
$this->contextMenu = $menu;
@@ -131,7 +122,6 @@ public function toArray(): array
131122
'onlyShowContextMenu' => $this->onlyShowContextMenu,
132123
'contextMenu' => ! is_null($this->contextMenu) ? $this->contextMenu->toArray()['submenu'] : null,
133124
'alwaysOnTop' => $this->alwaysOnTop,
134-
'event' => $this->event,
135125
];
136126
}
137127
}

0 commit comments

Comments
 (0)
0