mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
use const for default values, use namespace
This commit is contained in:
parent
8a622ec335
commit
c985cf20af
20 changed files with 157 additions and 130 deletions
|
|
@ -7,24 +7,26 @@ namespace Yggverse\Yoda\Entity;
|
|||
use \Yggverse\Yoda\Entity\Browser\Header;
|
||||
use \Yggverse\Yoda\Entity\Browser\Container;
|
||||
|
||||
use \Yggverse\Yoda\Model\Database;
|
||||
|
||||
class Browser
|
||||
{
|
||||
public \GtkWindow $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Model\Database $database;
|
||||
public Database $database;
|
||||
|
||||
// Requirements
|
||||
public \Yggverse\Yoda\Entity\Browser\Header $header;
|
||||
public \Yggverse\Yoda\Entity\Browser\Container $container;
|
||||
public Header $header;
|
||||
public Container $container;
|
||||
|
||||
// Defaults
|
||||
private int $_width = 640;
|
||||
private int $_height = 480;
|
||||
private bool $_maximize = true;
|
||||
public const WIDTH = 640;
|
||||
public const HEIGHT = 640;
|
||||
public const MAXIMIZE = true;
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Model\Database $database
|
||||
Database $database
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->database = $database;
|
||||
|
|
@ -33,11 +35,11 @@ class Browser
|
|||
$this->gtk = new \GtkWindow;
|
||||
|
||||
$this->gtk->set_size_request(
|
||||
$this->_width,
|
||||
$this->_height
|
||||
$this::WIDTH,
|
||||
$this::HEIGHT
|
||||
);
|
||||
|
||||
if ($this->_maximize)
|
||||
if ($this::MAXIMIZE)
|
||||
{
|
||||
$this->gtk->maximize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Content
|
|||
public Viewport $viewport;
|
||||
|
||||
// Defaults
|
||||
private int $_margin = 8;
|
||||
public const MARGIN = 8;
|
||||
|
||||
// Extras
|
||||
private ?string $_source = null;
|
||||
|
|
@ -38,15 +38,15 @@ class Content
|
|||
$this->gtk = new \GtkScrolledWindow;
|
||||
|
||||
$this->gtk->set_margin_start(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_end(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_bottom(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
// Init scrolled window viewport
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Navbar
|
|||
public Request $request;
|
||||
|
||||
// Defaults
|
||||
private int $_margin = 8;
|
||||
public const MARGIN = 8;
|
||||
|
||||
public function __construct(
|
||||
Page $page
|
||||
|
|
@ -39,23 +39,23 @@ class Navbar
|
|||
);
|
||||
|
||||
$this->gtk->set_margin_top(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_bottom(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_start(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_end(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_spacing(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
// Append base button
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Yggverse\Yoda\Entity\Browser\Container\Page;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Container\Page;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Container\Page\Response\Query;
|
||||
use \Yggverse\Yoda\Entity\Browser\Container\Page\Response\Send;
|
||||
|
||||
|
|
@ -14,17 +16,18 @@ class Response
|
|||
public \GtkBox $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser\Container\Page $page;
|
||||
public Page $page;
|
||||
|
||||
// Requirements
|
||||
public \Yggverse\Yoda\Entity\Browser\Container\Page\Response\Query $query;
|
||||
public \Yggverse\Yoda\Entity\Browser\Container\Page\Response\Send $send;
|
||||
public Query $query;
|
||||
public Send $send;
|
||||
|
||||
// Defaults
|
||||
private int $_margin = 8;
|
||||
public const MARGIN = 8;
|
||||
public const SPACING = 8;
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser\Container\Page $page
|
||||
Page $page
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->page = $page;
|
||||
|
|
@ -35,23 +38,23 @@ class Response
|
|||
);
|
||||
|
||||
$this->gtk->set_margin_top(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_bottom(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_start(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_end(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_spacing(
|
||||
$this->_margin
|
||||
$this::SPACING
|
||||
);
|
||||
|
||||
// Init query field
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ class Title
|
|||
public Page $page;
|
||||
|
||||
// Defaults
|
||||
private int $_ellipsize = 3;
|
||||
private int $_length = 16;
|
||||
private string $_value = 'New page';
|
||||
private string $_subtitle = '';
|
||||
private string $_tooltip = '';
|
||||
public const ELLIPSIZE = 3;
|
||||
public const LENGTH = 16;
|
||||
public const VALUE = 'New page';
|
||||
public const SUBTITLE = '';
|
||||
public const TOOLTIP = '';
|
||||
|
||||
public function __construct(
|
||||
Page $page,
|
||||
|
|
@ -31,15 +31,15 @@ class Title
|
|||
|
||||
// Init container
|
||||
$this->gtk = new \GtkLabel(
|
||||
$this->_value
|
||||
$this::VALUE
|
||||
);
|
||||
|
||||
$this->gtk->set_width_chars(
|
||||
$this->_length
|
||||
$this::LENGTH
|
||||
);
|
||||
|
||||
$this->gtk->set_ellipsize(
|
||||
$this->_ellipsize
|
||||
$this::ELLIPSIZE
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ class Title
|
|||
);
|
||||
|
||||
$this->setTooltip(
|
||||
is_null($tooltip) ? (mb_strlen(strval($value)) > $this->_length ? $value : null)
|
||||
is_null($tooltip) ? (mb_strlen(strval($value)) > $this::LENGTH ? $value : null)
|
||||
: $tooltip
|
||||
);
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ class Title
|
|||
): void
|
||||
{
|
||||
$this->gtk->set_text(
|
||||
is_null($value) ? _($this->_value) : trim(
|
||||
is_null($value) ? _($this::VALUE) : trim(
|
||||
$value
|
||||
)
|
||||
);
|
||||
|
|
@ -78,7 +78,7 @@ class Title
|
|||
?string $subtitle = null
|
||||
): void
|
||||
{
|
||||
$this->subtitle = is_null($subtitle) ? _($this->_subtitle) : strtolower(
|
||||
$this->subtitle = is_null($subtitle) ? _($this::SUBTITLE) : strtolower(
|
||||
trim(
|
||||
$subtitle
|
||||
)
|
||||
|
|
@ -90,7 +90,7 @@ class Title
|
|||
): void
|
||||
{
|
||||
$this->gtk->set_tooltip_text(
|
||||
is_null($tooltip) ? _($this->_tooltip) : trim(
|
||||
is_null($tooltip) ? _($this::TOOLTIP) : trim(
|
||||
$tooltip
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class Navigation
|
|||
public Menu $menu;
|
||||
|
||||
// Defaults
|
||||
private string $_tooltip = 'Navigation';
|
||||
public const TOOLTIP = 'Navigation';
|
||||
|
||||
public function __construct(
|
||||
Tray $tray
|
||||
|
|
@ -30,7 +30,7 @@ class Navigation
|
|||
$this->gtk = new \GtkMenuButton;
|
||||
|
||||
$this->gtk->set_tooltip_text(
|
||||
_($this->_tooltip)
|
||||
_($this::TOOLTIP)
|
||||
);
|
||||
|
||||
// Init menu
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ class Tab
|
|||
public Tray $tray;
|
||||
|
||||
// Defaults
|
||||
protected string $_label = '+';
|
||||
private string $_tooltip = 'New tab';
|
||||
public const LABEL = '+';
|
||||
public const TOOLTIP = 'New tab';
|
||||
|
||||
public function __construct(
|
||||
Tray $tray
|
||||
|
|
@ -27,11 +27,11 @@ class Tab
|
|||
$this->gtk = new \GtkButton;
|
||||
|
||||
$this->gtk->set_label(
|
||||
_($this->_label)
|
||||
_($this::LABEL)
|
||||
);
|
||||
|
||||
$this->gtk->set_tooltip_text(
|
||||
_($this->_tooltip)
|
||||
_($this::TOOLTIP)
|
||||
);
|
||||
|
||||
// Render
|
||||
|
|
|
|||
|
|
@ -7,24 +7,26 @@ namespace Yggverse\Yoda\Entity\Browser;
|
|||
use \Yggverse\Yoda\Entity\Browser\History\Header;
|
||||
use \Yggverse\Yoda\Entity\Browser\History\Container;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser;
|
||||
|
||||
class History
|
||||
{
|
||||
public \GtkWindow $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser $browser;
|
||||
public Browser $browser;
|
||||
|
||||
// Requirements
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Header $header;
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Container $container;
|
||||
public Header $header;
|
||||
public Container $container;
|
||||
|
||||
// Defaults
|
||||
private int $_width = 640;
|
||||
private int $_height = 480;
|
||||
private bool $_maximize = false;
|
||||
public const WIDTH = 640;
|
||||
public const HEIGHT = 640;
|
||||
public const MAXIMIZE = false;
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser $browser
|
||||
Browser $browser
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->browser = $browser;
|
||||
|
|
@ -33,11 +35,11 @@ class History
|
|||
$this->gtk = new \GtkWindow;
|
||||
|
||||
$this->gtk->set_size_request(
|
||||
$this->_width,
|
||||
$this->_height
|
||||
$this::WIDTH,
|
||||
$this::HEIGHT
|
||||
);
|
||||
|
||||
if ($this->_maximize)
|
||||
if ($this::MAXIMIZE)
|
||||
{
|
||||
$this->gtk->maximize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Yggverse\Yoda\Entity\Browser\History\Container;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\History\Container;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\History\Container\Content\Viewport;
|
||||
use \Yggverse\Yoda\Entity\Browser\History\Container\Content\Table;
|
||||
|
||||
|
|
@ -12,17 +14,17 @@ class Content
|
|||
public \GtkScrolledWindow $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Container $container;
|
||||
public Container $container;
|
||||
|
||||
// Requirements
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Container\Content\Viewport $viewport;
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Container\Content\Table $table;
|
||||
public Viewport $viewport;
|
||||
public Table $table;
|
||||
|
||||
// Defaults
|
||||
private int $_margin = 8;
|
||||
public const MARGIN = 8;
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser\History\Container $container
|
||||
Container $container
|
||||
) {
|
||||
// Init dependency
|
||||
$this->container = $container;
|
||||
|
|
@ -31,15 +33,15 @@ class Content
|
|||
$this->gtk = new \GtkScrolledWindow;
|
||||
|
||||
$this->gtk->set_margin_start(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_end(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_bottom(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
// Init history records table
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Yggverse\Yoda\Entity\Browser\History\Container\Content;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\History\Container\Content;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\History\Container\Content\Table\Data;
|
||||
|
||||
class Table
|
||||
|
|
@ -11,18 +13,18 @@ class Table
|
|||
public \GtkTreeView $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Container\Content $content;
|
||||
public Content $content;
|
||||
|
||||
// Requirements
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Container\Content\Table\Data $data;
|
||||
public Data $data;
|
||||
|
||||
// Defaults
|
||||
private string $_time = 'Time';
|
||||
private string $_title = 'Title';
|
||||
private string $_url = 'URL';
|
||||
public const TIME = 'Time';
|
||||
public const TITLE = 'Title';
|
||||
public const URL = 'URL';
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser\History\Container\Content $content
|
||||
Content $content
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->content = $content;
|
||||
|
|
@ -32,7 +34,7 @@ class Table
|
|||
|
||||
$this->gtk->append_column(
|
||||
new \GtkTreeViewColumn(
|
||||
$this->_time,
|
||||
$this::TIME,
|
||||
new \GtkCellRendererText(),
|
||||
'text',
|
||||
1
|
||||
|
|
@ -41,7 +43,7 @@ class Table
|
|||
|
||||
$this->gtk->append_column(
|
||||
new \GtkTreeViewColumn(
|
||||
$this->_url,
|
||||
$this::URL,
|
||||
new \GtkCellRendererText(),
|
||||
'text',
|
||||
2
|
||||
|
|
@ -50,7 +52,7 @@ class Table
|
|||
|
||||
$this->gtk->append_column(
|
||||
new \GtkTreeViewColumn(
|
||||
$this->_title,
|
||||
$this::TITLE,
|
||||
new \GtkCellRendererText(),
|
||||
'text',
|
||||
3
|
||||
|
|
|
|||
|
|
@ -4,18 +4,20 @@ declare(strict_types=1);
|
|||
|
||||
namespace Yggverse\Yoda\Entity\Browser\History\Container\Content\Table;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\History\Container\Content\Table;
|
||||
|
||||
class Data
|
||||
{
|
||||
public \GtkListStore $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Container\Content\Table $table;
|
||||
public Table $table;
|
||||
|
||||
// Defaults
|
||||
private string $_time = 'c';
|
||||
public const TIME = 'c';
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser\History\Container\Content\Table $table
|
||||
Table $table
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->table = $table;
|
||||
|
|
@ -41,7 +43,7 @@ class Data
|
|||
[
|
||||
$id,
|
||||
date(
|
||||
$this->_time,
|
||||
$this::TIME,
|
||||
$time
|
||||
),
|
||||
$url,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Yggverse\Yoda\Entity\Browser\History\Container;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\History\Container;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\History\Container\Navbar\Delete;
|
||||
use \Yggverse\Yoda\Entity\Browser\History\Container\Navbar\Filter;
|
||||
use \Yggverse\Yoda\Entity\Browser\History\Container\Navbar\Open;
|
||||
|
|
@ -14,19 +16,20 @@ class Navbar
|
|||
public \GtkBox $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Container $container;
|
||||
public Container $container;
|
||||
|
||||
// Requirements
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Container\Navbar\Delete $delete;
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Container\Navbar\Filter $filter;
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Container\Navbar\Open $open;
|
||||
public \Yggverse\Yoda\Entity\Browser\History\Container\Navbar\Search $search;
|
||||
public Delete $delete;
|
||||
public Filter $filter;
|
||||
public Open $open;
|
||||
public Search $search;
|
||||
|
||||
// Defaults
|
||||
private int $_margin = 8;
|
||||
public const MARGIN = 8;
|
||||
public const SPACING = 8;
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser\History\Container $container
|
||||
Container $container
|
||||
) {
|
||||
// Init dependency
|
||||
$this->container = $container;
|
||||
|
|
@ -37,23 +40,23 @@ class Navbar
|
|||
);
|
||||
|
||||
$this->gtk->set_margin_top(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_bottom(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_start(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_margin_end(
|
||||
$this->_margin
|
||||
$this::MARGIN
|
||||
);
|
||||
|
||||
$this->gtk->set_spacing(
|
||||
$this->_margin
|
||||
$this::SPACING
|
||||
);
|
||||
|
||||
// Init open button
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Yggverse\Yoda\Entity\Browser\Menu;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu\File\Open;
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu\File\Save;
|
||||
|
||||
|
|
@ -12,20 +14,20 @@ class File
|
|||
public \GtkMenuItem $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser\Menu $menu;
|
||||
public Menu $menu;
|
||||
|
||||
// Defaults
|
||||
private string $_label = 'File';
|
||||
public const LABEL = 'File';
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser\Menu $menu
|
||||
Menu $menu
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->menu = $menu;
|
||||
|
||||
// Init menu item
|
||||
$this->gtk = \GtkMenuItem::new_with_label(
|
||||
$this->_label
|
||||
$this::LABEL
|
||||
);
|
||||
|
||||
// Init submenu container
|
||||
|
|
|
|||
|
|
@ -4,32 +4,33 @@ declare(strict_types=1);
|
|||
|
||||
namespace Yggverse\Yoda\Entity\Browser\Menu\File;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu\File;
|
||||
|
||||
class Open
|
||||
{
|
||||
public \GtkMenuItem $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser\Menu\File $file;
|
||||
public File $file;
|
||||
|
||||
// Defaults
|
||||
private string $_label = 'Open';
|
||||
private bool $_multiple = true;
|
||||
private array $_pattern =
|
||||
[
|
||||
public const LABEL = 'Open';
|
||||
public const MULTIPLE = true;
|
||||
public const PATTERN = [
|
||||
// pattern:name
|
||||
'*' => 'All',
|
||||
'*.gmi' => null
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser\Menu\File $file
|
||||
File $file
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->file = $file;
|
||||
|
||||
// Init menu item
|
||||
$this->gtk = \GtkMenuItem::new_with_label(
|
||||
$this->_label
|
||||
$this::LABEL
|
||||
);
|
||||
|
||||
// Render
|
||||
|
|
@ -60,10 +61,10 @@ class Open
|
|||
}
|
||||
|
||||
$dialog->set_select_multiple(
|
||||
$this->_multiple
|
||||
$this::MULTIPLE
|
||||
);
|
||||
|
||||
foreach ($this->_pattern as $pattern => $name)
|
||||
foreach ($this::PATTERN as $pattern => $name)
|
||||
{
|
||||
$filter = new \GtkFileFilter;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,25 +4,27 @@ declare(strict_types=1);
|
|||
|
||||
namespace Yggverse\Yoda\Entity\Browser\Menu\File;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu\File;
|
||||
|
||||
class Save
|
||||
{
|
||||
public \GtkMenuItem $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser\Menu\File $file;
|
||||
public File $file;
|
||||
|
||||
// Defaults
|
||||
private string $_label = 'Save As..';
|
||||
public const LABEL = 'Save As..';
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser\Menu\File $file
|
||||
File $file
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->file = $file;
|
||||
|
||||
// Init menu item
|
||||
$this->gtk = \GtkMenuItem::new_with_label(
|
||||
$this->_label
|
||||
$this::LABEL
|
||||
);
|
||||
|
||||
// Render
|
||||
|
|
|
|||
|
|
@ -4,25 +4,27 @@ declare(strict_types=1);
|
|||
|
||||
namespace Yggverse\Yoda\Entity\Browser\Menu;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu;
|
||||
|
||||
class History
|
||||
{
|
||||
public \GtkMenuItem $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser\Menu $menu;
|
||||
public Menu $menu;
|
||||
|
||||
// Defaults
|
||||
private string $_label = 'History';
|
||||
public const LABEL = 'History';
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser\Menu $menu
|
||||
Menu $menu
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->menu = $menu;
|
||||
|
||||
// Init menu item
|
||||
$this->gtk = \GtkMenuItem::new_with_label(
|
||||
$this->_label
|
||||
$this::LABEL
|
||||
);
|
||||
|
||||
// Render
|
||||
|
|
|
|||
|
|
@ -4,25 +4,27 @@ declare(strict_types=1);
|
|||
|
||||
namespace Yggverse\Yoda\Entity\Browser\Menu;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu;
|
||||
|
||||
class Quit
|
||||
{
|
||||
public \GtkMenuItem $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser\Menu $menu;
|
||||
public Menu $menu;
|
||||
|
||||
// Defaults
|
||||
private string $_label = 'Quit';
|
||||
public const LABEL = 'Quit';
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser\Menu $menu
|
||||
Menu $menu
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->menu = $menu;
|
||||
|
||||
// Init menu item
|
||||
$this->gtk = \GtkMenuItem::new_with_label(
|
||||
$this->_label
|
||||
$this::LABEL
|
||||
);
|
||||
|
||||
// Render
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Yggverse\Yoda\Entity\Browser\Menu;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu\Tab\Add;
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu\Tab\Close;
|
||||
|
||||
|
|
@ -12,24 +14,24 @@ class Tab
|
|||
public \GtkMenuItem $gtk;
|
||||
|
||||
// Dependencies
|
||||
public \Yggverse\Yoda\Entity\Browser\Menu $menu;
|
||||
public Menu $menu;
|
||||
|
||||
// Requirements
|
||||
public \Yggverse\Yoda\Entity\Browser\Menu\Tab\Add $add;
|
||||
public \Yggverse\Yoda\Entity\Browser\Menu\Tab\Close $close;
|
||||
public Add $add;
|
||||
public Close $close;
|
||||
|
||||
// Defaults
|
||||
private string $_label = 'Tab';
|
||||
public const LABEL = 'Tab';
|
||||
|
||||
public function __construct(
|
||||
\Yggverse\Yoda\Entity\Browser\Menu $menu
|
||||
Menu $menu
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->menu = $menu;
|
||||
|
||||
// Init menu item
|
||||
$this->gtk = \GtkMenuItem::new_with_label(
|
||||
$this->_label
|
||||
$this::LABEL
|
||||
);
|
||||
|
||||
// Init submenu container
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ class Add
|
|||
public Tab $tab;
|
||||
|
||||
// Defaults
|
||||
private string $_label = 'Add';
|
||||
private string $_tooltip = 'New tab';
|
||||
public const LABEL = 'Add';
|
||||
public const TOOLTIP = 'New tab';
|
||||
|
||||
public function __construct(
|
||||
Tab $tab
|
||||
|
|
@ -25,11 +25,11 @@ class Add
|
|||
|
||||
// Init menu item
|
||||
$this->gtk = \GtkMenuItem::new_with_label(
|
||||
_($this->_label)
|
||||
_($this::LABEL)
|
||||
);
|
||||
|
||||
$this->gtk->set_tooltip_text(
|
||||
_($this->_tooltip)
|
||||
_($this::TOOLTIP)
|
||||
);
|
||||
|
||||
// Render
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ class Close
|
|||
public Tab $tab;
|
||||
|
||||
// Defaults
|
||||
private string $_label = 'Close';
|
||||
private string $_tooltip = 'Close active tab (double click on tab)';
|
||||
public const LABEL = 'Close';
|
||||
public const TOOLTIP = 'Close active tab (double click on tab)';
|
||||
|
||||
public function __construct(
|
||||
Tab $tab
|
||||
|
|
@ -25,11 +25,11 @@ class Close
|
|||
|
||||
// Init menu item
|
||||
$this->gtk = \GtkMenuItem::new_with_label(
|
||||
_($this->_label)
|
||||
_($this::LABEL)
|
||||
);
|
||||
|
||||
$this->gtk->set_tooltip_text(
|
||||
_($this->_tooltip)
|
||||
_($this::TOOLTIP)
|
||||
);
|
||||
|
||||
// Render
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue