Browse Source

remove HeaderBar abstraction

PHP-GTK3
yggverse 4 months ago
parent
commit
c5b62addd4
  1. 46
      src/Abstract/Entity/HeaderBar.php
  2. 38
      src/Entity/Browser/Header.php
  3. 38
      src/Entity/Browser/History/Header.php

46
src/Abstract/Entity/HeaderBar.php

@ -1,46 +0,0 @@ @@ -1,46 +0,0 @@
<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Abstract\Entity;
abstract class HeaderBar
{
public \GtkHeaderBar $gtk;
protected bool $_actions = true;
protected string $_title = 'Yoda';
protected string $_subtitle = '';
public function __construct()
{
$this->gtk = new \GtkHeaderBar;
$this->gtk->set_show_close_button(
$this->_actions
);
$this->gtk->set_title(
$this->_title
);
$this->gtk->set_subtitle(
$this->_subtitle
);
}
public function setTitle(
?string $title = null
): void
{
$this->gtk->set_title(
is_null($title) ? $this->_title : sprintf(
'%s - %s',
trim(
$title
),
$this->_title
)
);
}
}

38
src/Entity/Browser/Header.php

@ -4,7 +4,43 @@ declare(strict_types=1); @@ -4,7 +4,43 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser;
class Header extends \Yggverse\Yoda\Abstract\Entity\HeaderBar
class Header
{
public \GtkHeaderBar $gtk;
protected bool $_actions = true;
protected string $_title = 'Yoda';
protected string $_subtitle = '';
public function __construct()
{
$this->gtk = new \GtkHeaderBar;
$this->gtk->set_show_close_button(
$this->_actions
);
$this->gtk->set_title(
$this->_title
);
$this->gtk->set_subtitle(
$this->_subtitle
);
}
public function setTitle(
?string $title = null
): void
{
$this->gtk->set_title(
is_null($title) ? $this->_title : sprintf(
'%s - %s',
trim(
$title
),
$this->_title
)
);
}
}

38
src/Entity/Browser/History/Header.php

@ -4,7 +4,43 @@ declare(strict_types=1); @@ -4,7 +4,43 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\History;
class Header extends \Yggverse\Yoda\Abstract\Entity\HeaderBar
class Header
{
public \GtkHeaderBar $gtk;
protected bool $_actions = true;
protected string $_title = 'History - Yoda';
protected string $_subtitle = '';
public function __construct()
{
$this->gtk = new \GtkHeaderBar;
$this->gtk->set_show_close_button(
$this->_actions
);
$this->gtk->set_title(
$this->_title
);
$this->gtk->set_subtitle(
$this->_subtitle
);
}
public function setTitle(
?string $title = null
): void
{
$this->gtk->set_title(
is_null($title) ? $this->_title : sprintf(
'%s - %s',
trim(
$title
),
$this->_title
)
);
}
}
Loading…
Cancel
Save