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