initial commit

This commit is contained in:
yggverse 2024-04-09 09:20:34 +03:00
parent ad638650ac
commit 8c2cf42ca7
16 changed files with 541 additions and 0 deletions

23
src/Menu/Bar/Main.php Normal file
View 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
View 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
View 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
);
}
}