mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
implement help menu
This commit is contained in:
parent
d825e3b25a
commit
cb4c86bdac
5 changed files with 233 additions and 5 deletions
|
|
@ -20,6 +20,7 @@ class Menu
|
||||||
public Menu\Bookmark $bookmark;
|
public Menu\Bookmark $bookmark;
|
||||||
public Menu\Debug $debug;
|
public Menu\Debug $debug;
|
||||||
public Menu\File $file;
|
public Menu\File $file;
|
||||||
|
public Menu\Help $help;
|
||||||
public Menu\History $history;
|
public Menu\History $history;
|
||||||
public Menu\Quit $quit;
|
public Menu\Quit $quit;
|
||||||
public Menu\Tab $tab;
|
public Menu\Tab $tab;
|
||||||
|
|
@ -69,11 +70,6 @@ class Menu
|
||||||
$this->history->gtk
|
$this->history->gtk
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add separator
|
|
||||||
$this->gtk->append(
|
|
||||||
new GtkSeparatorMenuItem
|
|
||||||
);
|
|
||||||
|
|
||||||
// Init debug menu item
|
// Init debug menu item
|
||||||
$this->debug = new Menu\Debug(
|
$this->debug = new Menu\Debug(
|
||||||
$this
|
$this
|
||||||
|
|
@ -83,6 +79,20 @@ class Menu
|
||||||
$this->debug->gtk
|
$this->debug->gtk
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Init help menu item
|
||||||
|
$this->help = new Menu\Help(
|
||||||
|
$this
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->gtk->append(
|
||||||
|
$this->help->gtk
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add separator
|
||||||
|
$this->gtk->append(
|
||||||
|
new GtkSeparatorMenuItem
|
||||||
|
);
|
||||||
|
|
||||||
// Init quit menu item
|
// Init quit menu item
|
||||||
$this->quit = new Menu\Quit(
|
$this->quit = new Menu\Quit(
|
||||||
$this
|
$this
|
||||||
|
|
|
||||||
76
src/Entity/Browser/Menu/Help.php
Normal file
76
src/Entity/Browser/Menu/Help.php
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Yggverse\Yoda\Entity\Browser\Menu;
|
||||||
|
|
||||||
|
use \GtkMenu;
|
||||||
|
use \GtkMenuItem;
|
||||||
|
|
||||||
|
use \Yggverse\Yoda\Entity\Browser\Menu;
|
||||||
|
|
||||||
|
class Help
|
||||||
|
{
|
||||||
|
// GTK
|
||||||
|
public GtkMenuItem $gtk;
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
public Menu $menu;
|
||||||
|
|
||||||
|
// Requirements
|
||||||
|
public Help\About $about;
|
||||||
|
public Help\Gemlog $gemlog;
|
||||||
|
public Help\Issue $issue;
|
||||||
|
|
||||||
|
// Defaults
|
||||||
|
public const LABEL = 'Help';
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
Menu $menu
|
||||||
|
) {
|
||||||
|
// Init dependencies
|
||||||
|
$this->menu = $menu;
|
||||||
|
|
||||||
|
// Init menu item
|
||||||
|
$this->gtk = GtkMenuItem::new_with_label(
|
||||||
|
$this::LABEL
|
||||||
|
);
|
||||||
|
|
||||||
|
// Init submenu container
|
||||||
|
$tab = new GtkMenu;
|
||||||
|
|
||||||
|
// Init about menu item
|
||||||
|
$this->about = new Help\About(
|
||||||
|
$this
|
||||||
|
);
|
||||||
|
|
||||||
|
$tab->append(
|
||||||
|
$this->about->gtk
|
||||||
|
);
|
||||||
|
|
||||||
|
// Init gemlog menu item
|
||||||
|
$this->gemlog = new Help\Gemlog(
|
||||||
|
$this
|
||||||
|
);
|
||||||
|
|
||||||
|
$tab->append(
|
||||||
|
$this->gemlog->gtk
|
||||||
|
);
|
||||||
|
|
||||||
|
// Init issue menu item
|
||||||
|
$this->issue = new Help\Issue(
|
||||||
|
$this
|
||||||
|
);
|
||||||
|
|
||||||
|
$tab->append(
|
||||||
|
$this->issue->gtk
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->gtk->set_submenu(
|
||||||
|
$tab
|
||||||
|
);
|
||||||
|
|
||||||
|
// Render
|
||||||
|
$this->gtk->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
46
src/Entity/Browser/Menu/Help/About.php
Normal file
46
src/Entity/Browser/Menu/Help/About.php
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Yggverse\Yoda\Entity\Browser\Menu\Help;
|
||||||
|
|
||||||
|
use \Gtk;
|
||||||
|
use \GtkMenuItem;
|
||||||
|
|
||||||
|
use \Yggverse\Yoda\Entity\Browser\Menu\Help;
|
||||||
|
|
||||||
|
class About
|
||||||
|
{
|
||||||
|
// GTK
|
||||||
|
public GtkMenuItem $gtk;
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
public Help $help;
|
||||||
|
|
||||||
|
// Defaults
|
||||||
|
public const LABEL = 'About';
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
Help $help
|
||||||
|
) {
|
||||||
|
// Init dependencies
|
||||||
|
$this->help = $help;
|
||||||
|
|
||||||
|
// Init menu item
|
||||||
|
$this->gtk = GtkMenuItem::new_with_label(
|
||||||
|
$this::LABEL
|
||||||
|
);
|
||||||
|
|
||||||
|
// Render
|
||||||
|
$this->gtk->show();
|
||||||
|
|
||||||
|
// Int events
|
||||||
|
$this->gtk->connect(
|
||||||
|
'activate',
|
||||||
|
function()
|
||||||
|
{
|
||||||
|
// @TODO
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
49
src/Entity/Browser/Menu/Help/Gemlog.php
Normal file
49
src/Entity/Browser/Menu/Help/Gemlog.php
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Yggverse\Yoda\Entity\Browser\Menu\Help;
|
||||||
|
|
||||||
|
use \Gtk;
|
||||||
|
use \GtkMenuItem;
|
||||||
|
|
||||||
|
use \Yggverse\Yoda\Entity\Browser\Menu\Help;
|
||||||
|
|
||||||
|
class Gemlog
|
||||||
|
{
|
||||||
|
// GTK
|
||||||
|
public GtkMenuItem $gtk;
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
public Help $help;
|
||||||
|
|
||||||
|
// Defaults
|
||||||
|
public const LABEL = 'Gemlog';
|
||||||
|
public const URL = 'gemini://yggverse.cities.yesterweb.org';
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
Help $help
|
||||||
|
) {
|
||||||
|
// Init dependencies
|
||||||
|
$this->help = $help;
|
||||||
|
|
||||||
|
// Init menu item
|
||||||
|
$this->gtk = GtkMenuItem::new_with_label(
|
||||||
|
$this::LABEL
|
||||||
|
);
|
||||||
|
|
||||||
|
// Render
|
||||||
|
$this->gtk->show();
|
||||||
|
|
||||||
|
// Int events
|
||||||
|
$this->gtk->connect(
|
||||||
|
'activate',
|
||||||
|
function()
|
||||||
|
{
|
||||||
|
$this->help->menu->browser->container->tab->append(
|
||||||
|
self::URL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
47
src/Entity/Browser/Menu/Help/Issue.php
Normal file
47
src/Entity/Browser/Menu/Help/Issue.php
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Yggverse\Yoda\Entity\Browser\Menu\Help;
|
||||||
|
|
||||||
|
use \Gtk;
|
||||||
|
use \GtkMenuItem;
|
||||||
|
|
||||||
|
use \Yggverse\Yoda\Entity\Browser\Menu\Help;
|
||||||
|
|
||||||
|
class Issue
|
||||||
|
{
|
||||||
|
// GTK
|
||||||
|
public GtkMenuItem $gtk;
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
public Help $help;
|
||||||
|
|
||||||
|
// Defaults
|
||||||
|
public const LABEL = 'Report issue';
|
||||||
|
public const URL = 'https://github.com/YGGverse/Yoda';
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
Help $help
|
||||||
|
) {
|
||||||
|
// Init dependencies
|
||||||
|
$this->help = $help;
|
||||||
|
|
||||||
|
// Init menu item
|
||||||
|
$this->gtk = GtkMenuItem::new_with_label(
|
||||||
|
$this::LABEL
|
||||||
|
);
|
||||||
|
|
||||||
|
// Render
|
||||||
|
$this->gtk->show();
|
||||||
|
|
||||||
|
// Int events
|
||||||
|
$this->gtk->connect(
|
||||||
|
'activate',
|
||||||
|
function()
|
||||||
|
{
|
||||||
|
// @TODO self::URL
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue