From e8ef19a23573bfb25ddc65d93c74b2b6b4e96d3c Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 8 Jul 2024 19:38:04 +0300 Subject: [PATCH] init file menu --- src/Entity/Browser/Menu.php | 11 ++++++ src/Entity/Browser/Menu/File.php | 49 +++++++++++++++++++++++++++ src/Entity/Browser/Menu/File/Open.php | 31 +++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 src/Entity/Browser/Menu/File.php create mode 100644 src/Entity/Browser/Menu/File/Open.php diff --git a/src/Entity/Browser/Menu.php b/src/Entity/Browser/Menu.php index 5cc99db7..623ab445 100644 --- a/src/Entity/Browser/Menu.php +++ b/src/Entity/Browser/Menu.php @@ -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 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 // 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 diff --git a/src/Entity/Browser/Menu/File.php b/src/Entity/Browser/Menu/File.php new file mode 100644 index 00000000..13faff02 --- /dev/null +++ b/src/Entity/Browser/Menu/File.php @@ -0,0 +1,49 @@ +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(); + } +} \ No newline at end of file diff --git a/src/Entity/Browser/Menu/File/Open.php b/src/Entity/Browser/Menu/File/Open.php new file mode 100644 index 00000000..1b83b3d8 --- /dev/null +++ b/src/Entity/Browser/Menu/File/Open.php @@ -0,0 +1,31 @@ +file = $file; + + // Init menu item + $this->gtk = \GtkMenuItem::new_with_label( + $this->_label + ); + + // Render + $this->gtk->show(); + } +} \ No newline at end of file