mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
use tray container for header elements
This commit is contained in:
parent
5edba96a3c
commit
c1a9f9aecf
4 changed files with 85 additions and 30 deletions
|
|
@ -4,19 +4,18 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Yggverse\Yoda\Entity\Browser;
|
namespace Yggverse\Yoda\Entity\Browser;
|
||||||
|
|
||||||
use \Yggverse\Yoda\Entity\Browser\Header\Navigation;
|
use \Yggverse\Yoda\Entity\Browser;
|
||||||
use \Yggverse\Yoda\Entity\Browser\Header\Tab;
|
use \Yggverse\Yoda\Entity\Browser\Header\Tray;
|
||||||
|
|
||||||
class Header
|
class Header
|
||||||
{
|
{
|
||||||
public \GtkHeaderBar $gtk;
|
public \GtkHeaderBar $gtk;
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
public \Yggverse\Yoda\Entity\Browser $browser;
|
public Browser $browser;
|
||||||
|
|
||||||
// Requirements
|
// Requirements
|
||||||
public Navigation $navigation;
|
public Tray $tray;
|
||||||
public Tab $tab;
|
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
protected bool $_actions = true;
|
protected bool $_actions = true;
|
||||||
|
|
@ -24,7 +23,7 @@ class Header
|
||||||
protected string $_subtitle = '';
|
protected string $_subtitle = '';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
\Yggverse\Yoda\Entity\Browser $browser
|
Browser $browser
|
||||||
) {
|
) {
|
||||||
// Init dependencies
|
// Init dependencies
|
||||||
$this->browser = $browser;
|
$this->browser = $browser;
|
||||||
|
|
@ -44,22 +43,13 @@ class Header
|
||||||
$this->_subtitle
|
$this->_subtitle
|
||||||
);
|
);
|
||||||
|
|
||||||
// Init navigation
|
// Init tray area
|
||||||
$this->navigation = new Navigation(
|
$this->tray = new Tray(
|
||||||
$this
|
$this
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->gtk->add(
|
$this->gtk->add(
|
||||||
$this->navigation->gtk
|
$this->tray->gtk
|
||||||
);
|
|
||||||
|
|
||||||
// Init new tab button
|
|
||||||
$this->tab = new Tab(
|
|
||||||
$this
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->gtk->add(
|
|
||||||
$this->tab->gtk
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
|
|
|
||||||
65
src/Entity/Browser/Header/Tray.php
Normal file
65
src/Entity/Browser/Header/Tray.php
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Yggverse\Yoda\Entity\Browser\Header;
|
||||||
|
|
||||||
|
use \Yggverse\Yoda\Entity\Browser\Header;
|
||||||
|
|
||||||
|
use \Yggverse\Yoda\Entity\Browser\Header\Tray\Navigation;
|
||||||
|
use \Yggverse\Yoda\Entity\Browser\Header\Tray\Tab;
|
||||||
|
|
||||||
|
class Tray
|
||||||
|
{
|
||||||
|
public \GtkBox $gtk;
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
public Header $header;
|
||||||
|
|
||||||
|
// Requirements
|
||||||
|
public Navigation $navigation;
|
||||||
|
public Tab $tab;
|
||||||
|
|
||||||
|
// Defaults
|
||||||
|
protected bool $_actions = true;
|
||||||
|
protected string $_title = 'Yoda';
|
||||||
|
protected string $_subtitle = '';
|
||||||
|
protected int $_margin = 8;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
Header $header
|
||||||
|
) {
|
||||||
|
// Init dependencies
|
||||||
|
$this->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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
declare(strict_types=1);
|
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;
|
use \Yggverse\Yoda\Entity\Browser\Menu;
|
||||||
|
|
||||||
class Navigation
|
class Navigation
|
||||||
|
|
@ -12,7 +12,7 @@ class Navigation
|
||||||
public \GtkMenuButton $gtk;
|
public \GtkMenuButton $gtk;
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
public Header $header;
|
public Tray $tray;
|
||||||
|
|
||||||
// Requirements
|
// Requirements
|
||||||
public Menu $menu;
|
public Menu $menu;
|
||||||
|
|
@ -21,10 +21,10 @@ class Navigation
|
||||||
private string $_tooltip = 'Navigation';
|
private string $_tooltip = 'Navigation';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Header $header
|
Tray $tray
|
||||||
) {
|
) {
|
||||||
// Init dependencies
|
// Init dependencies
|
||||||
$this->header = $header;
|
$this->tray = $tray;
|
||||||
|
|
||||||
// Init navigation container
|
// Init navigation container
|
||||||
$this->gtk = new \GtkMenuButton;
|
$this->gtk = new \GtkMenuButton;
|
||||||
|
|
@ -35,7 +35,7 @@ class Navigation
|
||||||
|
|
||||||
// Init menu
|
// Init menu
|
||||||
$this->menu = new Menu(
|
$this->menu = new Menu(
|
||||||
$this->header->browser
|
$this->tray->header->browser
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->gtk->set_popup(
|
$this->gtk->set_popup(
|
||||||
|
|
@ -2,26 +2,26 @@
|
||||||
|
|
||||||
declare(strict_types=1);
|
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
|
class Tab
|
||||||
{
|
{
|
||||||
public \GtkButton $gtk;
|
public \GtkButton $gtk;
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
public Header $header;
|
public Tray $tray;
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
protected string $_label = '+';
|
protected string $_label = '+';
|
||||||
private string $_tooltip = 'New tab';
|
private string $_tooltip = 'New tab';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Header $header
|
Tray $tray
|
||||||
) {
|
) {
|
||||||
// Init dependency
|
// Init dependency
|
||||||
$this->header = $header;
|
$this->tray = $tray;
|
||||||
|
|
||||||
// Init GTK
|
// Init GTK
|
||||||
$this->gtk = new \GtkButton;
|
$this->gtk = new \GtkButton;
|
||||||
|
|
@ -43,7 +43,7 @@ class Tab
|
||||||
function(
|
function(
|
||||||
\GtkButton $entity
|
\GtkButton $entity
|
||||||
) {
|
) {
|
||||||
$this->header->browser->container->tab->append(
|
$this->tray->header->browser->container->tab->append(
|
||||||
null,
|
null,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue