Browse Source

init file menu

PHP-GTK3
yggverse 5 months ago
parent
commit
e8ef19a235
  1. 11
      src/Entity/Browser/Menu.php
  2. 49
      src/Entity/Browser/Menu/File.php
  3. 31
      src/Entity/Browser/Menu/File/Open.php

11
src/Entity/Browser/Menu.php

@ -4,6 +4,7 @@ declare(strict_types=1); @@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser;
use \Yggverse\Yoda\Entity\Browser\Menu\File;
use \Yggverse\Yoda\Entity\Browser\Menu\Tab;
use \Yggverse\Yoda\Entity\Browser\Menu\History;
use \Yggverse\Yoda\Entity\Browser\Menu\Quit;
@ -16,6 +17,7 @@ class Menu @@ -16,6 +17,7 @@ class Menu
public \Yggverse\Yoda\Entity\Browser $browser;
// Requirements
public \Yggverse\Yoda\Entity\Browser\Menu\File $file;
public \Yggverse\Yoda\Entity\Browser\Menu\Tab $tab;
public \Yggverse\Yoda\Entity\Browser\Menu\History $history;
public \Yggverse\Yoda\Entity\Browser\Menu\Quit $quit;
@ -29,6 +31,15 @@ class Menu @@ -29,6 +31,15 @@ class Menu
// Init menu
$this->gtk = new \GtkMenu;
// Init file menu item
$this->file = new File(
$this
);
$this->gtk->append(
$this->file->gtk
);
// Init tab menu item
$this->tab = new Tab(
$this

49
src/Entity/Browser/Menu/File.php

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Menu;
use \Yggverse\Yoda\Entity\Browser\Menu\File\Open;
class File
{
public \GtkMenuItem $gtk;
// Dependencies
public \Yggverse\Yoda\Entity\Browser\Menu $menu;
// Defaults
private string $_label = 'File';
public function __construct(
\Yggverse\Yoda\Entity\Browser\Menu $menu
) {
// Init dependencies
$this->menu = $menu;
// Init menu item
$this->gtk = \GtkMenuItem::new_with_label(
$this->_label
);
// Init submenu container
$file = new \GtkMenu;
// Init new tab menu item
$open = new Open(
$this
);
$file->append(
$open->gtk
);
$this->gtk->set_submenu(
$file
);
// Render
$this->gtk->show();
}
}

31
src/Entity/Browser/Menu/File/Open.php

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Menu\File;
class Open
{
public \GtkMenuItem $gtk;
// Dependencies
public \Yggverse\Yoda\Entity\Browser\Menu\File $file;
// Defaults
private string $_label = 'File';
public function __construct(
\Yggverse\Yoda\Entity\Browser\Menu\File $file
) {
// Init dependencies
$this->file = $file;
// Init menu item
$this->gtk = \GtkMenuItem::new_with_label(
$this->_label
);
// Render
$this->gtk->show();
}
}
Loading…
Cancel
Save