mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
add debug menu item
This commit is contained in:
parent
7135d668c9
commit
a8cca0ed5b
3 changed files with 64 additions and 2 deletions
|
|
@ -28,6 +28,7 @@ class Browser
|
||||||
public const WIDTH = 640;
|
public const WIDTH = 640;
|
||||||
public const HEIGHT = 640;
|
public const HEIGHT = 640;
|
||||||
public const MAXIMIZE = true;
|
public const MAXIMIZE = true;
|
||||||
|
public const DEBUG = false;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Database $database
|
Database $database
|
||||||
|
|
@ -38,6 +39,10 @@ class Browser
|
||||||
// Init window
|
// Init window
|
||||||
$this->gtk = new GtkWindow;
|
$this->gtk = new GtkWindow;
|
||||||
|
|
||||||
|
$this->gtk->set_interactive_debugging(
|
||||||
|
$this::DEBUG
|
||||||
|
);
|
||||||
|
|
||||||
$this->gtk->set_size_request(
|
$this->gtk->set_size_request(
|
||||||
$this::WIDTH,
|
$this::WIDTH,
|
||||||
$this::HEIGHT
|
$this::HEIGHT
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,12 @@ class Menu
|
||||||
public Browser $browser;
|
public Browser $browser;
|
||||||
|
|
||||||
// Requirements
|
// Requirements
|
||||||
public Menu\File $file;
|
|
||||||
public Menu\Tab $tab;
|
|
||||||
public Menu\Bookmark $bookmark;
|
public Menu\Bookmark $bookmark;
|
||||||
|
public Menu\Debug $debug;
|
||||||
|
public Menu\File $file;
|
||||||
public Menu\History $history;
|
public Menu\History $history;
|
||||||
public Menu\Quit $quit;
|
public Menu\Quit $quit;
|
||||||
|
public Menu\Tab $tab;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Browser $browser
|
Browser $browser
|
||||||
|
|
@ -73,6 +74,15 @@ class Menu
|
||||||
new GtkSeparatorMenuItem
|
new GtkSeparatorMenuItem
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Init debug menu item
|
||||||
|
$this->debug = new Menu\Debug(
|
||||||
|
$this
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->gtk->append(
|
||||||
|
$this->debug->gtk
|
||||||
|
);
|
||||||
|
|
||||||
// Init quit menu item
|
// Init quit menu item
|
||||||
$this->quit = new Menu\Quit(
|
$this->quit = new Menu\Quit(
|
||||||
$this
|
$this
|
||||||
|
|
|
||||||
47
src/Entity/Browser/Menu/Debug.php
Normal file
47
src/Entity/Browser/Menu/Debug.php
Normal file
|
|
@ -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…
Add table
Add a link
Reference in a new issue