mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
move Page entity out of Tab namespace
This commit is contained in:
parent
46adc640e9
commit
63bc991bda
21 changed files with 111 additions and 111 deletions
|
|
@ -1,80 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yggverse\Yoda\Entity\Browser\Container\Tab\Page;
|
||||
|
||||
use \Yggverse\Yoda\Gtk\Browser\Container\Tab\Page\Title\Label;
|
||||
|
||||
class Title
|
||||
{
|
||||
public Label $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser\Container\Tab\Page $page;
|
||||
|
||||
// Defaults
|
||||
private int $_ellipsize = 3;
|
||||
private int $_length = 16;
|
||||
private ?string $_value = 'New page';
|
||||
private ?string $_subtitle = null;
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser\Container\Tab\Page $page,
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->page = $page;
|
||||
|
||||
// Init container
|
||||
$this->gtk = new Label(
|
||||
$this->_value
|
||||
);
|
||||
|
||||
$this->gtk->set_width_chars(
|
||||
$this->_length
|
||||
);
|
||||
|
||||
$this->gtk->set_ellipsize(
|
||||
$this->_ellipsize
|
||||
);
|
||||
}
|
||||
|
||||
public function setValue(
|
||||
?string $value = null,
|
||||
?string $subtitle = null
|
||||
): void
|
||||
{
|
||||
$this->gtk->set_text(
|
||||
is_null($value) ? $this->_value : trim(
|
||||
$value
|
||||
)
|
||||
);
|
||||
|
||||
$this->setSubtitle(
|
||||
$subtitle
|
||||
);
|
||||
}
|
||||
|
||||
public function setSubtitle(
|
||||
?string $subtitle = null
|
||||
): void
|
||||
{
|
||||
$this->gtk->set_subtitle(
|
||||
is_null($subtitle) ? $this->_subtitle : strtolower(
|
||||
trim(
|
||||
$subtitle
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getValue(): ?string
|
||||
{
|
||||
return $this->gtk->get_text();
|
||||
}
|
||||
|
||||
public function getSubtitle(): ?string
|
||||
{
|
||||
return $this->gtk->get_subtitle();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue