Yoda/src/Entity/Browser/Menu/Tab.php
2024-07-21 19:35:41 +03:00

65 lines
No EOL
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Menu;
use \Yggverse\Yoda\Entity\Browser\Menu;
use \Yggverse\Yoda\Entity\Browser\Menu\Tab\Add;
use \Yggverse\Yoda\Entity\Browser\Menu\Tab\Close;
class Tab
{
public \GtkMenuItem $gtk;
// Dependencies
public Menu $menu;
// Requirements
public Add $add;
public Close $close;
// Defaults
public const LABEL = 'Tab';
public function __construct(
Menu $menu
) {
// Init dependencies
$this->menu = $menu;
// Init menu item
$this->gtk = \GtkMenuItem::new_with_label(
$this::LABEL
);
// Init submenu container
$tab = new \GtkMenu;
// Init new tab menu item
$this->add = new Add(
$this
);
$tab->append(
$this->add->gtk
);
// Init close tab menu item
$this->close = new Close(
$this
);
$tab->append(
$this->close->gtk
);
$this->gtk->set_submenu(
$tab
);
// Render
$this->gtk->show();
}
}