Browse Source

add debug menu item

PHP-GTK3
yggverse 3 months ago
parent
commit
a8cca0ed5b
  1. 5
      src/Entity/Browser.php
  2. 14
      src/Entity/Browser/Menu.php
  3. 47
      src/Entity/Browser/Menu/Debug.php

5
src/Entity/Browser.php

@ -28,6 +28,7 @@ class Browser @@ -28,6 +28,7 @@ class Browser
public const WIDTH = 640;
public const HEIGHT = 640;
public const MAXIMIZE = true;
public const DEBUG = false;
public function __construct(
Database $database
@ -38,6 +39,10 @@ class Browser @@ -38,6 +39,10 @@ class Browser
// Init window
$this->gtk = new GtkWindow;
$this->gtk->set_interactive_debugging(
$this::DEBUG
);
$this->gtk->set_size_request(
$this::WIDTH,
$this::HEIGHT

14
src/Entity/Browser/Menu.php

@ -17,11 +17,12 @@ class Menu @@ -17,11 +17,12 @@ class Menu
public Browser $browser;
// Requirements
public Menu\File $file;
public Menu\Tab $tab;
public Menu\Bookmark $bookmark;
public Menu\Debug $debug;
public Menu\File $file;
public Menu\History $history;
public Menu\Quit $quit;
public Menu\Tab $tab;
public function __construct(
Browser $browser
@ -73,6 +74,15 @@ class Menu @@ -73,6 +74,15 @@ class Menu
new GtkSeparatorMenuItem
);
// Init debug menu item
$this->debug = new Menu\Debug(
$this
);
$this->gtk->append(
$this->debug->gtk
);
// Init quit menu item
$this->quit = new Menu\Quit(
$this

47
src/Entity/Browser/Menu/Debug.php

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Menu;
use \GtkMenuItem;
use \Yggverse\Yoda\Entity\Browser\Menu;
class Debug
{
// GTK
public GtkMenuItem $gtk;
// Dependencies
public Menu $menu;
// Defaults
public const LABEL = 'Debug';
public function __construct(
Menu $menu
) {
// Init dependencies
$this->menu = $menu;
// Init menu item
$this->gtk = GtkMenuItem::new_with_label(
$this::LABEL
);
// Render
$this->gtk->show();
// Int events
$this->gtk->connect(
'activate',
function()
{
$this->menu->browser->gtk->set_interactive_debugging(
true
);
}
);
}
}
Loading…
Cancel
Save