add debug menu item

This commit is contained in:
yggverse 2024-07-26 23:02:19 +03:00
parent 7135d668c9
commit a8cca0ed5b
3 changed files with 64 additions and 2 deletions

View file

@ -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
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

View 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
);
}
);
}
}