mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +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
53
src/Entity/Browser/Header/Tray/Tab.php
Normal file
53
src/Entity/Browser/Header/Tray/Tab.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yggverse\Yoda\Entity\Browser\Header\Tray;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Header\Tray;
|
||||
|
||||
class Tab
|
||||
{
|
||||
public \GtkButton $gtk;
|
||||
|
||||
// Dependencies
|
||||
public Tray $tray;
|
||||
|
||||
// Defaults
|
||||
protected string $_label = '+';
|
||||
private string $_tooltip = 'New tab';
|
||||
|
||||
public function __construct(
|
||||
Tray $tray
|
||||
) {
|
||||
// Init dependency
|
||||
$this->tray = $tray;
|
||||
|
||||
// Init GTK
|
||||
$this->gtk = new \GtkButton;
|
||||
|
||||
$this->gtk->set_label(
|
||||
_($this->_label)
|
||||
);
|
||||
|
||||
$this->gtk->set_tooltip_text(
|
||||
_($this->_tooltip)
|
||||
);
|
||||
|
||||
// Render
|
||||
$this->gtk->show();
|
||||
|
||||
// Init events
|
||||
$this->gtk->connect(
|
||||
'clicked',
|
||||
function(
|
||||
\GtkButton $entity
|
||||
) {
|
||||
$this->tray->header->browser->container->tab->append(
|
||||
null,
|
||||
false
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue