mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
use tool parent menu for debug item
This commit is contained in:
parent
cb4c86bdac
commit
f124f20660
4 changed files with 73 additions and 15 deletions
|
|
@ -18,12 +18,12 @@ class Menu
|
|||
|
||||
// Requirements
|
||||
public Menu\Bookmark $bookmark;
|
||||
public Menu\Debug $debug;
|
||||
public Menu\File $file;
|
||||
public Menu\Help $help;
|
||||
public Menu\History $history;
|
||||
public Menu\Quit $quit;
|
||||
public Menu\Tab $tab;
|
||||
public Menu\Tool $tool;
|
||||
|
||||
public function __construct(
|
||||
Browser $browser
|
||||
|
|
@ -70,13 +70,13 @@ class Menu
|
|||
$this->history->gtk
|
||||
);
|
||||
|
||||
// Init debug menu item
|
||||
$this->debug = new Menu\Debug(
|
||||
// Init tool menu item
|
||||
$this->tool = new Menu\Tool(
|
||||
$this
|
||||
);
|
||||
|
||||
$this->gtk->append(
|
||||
$this->debug->gtk
|
||||
$this->tool->gtk
|
||||
);
|
||||
|
||||
// Init help menu item
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class Help
|
|||
|
||||
// Requirements
|
||||
public Help\About $about;
|
||||
public Help\Debug $debug;
|
||||
public Help\Gemlog $gemlog;
|
||||
public Help\Issue $issue;
|
||||
|
||||
|
|
@ -37,14 +38,14 @@ class Help
|
|||
);
|
||||
|
||||
// Init submenu container
|
||||
$tab = new GtkMenu;
|
||||
$help = new GtkMenu;
|
||||
|
||||
// Init about menu item
|
||||
$this->about = new Help\About(
|
||||
$this
|
||||
);
|
||||
|
||||
$tab->append(
|
||||
$help->append(
|
||||
$this->about->gtk
|
||||
);
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ class Help
|
|||
$this
|
||||
);
|
||||
|
||||
$tab->append(
|
||||
$help->append(
|
||||
$this->gemlog->gtk
|
||||
);
|
||||
|
||||
|
|
@ -62,12 +63,13 @@ class Help
|
|||
$this
|
||||
);
|
||||
|
||||
$tab->append(
|
||||
$help->append(
|
||||
$this->issue->gtk
|
||||
);
|
||||
|
||||
// Set submenu
|
||||
$this->gtk->set_submenu(
|
||||
$tab
|
||||
$help
|
||||
);
|
||||
|
||||
// Render
|
||||
|
|
|
|||
56
src/Entity/Browser/Menu/Tool.php
Normal file
56
src/Entity/Browser/Menu/Tool.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yggverse\Yoda\Entity\Browser\Menu;
|
||||
|
||||
use \GtkMenu;
|
||||
use \GtkMenuItem;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu;
|
||||
|
||||
class Tool
|
||||
{
|
||||
// GTK
|
||||
public GtkMenuItem $gtk;
|
||||
|
||||
// Dependencies
|
||||
public Menu $menu;
|
||||
|
||||
// Requirements
|
||||
public Tool\Debug $debug;
|
||||
|
||||
// Defaults
|
||||
public const LABEL = 'Tool';
|
||||
|
||||
public function __construct(
|
||||
Menu $menu
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->menu = $menu;
|
||||
|
||||
// Init menu item
|
||||
$this->gtk = GtkMenuItem::new_with_label(
|
||||
$this::LABEL
|
||||
);
|
||||
|
||||
// Init submenu container
|
||||
$tool = new GtkMenu;
|
||||
|
||||
// Init debug menu item
|
||||
$this->debug = new Tool\Debug(
|
||||
$this
|
||||
);
|
||||
|
||||
$tool->append(
|
||||
$this->debug->gtk
|
||||
);
|
||||
|
||||
$this->gtk->set_submenu(
|
||||
$tool
|
||||
);
|
||||
|
||||
// Render
|
||||
$this->gtk->show();
|
||||
}
|
||||
}
|
||||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Yggverse\Yoda\Entity\Browser\Menu;
|
||||
namespace Yggverse\Yoda\Entity\Browser\Menu\Tool;
|
||||
|
||||
use \GtkMenuItem;
|
||||
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu;
|
||||
use \Yggverse\Yoda\Entity\Browser\Menu\Tool;
|
||||
|
||||
class Debug
|
||||
{
|
||||
|
|
@ -14,16 +14,16 @@ class Debug
|
|||
public GtkMenuItem $gtk;
|
||||
|
||||
// Dependencies
|
||||
public Menu $menu;
|
||||
public Tool $tool;
|
||||
|
||||
// Defaults
|
||||
public const LABEL = 'Debug';
|
||||
|
||||
public function __construct(
|
||||
Menu $menu
|
||||
Tool $tool
|
||||
) {
|
||||
// Init dependencies
|
||||
$this->menu = $menu;
|
||||
$this->tool = $tool;
|
||||
|
||||
// Init menu item
|
||||
$this->gtk = GtkMenuItem::new_with_label(
|
||||
|
|
@ -38,7 +38,7 @@ class Debug
|
|||
'activate',
|
||||
function()
|
||||
{
|
||||
$this->menu->browser->gtk->set_interactive_debugging(
|
||||
$this->tool->menu->browser->gtk->set_interactive_debugging(
|
||||
true
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue