Browse Source

define dependencies ns

PHP-GTK3
yggverse 4 months ago
parent
commit
107718022d
  1. 18
      src/Entity/Browser/Container/Page.php
  2. 7
      src/Entity/Browser/Container/Page/Content.php
  3. 33
      src/Entity/Browser/Container/Page/Content/Gemtext.php
  4. 6
      src/Entity/Browser/Container/Page/Content/Image.php
  5. 9
      src/Entity/Browser/Container/Page/Content/Plain.php
  6. 7
      src/Entity/Browser/Container/Page/Content/Viewport.php
  7. 10
      src/Entity/Browser/Container/Page/Navbar.php
  8. 4
      src/Entity/Browser/Container/Page/Navbar/Base.php
  9. 4
      src/Entity/Browser/Container/Page/Navbar/Bookmark.php
  10. 16
      src/Entity/Browser/Container/Page/Navbar/History.php
  11. 4
      src/Entity/Browser/Container/Page/Navbar/History/Back.php
  12. 4
      src/Entity/Browser/Container/Page/Navbar/History/Forward.php
  13. 20
      src/Entity/Browser/Container/Page/Navbar/Request.php
  14. 4
      src/Entity/Browser/Container/Page/Navbar/Update.php
  15. 12
      src/Entity/Browser/Container/Page/Progressbar.php
  16. 10
      src/Entity/Browser/Container/Page/Response.php
  17. 15
      src/Entity/Browser/Container/Page/Response/Query.php
  18. 4
      src/Entity/Browser/Container/Page/Response/Send.php
  19. 7
      src/Entity/Browser/Container/Page/Title.php
  20. 40
      src/Entity/Browser/Container/Tab.php
  21. 10
      src/Entity/Browser/Header/Tray.php
  22. 7
      src/Entity/Browser/Header/Tray/Navigation.php
  23. 18
      src/Entity/Browser/Header/Tray/Tab.php

18
src/Entity/Browser/Container/Page.php

