mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
initial commit
This commit is contained in:
parent
ad638650ac
commit
8c2cf42ca7
16 changed files with 541 additions and 0 deletions
23
src/Menu/Bar/Main.php
Normal file
23
src/Menu/Bar/Main.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yggverse\Yoda\Menu\Bar;
|
||||
|
||||
class Main
|
||||
{
|
||||
public \GtkMenuBar $bar;
|
||||
|
||||
public \Yggverse\Yoda\Menu\Item\Yoda $yoda;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bar = new \GtkMenuBar();
|
||||
|
||||
$this->yoda = new \Yggverse\Yoda\Menu\Item\Yoda();
|
||||
|
||||
$this->bar->append(
|
||||
$this->yoda->item
|
||||
);
|
||||
}
|
||||
}
|
||||
30
src/Menu/Item/Quit.php
Normal file
30
src/Menu/Item/Quit.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yggverse\Yoda\Menu\Item;
|
||||
|
||||
class Quit
|
||||
{
|
||||
public \GtkMenuItem $item;
|
||||
|
||||
public function __construct(string $label = 'Quit')
|
||||
{
|
||||
$this->item = \GtkMenuItem::new_with_label(
|
||||
$label
|
||||
);
|
||||
|
||||
$this->activate();
|
||||
}
|
||||
|
||||
public function activate(): void
|
||||
{
|
||||
$this->item->connect(
|
||||
'activate',
|
||||
function ()
|
||||
{
|
||||
\Gtk::main_quit();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
29
src/Menu/Item/Yoda.php
Normal file
29
src/Menu/Item/Yoda.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yggverse\Yoda\Menu\Item;
|
||||
|
||||
class Yoda
|
||||
{
|
||||
public \GtkMenuItem $item;
|
||||
|
||||
public function __construct(string $label = 'Yoda')
|
||||
{
|
||||
$this->item = \GtkMenuItem::new_with_label(
|
||||
$label
|
||||
);
|
||||
|
||||
$children = new \GtkMenu();
|
||||
|
||||
$quit = new \Yggverse\Yoda\Menu\Item\Quit();
|
||||
|
||||
$children->append(
|
||||
$quit->item
|
||||
);
|
||||
|
||||
$this->item->set_submenu(
|
||||
$children
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue