Browse Source

implement popover menu

CPP-GTK4
yggverse 3 months ago
parent
commit
37f109bec4
  1. 25
      src/app/browser/header/bar/menu/main.cpp
  2. 13
      src/app/browser/header/bar/menu/main.h

25
src/app/browser/header/bar/menu/main.cpp

@ -9,7 +9,28 @@ namespace app::browser::header::bar::menu
// Init dependencies // Init dependencies
this->menu = menu; this->menu = menu;
// Init GTK // Init GMenu Model
this->gtk = gtk_popover_new(); this->_model = g_menu_new();
// Init menu items
this->quit = new main::Quit(
this
);
g_menu_append_item(
G_MENU(
this->_model
),
G_MENU_ITEM(
this->quit->item
)
);
// Create a new GtkPopoverMenu from the GMenuModel
this->gtk = gtk_popover_menu_new_from_model(
G_MENU_MODEL(
this->_model
)
);
} }
} }

13
src/app/browser/header/bar/menu/main.h

@ -5,7 +5,7 @@
#include "../menu.h" #include "../menu.h"
// Requirements // Requirements
// .. #include "main/quit.h"
namespace app::browser::header::bar namespace app::browser::header::bar
{ {
@ -13,8 +13,17 @@ namespace app::browser::header::bar
namespace menu namespace menu
{ {
namespace main
{
class Quit;
};
class Main class Main
{ {
private:
GMenu* _model;
public: public:
// GTK // GTK
@ -24,7 +33,7 @@ namespace app::browser::header::bar
Menu *menu; Menu *menu;
// Requirements // Requirements
// .. main::Quit *quit;
// Constructor // Constructor
Main( Main(

Loading…
Cancel
Save