@ -4,6 +4,11 @@ declare(strict_types=1); @@ -4,6 +4,11 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container;
use \Exception;
use \Gtk;
use \GtkBox;
use \GtkOrientation;
use \Yggverse\Yoda\Entity\Browser\Container;
use \Yggverse\Yoda\Model\Connection;
@ -11,7 +16,8 @@ use \Yggverse\Yoda\Model\Filesystem; @@ -11,7 +16,8 @@ use \Yggverse\Yoda\Model\Filesystem;
class Page
{
public \GtkBox $gtk;
// GTK
public GtkBox $gtk;
// Dependencies
public Container $container;
@ -30,8 +36,8 @@ class Page @@ -30,8 +36,8 @@ class Page
$this->container = $container;
// Init container
$this->gtk = new \GtkBox(
\GtkOrientation::VERTICAL
$this->gtk = new GtkBox(
GtkOrientation::VERTICAL
);
// Init title
@ -106,7 +112,7 @@ class Page @@ -106,7 +112,7 @@ class Page
if ($focus)
{
\Gtk::timeout_add(
Gtk::timeout_add(
100,
function()
{
@ -142,7 +148,7 @@ class Page @@ -142,7 +148,7 @@ class Page
if (empty($this->navbar->request->getValue()))
{
// return;
throw new \Exception;
throw new Exception;
}
// Update title
@ -174,7 +180,7 @@ class Page @@ -174,7 +180,7 @@ class Page
$expire = time() + $timeout;
// Listen response
\Gtk::timeout_add(
Gtk::timeout_add(
$refresh,
function() use ($connection, $expire, $history)
{

7
src/Entity/Browser/Container/Page/Content.php

@ -4,13 +4,16 @@ declare(strict_types=1); @@ -4,13 +4,16 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page;
use \GtkScrolledWindow;
use \Yggverse\Yoda\Entity\Browser\Container\Page;
use \Yggverse\Yoda\Model\Filesystem;
class Content
{
public \GtkScrolledWindow $gtk;
// GTK
public GtkScrolledWindow $gtk;
// Dependencies
public Page $page;
@ -30,7 +33,7 @@ class Content @@ -30,7 +33,7 @@ class Content
$this->page = $page;
// Init scrolled window container
$this->gtk = new \GtkScrolledWindow;
$this->gtk = new GtkScrolledWindow;
$this->gtk->set_margin_start(
$this::MARGIN

33
src/Entity/Browser/Container/Page/Content/Gemtext.php

@ -4,9 +4,20 @@ declare(strict_types=1); @@ -4,9 +4,20 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content;
use \Exception;
use \GdkEvent;
use \GtkLabel;
use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Content\Markup;
use \Yggverse\Gemtext\Document;
use \Yggverse\Gemtext\Entity\Code;
use \Yggverse\Gemtext\Entity\Header;
use \Yggverse\Gemtext\Entity\Link;
use \Yggverse\Gemtext\Entity\Listing;
use \Yggverse\Gemtext\Entity\Quote;
use \Yggverse\Gemtext\Entity\Text;
use \Yggverse\Net\Address;
class Gemtext extends Markup
@ -27,7 +38,7 @@ class Gemtext extends Markup @@ -27,7 +38,7 @@ class Gemtext extends Markup
{
switch (true)
{
case $entity instanceof \Yggverse\Gemtext\Entity\Code:
case $entity instanceof Code:
if ($entity->isInline())
{
@ -48,7 +59,7 @@ class Gemtext extends Markup @@ -48,7 +59,7 @@ class Gemtext extends Markup
break;
case $entity instanceof \Yggverse\Gemtext\Entity\Header:
case $entity instanceof Header:
if ($preformatted)
{
@ -109,13 +120,13 @@ class Gemtext extends Markup @@ -109,13 +120,13 @@ class Gemtext extends Markup
break;
default:
throw new \Exception;
throw new Exception;
}
}
break;
case $entity instanceof \Yggverse\Gemtext\Entity\Link:
case $entity instanceof Link:
if ($preformatted)
{
@ -149,7 +160,7 @@ class Gemtext extends Markup @@ -149,7 +160,7 @@ class Gemtext extends Markup
break;
case $entity instanceof \Yggverse\Gemtext\Entity\Listing:
case $entity instanceof Listing:
if ($preformatted)
{
@ -174,7 +185,7 @@ class Gemtext extends Markup @@ -174,7 +185,7 @@ class Gemtext extends Markup
break;
case $entity instanceof \Yggverse\Gemtext\Entity\Quote:
case $entity instanceof Quote:
if ($preformatted)
{
@ -199,7 +210,7 @@ class Gemtext extends Markup @@ -199,7 +210,7 @@ class Gemtext extends Markup
break;
case $entity instanceof \Yggverse\Gemtext\Entity\Text:
case $entity instanceof Text:
if ($preformatted)
{
@ -223,7 +234,7 @@ class Gemtext extends Markup @@ -223,7 +234,7 @@ class Gemtext extends Markup
default:
throw new \Exception;
throw new Exception;
}
}
@ -236,7 +247,7 @@ class Gemtext extends Markup @@ -236,7 +247,7 @@ class Gemtext extends Markup
}
protected function _onActivateLink(
\GtkLabel $label,
GtkLabel $label,
string $href
): bool
{
@ -270,8 +281,8 @@ class Gemtext extends Markup @@ -270,8 +281,8 @@ class Gemtext extends Markup
}
protected function _onButtonPressEvent(
\GtkLabel $label,
\GdkEvent $event
GtkLabel $label,
GdkEvent $event
): bool
{
// Markup container has focus event disabled (hidden cursor position)

6
src/Entity/Browser/Container/Page/Content/Image.php

@ -4,11 +4,13 @@ declare(strict_types=1); @@ -4,11 +4,13 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content;
use \GtkImage;
use \Yggverse\Yoda\Entity\Browser\Container\Page\Content;
class Image
{
public \GtkImage $gtk;
public GtkImage $gtk;
// Dependencies
public Content $content;
@ -20,7 +22,7 @@ class Image @@ -20,7 +22,7 @@ class Image
$this->content = $content;
// Init image object
$this->gtk = new \GtkImage;
$this->gtk = new GtkImage;
}
public function set(

9
src/Entity/Browser/Container/Page/Content/Plain.php

@ -4,6 +4,9 @@ declare(strict_types=1); @@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content;
use \GdkEvent;
use \GtkLabel;
use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Content\Markup;
class Plain extends Markup
@ -23,7 +26,7 @@ class Plain extends Markup @@ -23,7 +26,7 @@ class Plain extends Markup
}
protected function _onActivateLink(
\GtkLabel $label,
GtkLabel $label,
string $href
): bool
{
@ -31,8 +34,8 @@ class Plain extends Markup @@ -31,8 +34,8 @@ class Plain extends Markup
}
protected function _onButtonPressEvent(
\GtkLabel $label,
\GdkEvent $event
GtkLabel $label,
GdkEvent $event
): bool
{
// Markup container has focus event disabled (hidden cursor position)

7
src/Entity/Browser/Container/Page/Content/Viewport.php

@ -4,11 +4,14 @@ declare(strict_types=1); @@ -4,11 +4,14 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content;
use \GtkViewport;
use \Yggverse\Yoda\Entity\Browser\Container\Page\Content;
class Viewport
{
public \GtkViewport $gtk;
// GTK
public GtkViewport $gtk;
// Dependencies
public Content $content;
@ -23,7 +26,7 @@ class Viewport @@ -23,7 +26,7 @@ class Viewport
$this->content = $content;
// Init viewport
$this->gtk = new \GtkViewport;
$this->gtk = new GtkViewport;
}
public function set(

10
src/Entity/Browser/Container/Page/Navbar.php

@ -4,11 +4,15 @@ declare(strict_types=1); @@ -4,11 +4,15 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page;
use \GtkBox;
use \GtkOrientation;
use \Yggverse\Yoda\Entity\Browser\Container\Page;
class Navbar
{
public \GtkBox $gtk;
// GTK
public GtkBox $gtk;
// Dependencies
public Page $page;
@ -30,8 +34,8 @@ class Navbar @@ -30,8 +34,8 @@ class Navbar
$this->page = $page;
// Init navbar
$this->gtk = new \GtkBox(
\GtkOrientation::HORIZONTAL
$this->gtk = new GtkBox(
GtkOrientation::HORIZONTAL
);
$this->gtk->set_margin_top(

4
src/Entity/Browser/Container/Page/Navbar/Base.php

@ -4,6 +4,8 @@ declare(strict_types=1); @@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar;
use \GtkButton;
class Base extends \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\Button
{
public const IMAGE = 'go-home-symbolic';
@ -11,7 +13,7 @@ class Base extends \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\ @@ -11,7 +13,7 @@ class Base extends \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\
public const TOOLTIP = 'Base';
protected function _onCLick(
\GtkButton $entity
GtkButton $entity
): void
{
$address = new \Yggverse\Net\Address(

4
src/Entity/Browser/Container/Page/Navbar/Bookmark.php

@ -4,6 +4,8 @@ declare(strict_types=1); @@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar;
use \GtkButton;
use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\Button;
class Bookmark extends Button
@ -19,7 +21,7 @@ class Bookmark extends Button @@ -19,7 +21,7 @@ class Bookmark extends Button
public const SENSITIVE = true;
protected function _onCLick(
\GtkButton $entity
GtkButton $entity
): void
{
$this->setImage(

16
src/Entity/Browser/Container/Page/Navbar/History.php

@ -4,13 +4,19 @@ declare(strict_types=1); @@ -4,13 +4,19 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar;
use \Exception;
use \GtkButtonBox;
use \GtkButtonBoxStyle;
use \GtkOrientation;
use \Yggverse\Yoda\Entity\Browser\Container\Page\Navbar;
use \Yggverse\Yoda\Model\History as Memory;
class History
{
public \GtkButtonBox $gtk;
// GTK
public GtkButtonBox $gtk;
// Dependencies
public Navbar $navbar;
@ -27,12 +33,12 @@ class History @@ -27,12 +33,12 @@ class History
$this->navbar = $navbar;
$this->gtk = new \GtkButtonBox(
\GtkOrientation::HORIZONTAL
$this->gtk = new GtkButtonBox(
GtkOrientation::HORIZONTAL
);
$this->gtk->set_layout(
\GtkButtonBoxStyle::EXPAND
GtkButtonBoxStyle::EXPAND
);
$this->back = new History\Back(
@ -61,7 +67,7 @@ class History @@ -61,7 +67,7 @@ class History
{
if (empty($value))
{
throw new \Exception;
throw new Exception;
}
if ($value != $this->memory->getCurrent())

4
src/Entity/Browser/Container/Page/Navbar/History/Back.php

@ -4,6 +4,8 @@ declare(strict_types=1); @@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar\History;
use \GtkButton;
use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\Button;
class Back extends Button
@ -13,7 +15,7 @@ class Back extends Button @@ -13,7 +15,7 @@ class Back extends Button
public const TOOLTIP = 'Back';
protected function _onCLick(
\GtkButton $entity
GtkButton $entity
): void
{
if ($this->navbar->history->memory->getBack())

4
src/Entity/Browser/Container/Page/Navbar/History/Forward.php

@ -4,6 +4,8 @@ declare(strict_types=1); @@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar\History;
use \GtkButton;
use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\Button;
class Forward extends Button
@ -13,7 +15,7 @@ class Forward extends Button @@ -13,7 +15,7 @@ class Forward extends Button
public const TOOLTIP = 'Forward';
protected function _onCLick(
\GtkButton $entity
GtkButton $entity
): void
{
if ($this->navbar->history->memory->getForward())

20
src/Entity/Browser/Container/Page/Navbar/Request.php

@ -4,6 +4,10 @@ declare(strict_types=1); @@ -4,6 +4,10 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar;
use \GdkEvent;
use \Gtk;
use \GtkEntry;
use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\Entry;
class Request extends Entry
@ -13,7 +17,7 @@ class Request extends Entry @@ -13,7 +17,7 @@ class Request extends Entry
private ?int $_changed = null;
protected function _onActivate(
\GtkEntry $entry
GtkEntry $entry
): void
{
if (empty($this->getValue()))
@ -29,8 +33,8 @@ class Request extends Entry @@ -29,8 +33,8 @@ class Request extends Entry
}
protected function _onKeyRelease(
\GtkEntry $entry,
\GdkEvent $event
GtkEntry $entry,
GdkEvent $event
): void
{
// Delegate
@ -40,7 +44,7 @@ class Request extends Entry @@ -40,7 +44,7 @@ class Request extends Entry
}
protected function _onChanged(
\GtkEntry $entry
GtkEntry $entry
): void
{
// Refresh navigation elements
@ -52,7 +56,7 @@ class Request extends Entry @@ -52,7 +56,7 @@ class Request extends Entry
// Reset previous event
if ($this->_changed)
{
\Gtk::source_remove(
Gtk::source_remove(
$this->_changed
);
@ -60,7 +64,7 @@ class Request extends Entry @@ -60,7 +64,7 @@ class Request extends Entry
}
// Wait for one second to apply act
$this->_changed = \Gtk::timeout_add(
$this->_changed = Gtk::timeout_add(
1000,
function()
{
@ -75,8 +79,8 @@ class Request extends Entry @@ -75,8 +79,8 @@ class Request extends Entry
}
protected function _onFocusOut(
\GtkEntry $entry,
\GdkEvent $event
GtkEntry $entry,
GdkEvent $event
): void
{}
}

4
src/Entity/Browser/Container/Page/Navbar/Update.php

@ -4,6 +4,8 @@ declare(strict_types=1); @@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Navbar;
use \GtkButton;
use \Yggverse\Yoda\Abstract\Entity\Browser\Container\Page\Navbar\Button;
class Update extends Button
@ -13,7 +15,7 @@ class Update extends Button @@ -13,7 +15,7 @@ class Update extends Button
public const TOOLTIP = 'Update';
protected function _onCLick(
\GtkButton $entity
GtkButton $entity
): void
{
$this->navbar->page->update();

12
src/Entity/Browser/Container/Page/Progressbar.php

@ -4,11 +4,15 @@ declare(strict_types=1); @@ -4,11 +4,15 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page;
use \Gtk;
use \GtkProgressBar;
use \Yggverse\Yoda\Entity\Browser\Container\Page;
class Progressbar
{
public \GtkProgressBar $gtk;
// GTK
public GtkProgressBar $gtk;
// Dependencies
public Page $page;
@ -25,7 +29,7 @@ class Progressbar @@ -25,7 +29,7 @@ class Progressbar
$this->page = $page;
// Init container
$this->gtk = new \GtkProgressBar;
$this->gtk = new GtkProgressBar;
/* Prevent global initiation
$this->gtk->set_no_show_all(
@ -73,7 +77,7 @@ class Progressbar @@ -73,7 +77,7 @@ class Progressbar
$this->gtk->set_fraction(0);
// Begin iterator
\Gtk::timeout_add(
Gtk::timeout_add(
$timeout,
function()
{
@ -108,7 +112,7 @@ class Progressbar @@ -108,7 +112,7 @@ class Progressbar
);
// Begin iterator
\Gtk::timeout_add(
Gtk::timeout_add(
$timeout,
function()
{

10
src/Entity/Browser/Container/Page/Response.php

@ -4,13 +4,17 @@ declare(strict_types=1); @@ -4,13 +4,17 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page;
use \GtkBox;
use \GtkOrientation;
use \Yggverse\Yoda\Entity\Browser\Container\Page;
use \Yggverse\Net\Address;
class Response
{
public \GtkBox $gtk;
// GTK
public GtkBox $gtk;
// Dependencies
public Page $page;
@ -30,8 +34,8 @@ class Response @@ -30,8 +34,8 @@ class Response
$this->page = $page;
// Init container
$this->gtk = new \GtkBox(
\GtkOrientation::HORIZONTAL
$this->gtk = new GtkBox(
GtkOrientation::HORIZONTAL
);
$this->gtk->set_margin_top(

15
src/Entity/Browser/Container/Page/Response/Query.php

@ -4,6 +4,9 @@ declare(strict_types=1); @@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Response;
use \GdkEvent;
use \GtkEntry;
use \Yggverse\Yoda\Entity\Browser\Container\Page\Response;
class Query extends \Yggverse\Yoda\Abstract\Entity\Entry
@ -24,28 +27,28 @@ class Query extends \Yggverse\Yoda\Abstract\Entity\Entry @@ -24,28 +27,28 @@ class Query extends \Yggverse\Yoda\Abstract\Entity\Entry
}
protected function _onActivate(
\GtkEntry $entry
GtkEntry $entry
): void
{
$this->response->send();
}
protected function _onKeyRelease(
\GtkEntry $entry,
\GdkEvent $event
GtkEntry $entry,
GdkEvent $event
): void
{
$this->response->refresh();
}
protected function _onChanged(
\GtkEntry $entry
GtkEntry $entry
): void
{}
protected function _onFocusOut(
\GtkEntry $entry,
\GdkEvent $event
GtkEntry $entry,
GdkEvent $event
): void
{}

4
src/Entity/Browser/Container/Page/Response/Send.php

@ -4,6 +4,8 @@ declare(strict_types=1); @@ -4,6 +4,8 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Response;
use \GtkButton;
use \Yggverse\Yoda\Entity\Browser\Container\Page\Response;
class Send extends \Yggverse\Yoda\Abstract\Entity\Button
@ -25,7 +27,7 @@ class Send extends \Yggverse\Yoda\Abstract\Entity\Button @@ -25,7 +27,7 @@ class Send extends \Yggverse\Yoda\Abstract\Entity\Button
}
protected function _onCLick(
\GtkButton $entity
GtkButton $entity
): void
{
$this->response->send();

7
src/Entity/Browser/Container/Page/Title.php

@ -4,11 +4,14 @@ declare(strict_types=1); @@ -4,11 +4,14 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page;
use \GtkLabel;
use \Yggverse\Yoda\Entity\Browser\Container\Page;
class Title
{
public \GtkLabel $gtk;
// GTK
public GtkLabel $gtk;
// Extras
public ?string $subtitle = null;
@ -30,7 +33,7 @@ class Title @@ -30,7 +33,7 @@ class Title
$this->page = $page;
// Init container
$this->gtk = new \GtkLabel(
$this->gtk = new GtkLabel(
$this::VALUE
);

40
src/Entity/Browser/Container/Tab.php

@ -4,11 +4,19 @@ declare(strict_types=1); @@ -4,11 +4,19 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container;
use \Exception;
use \Gdk;
use \GdkEvent;
use \GtkEventBox;
use \GtkNotebook;
use \GtkWidget;
use \Yggverse\Yoda\Entity\Browser\Container;
class Tab
{
public \GtkNotebook $gtk;
// GTK
public GtkNotebook $gtk;
// Dependencies
public Container $container;
@ -27,7 +35,7 @@ class Tab @@ -27,7 +35,7 @@ class Tab
$this->container = $container;
// Init container
$this->gtk = new \GtkNotebook;
$this->gtk = new GtkNotebook;
$this->gtk->set_scrollable(
$this::SCROLLABLE
@ -51,8 +59,8 @@ class Tab @@ -51,8 +59,8 @@ class Tab
$this->gtk->connect(
'switch-page',
function (
?\GtkNotebook $self,
?\GtkWidget $child,
?GtkNotebook $self,
?GtkWidget $child,
int $page_num
) {
// Update header bar title
@ -62,7 +70,7 @@ class Tab @@ -62,7 +70,7 @@ class Tab
$page->title->getValue(),
$page->title->getSubtitle()
);
} else throw new \Exception;
} else throw new Exception;
// Keep current selection
$self->grab_focus();
@ -72,8 +80,8 @@ class Tab @@ -72,8 +80,8 @@ class Tab
$this->gtk->connect(
'page-added',
function (
?\GtkNotebook $self,
?\GtkWidget $child,
?GtkNotebook $self,
?GtkWidget $child,
int $page_num
) {
$this->reorder();
@ -83,8 +91,8 @@ class Tab @@ -83,8 +91,8 @@ class Tab
$this->gtk->connect(
'page-removed',
function (
?\GtkNotebook $self,
?\GtkWidget $child,
?GtkNotebook $self,
?GtkWidget $child,
int $page_num
) {
$this->reorder();
@ -94,8 +102,8 @@ class Tab @@ -94,8 +102,8 @@ class Tab
$this->gtk->connect(
'page-reordered',
function (
?\GtkNotebook $self,
?\GtkWidget $child,
?GtkNotebook $self,
?GtkWidget $child,
int $page_num
) {
$this->reorder();
@ -116,7 +124,7 @@ class Tab @@ -116,7 +124,7 @@ class Tab
);
// Create event box to listen for double click on title label
$label = new \GtkEventBox;
$label = new GtkEventBox;
$label->add(
$page->title->gtk
@ -127,11 +135,11 @@ class Tab @@ -127,11 +135,11 @@ class Tab
$label->connect(
'button-press-event',
function (
?\GtkEventBox $self,
?\GdkEvent $event
?GtkEventBox $self,
?GdkEvent $event
) {
// Close tab on double click
if ($event->type == \Gdk::DOUBLE_BUTTON_PRESS)
if ($event->type == Gdk::DOUBLE_BUTTON_PRESS)
{
$this->close();
}
@ -198,7 +206,7 @@ class Tab @@ -198,7 +206,7 @@ class Tab
// Validate page index exists
if (empty($this->_page[$page_num]))
{
throw new \Exception;
throw new Exception;
}
// Return page entity

10
src/Entity/Browser/Header/Tray.php

@ -4,11 +4,15 @@ declare(strict_types=1); @@ -4,11 +4,15 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Header;
use \GtkBox;
use \GtkOrientation;
use \Yggverse\Yoda\Entity\Browser\Header;
class Tray
{
public \GtkBox $gtk;
// GTK
public GtkBox $gtk;
// Dependencies
public Header $header;
@ -28,8 +32,8 @@ class Tray @@ -28,8 +32,8 @@ class Tray
$this->header = $header;
// Init header
$this->gtk = new \GtkBox(
\GtkOrientation::HORIZONTAL
$this->gtk = new GtkBox(
GtkOrientation::HORIZONTAL
);
$this->gtk->set_margin_start(

7
src/Entity/Browser/Header/Tray/Navigation.php

@ -4,12 +4,15 @@ declare(strict_types=1); @@ -4,12 +4,15 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Header\Tray;
use \GtkMenuButton;
use \Yggverse\Yoda\Entity\Browser\Header\Tray;
use \Yggverse\Yoda\Entity\Browser\Menu;
class Navigation
{
public \GtkMenuButton $gtk;
// GTK
public GtkMenuButton $gtk;
// Dependencies
public Tray $tray;
@ -27,7 +30,7 @@ class Navigation @@ -27,7 +30,7 @@ class Navigation
$this->tray = $tray;
// Init navigation container
$this->gtk = new \GtkMenuButton;
$this->gtk = new GtkMenuButton;
$this->gtk->set_tooltip_text(
_($this::TOOLTIP)

18
src/Entity/Browser/Header/Tray/Tab.php

@ -4,11 +4,17 @@ declare(strict_types=1); @@ -4,11 +4,17 @@ declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Header\Tray;
use \GtkButton;
use \GtkIconSize;
use \GtkIconTheme;
use \GtkImage;
use \Yggverse\Yoda\Entity\Browser\Header\Tray;
class Tab
{
public \GtkButton $gtk;
// GTK
public GtkButton $gtk;
// Dependencies
public Tray $tray;
@ -25,14 +31,14 @@ class Tab @@ -25,14 +31,14 @@ class Tab
$this->tray = $tray;
// Init GTK
$this->gtk = new \GtkButton;
$this->gtk = new GtkButton;
if (\GtkIconTheme::get_default()->has_icon($this::IMAGE))
if (GtkIconTheme::get_default()->has_icon($this::IMAGE))
{
$this->gtk->set_image(
\GtkImage::new_from_icon_name(
GtkImage::new_from_icon_name(
$this::IMAGE,
\GtkIconSize::BUTTON
GtkIconSize::BUTTON
)
);
}
@ -55,7 +61,7 @@ class Tab @@ -55,7 +61,7 @@ class Tab
$this->gtk->connect(
'clicked',
function(
\GtkButton $entity
GtkButton $entity
) {
$this->tray->header->browser->container->tab->append(
null,

Loading…
Cancel
Save