diff --git a/src/Entity/Browser/Header.php b/src/Entity/Browser/Header.php index 74cfd285..4d96b7a7 100644 --- a/src/Entity/Browser/Header.php +++ b/src/Entity/Browser/Header.php @@ -4,19 +4,18 @@ declare(strict_types=1); namespace Yggverse\Yoda\Entity\Browser; -use \Yggverse\Yoda\Entity\Browser\Header\Navigation; -use \Yggverse\Yoda\Entity\Browser\Header\Tab; +use \Yggverse\Yoda\Entity\Browser; +use \Yggverse\Yoda\Entity\Browser\Header\Tray; class Header { public \GtkHeaderBar $gtk; // Dependencies - public \Yggverse\Yoda\Entity\Browser $browser; + public Browser $browser; // Requirements - public Navigation $navigation; - public Tab $tab; + public Tray $tray; // Defaults protected bool $_actions = true; @@ -24,7 +23,7 @@ class Header protected string $_subtitle = ''; public function __construct( - \Yggverse\Yoda\Entity\Browser $browser + Browser $browser ) { // Init dependencies $this->browser = $browser; @@ -44,22 +43,13 @@ class Header $this->_subtitle ); - // Init navigation - $this->navigation = new Navigation( + // Init tray area + $this->tray = new Tray( $this ); $this->gtk->add( - $this->navigation->gtk - ); - - // Init new tab button - $this->tab = new Tab( - $this - ); - - $this->gtk->add( - $this->tab->gtk + $this->tray->gtk ); // Render diff --git a/src/Entity/Browser/Header/Tray.php b/src/Entity/Browser/Header/Tray.php new file mode 100644 index 00000000..c5c5c8bc --- /dev/null +++ b/src/Entity/Browser/Header/Tray.php @@ -0,0 +1,65 @@ +header = $header; + + // Init header + $this->gtk = new \GtkBox( + \GtkOrientation::HORIZONTAL + ); + + $this->gtk->set_spacing( + $this->_margin + ); + + // Init navigation + $this->navigation = new Navigation( + $this + ); + + $this->gtk->add( + $this->navigation->gtk + ); + + // Init new tab button + $this->tab = new Tab( + $this + ); + + $this->gtk->add( + $this->tab->gtk + ); + + // Render + $this->gtk->show(); + } +} \ No newline at end of file diff --git a/src/Entity/Browser/Header/Navigation.php b/src/Entity/Browser/Header/Tray/Navigation.php similarity index 76% rename from src/Entity/Browser/Header/Navigation.php rename to src/Entity/Browser/Header/Tray/Navigation.php index 17a6abb4..c4624713 100644 --- a/src/Entity/Browser/Header/Navigation.php +++ b/src/Entity/Browser/Header/Tray/Navigation.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Yggverse\Yoda\Entity\Browser\Header; +namespace Yggverse\Yoda\Entity\Browser\Header\Tray; -use \Yggverse\Yoda\Entity\Browser\Header; +use \Yggverse\Yoda\Entity\Browser\Header\Tray; use \Yggverse\Yoda\Entity\Browser\Menu; class Navigation @@ -12,7 +12,7 @@ class Navigation public \GtkMenuButton $gtk; // Dependencies - public Header $header; + public Tray $tray; // Requirements public Menu $menu; @@ -21,10 +21,10 @@ class Navigation private string $_tooltip = 'Navigation'; public function __construct( - Header $header + Tray $tray ) { // Init dependencies - $this->header = $header; + $this->tray = $tray; // Init navigation container $this->gtk = new \GtkMenuButton; @@ -35,7 +35,7 @@ class Navigation // Init menu $this->menu = new Menu( - $this->header->browser + $this->tray->header->browser ); $this->gtk->set_popup( diff --git a/src/Entity/Browser/Header/Tab.php b/src/Entity/Browser/Header/Tray/Tab.php similarity index 76% rename from src/Entity/Browser/Header/Tab.php rename to src/Entity/Browser/Header/Tray/Tab.php index 780da06f..d2855d60 100644 --- a/src/Entity/Browser/Header/Tab.php +++ b/src/Entity/Browser/Header/Tray/Tab.php @@ -2,26 +2,26 @@ declare(strict_types=1); -namespace Yggverse\Yoda\Entity\Browser\Header; +namespace Yggverse\Yoda\Entity\Browser\Header\Tray; -use \Yggverse\Yoda\Entity\Browser\Header; +use \Yggverse\Yoda\Entity\Browser\Header\Tray; class Tab { public \GtkButton $gtk; // Dependencies - public Header $header; + public Tray $tray; // Defaults protected string $_label = '+'; private string $_tooltip = 'New tab'; public function __construct( - Header $header + Tray $tray ) { // Init dependency - $this->header = $header; + $this->tray = $tray; // Init GTK $this->gtk = new \GtkButton; @@ -43,7 +43,7 @@ class Tab function( \GtkButton $entity ) { - $this->header->browser->container->tab->append( + $this->tray->header->browser->container->tab->append( null, false );