Browse Source

use tool parent menu for debug item

PHP-GTK3
yggverse 4 months ago
parent
commit
f124f20660
  1. 8
      src/Entity/Browser/Menu.php
  2. 12
      src/Entity/Browser/Menu/Help.php
  3. 56
      src/Entity/Browser/Menu/Tool.php
  4. 12
      src/Entity/Browser/Menu/Tool/Debug.php

8
src/Entity/Browser/Menu.php

@ -18,12 +18,12 @@ class Menu @@ -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 @@ -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

12
src/Entity/Browser/Menu/Help.php

@ -19,6 +19,7 @@ class Help @@ -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 @@ -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 @@ -53,7 +54,7 @@ class Help
$this
);
$tab->append(
$help->append(
$this->gemlog->gtk
);
@ -62,12 +63,13 @@ class Help @@ -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

@ -0,0 +1,56 @@ @@ -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();
}
}

12
src/Entity/Browser/Menu/Debug.php → src/Entity/Browser/Menu/Tool/Debug.php

@ -2,11 +2,11 @@ @@ -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 @@ -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 @@ -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…
Cancel
Save