refactor to separated entities, init abstractions

This commit is contained in:
yggverse 2024-07-03 02:34:14 +03:00
parent 08c9fe76e5
commit 90acc3ac2d
47 changed files with 1927 additions and 2069 deletions

View file

@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Abstract\Entity;
abstract class Button
{
public \GtkButton $gtk;
protected bool $_sensitive = false;
protected string $_label = 'Button';
public function __construct()
{
$this->gtk = new \GtkButton;
$this->gtk->set_sensitive(
$this->_sensitive
);
$this->gtk->set_label(
$this->_label
);
$this->gtk->connect(
'clicked',
function(
\GtkButton $entity
) {
$this->_onClick(
$entity
);
}
);
}
abstract protected function _onClick(
\GtkButton $entity
): void;
}

View file

@ -0,0 +1,64 @@
<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Abstract\Entity;
abstract class Entry
{
public \GtkEntry $gtk;
private int $_length = 1024;
private string $_placeholder = '';
private string $_value = '';
public function __construct()
{
$this->gtk = new \GtkEntry;
$this->gtk->set_placeholder_text(
$this->_placeholder
);
$this->gtk->set_max_length(
$this->_length
);
$this->gtk->set_text(
$this->_value
);
$this->gtk->connect(
'activate',
function(
\GtkEntry $entry
) {
$this->_onActivate(
$entry
);
}
);
$this->gtk->connect(
'key-release-event',
function (
\GtkEntry $entry,
\GdkEvent $event
) {
$this->_onKeyRelease(
$entry,
$event
);
}
);
}
abstract protected function _onActivate(
\GtkEntry $entry
): void;
abstract protected function _onKeyRelease(
\GtkEntry $entry,
\GdkEvent $event
): void;
}

View file

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Abstract\Entity\Window\Tab\Address\Navbar;
abstract class Button extends \Yggverse\Yoda\Abstract\Entity\Button
{
public \Yggverse\Yoda\Entity\Window\Tab\Address\Navbar $navbar;
public function __construct(
\Yggverse\Yoda\Entity\Window\Tab\Address\Navbar $navbar
) {
parent::__construct();
$this->navbar = $navbar;
}
}

View file

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Abstract\Entity\Window\Tab\Address\Navbar;
abstract class Entry extends \Yggverse\Yoda\Abstract\Entity\Entry
{
public \Yggverse\Yoda\Entity\Window\Tab\Address\Navbar $navbar;
public function __construct(
\Yggverse\Yoda\Entity\Window\Tab\Address\Navbar $navbar
) {
parent::__construct();
$this->navbar = $navbar;
}
}

View file

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Abstract\Entity\Window\Tab\History\Navbar;
abstract class Button extends \Yggverse\Yoda\Abstract\Entity\Button
{
public \Yggverse\Yoda\Entity\Window\Tab\History\Navbar $navbar;
public function __construct(
\Yggverse\Yoda\Entity\Window\Tab\History\Navbar $navbar
) {
parent::__construct();
$this->navbar = $navbar;
}
}

View file

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Abstract\Entity\Window\Tab\History\Navbar;
abstract class Entry extends \Yggverse\Yoda\Abstract\Entity\Entry
{
public \Yggverse\Yoda\Entity\Window\Tab\History\Navbar $navbar;
public function __construct(
\Yggverse\Yoda\Entity\Window\Tab\History\Navbar $navbar
) {
parent::__construct();
$this->navbar = $navbar;
}
}