mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-06 16:34:13 +00:00
init tab submenu
This commit is contained in:
parent
c9306bb4cd
commit
494964e64a
1
Makefile
1
Makefile
@ -14,6 +14,7 @@ SRCS = src/main.cpp\
|
|||||||
src/app/browser/header/tab.cpp\
|
src/app/browser/header/tab.cpp\
|
||||||
src/app/browser/header/menu.cpp\
|
src/app/browser/header/menu.cpp\
|
||||||
src/app/browser/header/menu/main.cpp\
|
src/app/browser/header/menu/main.cpp\
|
||||||
|
src/app/browser/header/menu/main/tab.cpp\
|
||||||
src/app/browser/header/menu/main/debug.cpp\
|
src/app/browser/header/menu/main/debug.cpp\
|
||||||
src/app/browser/header/menu/main/quit.cpp
|
src/app/browser/header/menu/main/quit.cpp
|
||||||
|
|
||||||
|
@ -10,7 +10,22 @@ namespace app::browser::header::menu
|
|||||||
this->menu = menu;
|
this->menu = menu;
|
||||||
|
|
||||||
// Init model
|
// Init model
|
||||||
this->_model = g_menu_new();
|
this->model = g_menu_new();
|
||||||
|
|
||||||
|
// Init tab submenu
|
||||||
|
this->tab = new main::Tab(
|
||||||
|
this
|
||||||
|
);
|
||||||
|
|
||||||
|
g_menu_append_submenu(
|
||||||
|
G_MENU(
|
||||||
|
this->model
|
||||||
|
),
|
||||||
|
this->tab->LABEL,
|
||||||
|
G_MENU_MODEL(
|
||||||
|
this->tab->model
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Init debug menu
|
// Init debug menu
|
||||||
this->debug = new main::Debug(
|
this->debug = new main::Debug(
|
||||||
@ -19,7 +34,7 @@ namespace app::browser::header::menu
|
|||||||
|
|
||||||
g_menu_append_item(
|
g_menu_append_item(
|
||||||
G_MENU(
|
G_MENU(
|
||||||
this->_model
|
this->model
|
||||||
),
|
),
|
||||||
G_MENU_ITEM(
|
G_MENU_ITEM(
|
||||||
this->debug->item
|
this->debug->item
|
||||||
@ -33,7 +48,7 @@ namespace app::browser::header::menu
|
|||||||
|
|
||||||
g_menu_append_item(
|
g_menu_append_item(
|
||||||
G_MENU(
|
G_MENU(
|
||||||
this->_model
|
this->model
|
||||||
),
|
),
|
||||||
G_MENU_ITEM(
|
G_MENU_ITEM(
|
||||||
this->quit->item
|
this->quit->item
|
||||||
@ -43,7 +58,7 @@ namespace app::browser::header::menu
|
|||||||
// Create a new GtkPopoverMenu from the GMenuModel
|
// Create a new GtkPopoverMenu from the GMenuModel
|
||||||
this->gtk = gtk_popover_menu_new_from_model(
|
this->gtk = gtk_popover_menu_new_from_model(
|
||||||
G_MENU_MODEL(
|
G_MENU_MODEL(
|
||||||
this->_model
|
this->model
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "../menu.h"
|
#include "../menu.h"
|
||||||
|
|
||||||
// Requirements
|
// Requirements
|
||||||
|
#include "main/tab.h"
|
||||||
#include "main/debug.h"
|
#include "main/debug.h"
|
||||||
#include "main/quit.h"
|
#include "main/quit.h"
|
||||||
|
|
||||||
@ -16,25 +17,26 @@ namespace app::browser::header
|
|||||||
{
|
{
|
||||||
namespace main
|
namespace main
|
||||||
{
|
{
|
||||||
|
class Tab;
|
||||||
class Debug;
|
class Debug;
|
||||||
class Quit;
|
class Quit;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Main
|
class Main
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
|
|
||||||
GMenu* _model;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// GTK
|
// GTK
|
||||||
GtkWidget *gtk;
|
GtkWidget *gtk;
|
||||||
|
|
||||||
|
// Gio
|
||||||
|
GMenu* model;
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
Menu *menu;
|
Menu *menu;
|
||||||
|
|
||||||
// Requirements
|
// Requirements
|
||||||
|
main::Tab *tab;
|
||||||
main::Debug *debug;
|
main::Debug *debug;
|
||||||
main::Quit *quit;
|
main::Quit *quit;
|
||||||
|
|
||||||
|
22
src/app/browser/header/menu/main/tab.cpp
Normal file
22
src/app/browser/header/menu/main/tab.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include "tab.h"
|
||||||
|
|
||||||
|
namespace app::browser::header::menu::main
|
||||||
|
{
|
||||||
|
// Construct
|
||||||
|
Tab::Tab(
|
||||||
|
Main *main
|
||||||
|
) {
|
||||||
|
// Init dependencies
|
||||||
|
this->main = main;
|
||||||
|
|
||||||
|
// Init model
|
||||||
|
this->model = g_menu_new();
|
||||||
|
|
||||||
|
// Init menu
|
||||||
|
this->gtk = gtk_popover_menu_new_from_model(
|
||||||
|
G_MENU_MODEL(
|
||||||
|
this->model
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
38
src/app/browser/header/menu/main/tab.h
Normal file
38
src/app/browser/header/menu/main/tab.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef APP_BROWSER_HEADER_MENU_MAIN_TAB_H
|
||||||
|
#define APP_BROWSER_HEADER_MENU_MAIN_TAB_H
|
||||||
|
|
||||||
|
#include "../main.h"
|
||||||
|
|
||||||
|
namespace app::browser::header::menu
|
||||||
|
{
|
||||||
|
class Main;
|
||||||
|
|
||||||
|
namespace main
|
||||||
|
{
|
||||||
|
class Tab
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// GTK
|
||||||
|
GtkWidget *gtk;
|
||||||
|
|
||||||
|
// Gio
|
||||||
|
GMenu* model;
|
||||||
|
|
||||||
|
GMenuItem *item;
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
Main *main;
|
||||||
|
|
||||||
|
// Defaults
|
||||||
|
const gchar *LABEL = "Tab";
|
||||||
|
|
||||||
|
// Construct
|
||||||
|
Tab(
|
||||||
|
Main *main
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user