mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
implement new tab button
This commit is contained in:
parent
5559b236fe
commit
b9ca9616ff
2 changed files with 60 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ 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\Header\Navigation;
|
||||||
|
use \Yggverse\Yoda\Entity\Browser\Header\Tab;
|
||||||
|
|
||||||
class Header
|
class Header
|
||||||
{
|
{
|
||||||
|
|
@ -14,7 +15,8 @@ class Header
|
||||||
public \Yggverse\Yoda\Entity\Browser $browser;
|
public \Yggverse\Yoda\Entity\Browser $browser;
|
||||||
|
|
||||||
// Requirements
|
// Requirements
|
||||||
public \Yggverse\Yoda\Entity\Browser\Header\Navigation $navigation;
|
public Navigation $navigation;
|
||||||
|
public Tab $tab;
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
protected bool $_actions = true;
|
protected bool $_actions = true;
|
||||||
|
|
@ -51,6 +53,15 @@ class Header
|
||||||
$this->navigation->gtk
|
$this->navigation->gtk
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Init new tab button
|
||||||
|
$this->tab = new Tab(
|
||||||
|
$this
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->gtk->add(
|
||||||
|
$this->tab->gtk
|
||||||
|
);
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
$this->gtk->show();
|
$this->gtk->show();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
48
src/Entity/Browser/Header/Tab.php
Normal file
48
src/Entity/Browser/Header/Tab.php
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Yggverse\Yoda\Entity\Browser\Header;
|
||||||
|
|
||||||
|
use \Yggverse\Yoda\Entity\Browser\Header;
|
||||||
|
|
||||||
|
class Tab
|
||||||
|
{
|
||||||
|
public \GtkButton $gtk;
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
public Header $header;
|
||||||
|
|
||||||
|
// Defaults
|
||||||
|
protected string $_label = '+';
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
Header $header
|
||||||
|
) {
|
||||||
|
// Init dependency
|
||||||
|
$this->header = $header;
|
||||||
|
|
||||||
|
// Init GTK
|
||||||
|
$this->gtk = new \GtkButton;
|
||||||
|
|
||||||
|
$this->gtk->set_label(
|
||||||
|
$this->_label
|
||||||
|
);
|
||||||
|
|
||||||
|
// Render
|
||||||
|
$this->gtk->show();
|
||||||
|
|
||||||
|
// Init events
|
||||||
|
$this->gtk->connect(
|
||||||
|
'clicked',
|
||||||
|
function(
|
||||||
|
\GtkButton $entity
|
||||||
|
) {
|
||||||
|
$this->header->browser->container->tab->append(
|
||||||
|
null,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue