Browse Source

implement main menu popover (container)

CPP-GTK4
yggverse 5 months ago
parent
commit
5075798b0e
  1. 3
      Makefile
  2. 19
      src/app/browser/header/bar/menu.cpp
  3. 17
      src/app/browser/header/bar/menu.h
  4. 15
      src/app/browser/header/bar/menu/main.cpp
  5. 37
      src/app/browser/header/bar/menu/main.h

3
Makefile

@ -13,7 +13,8 @@ SRCS = src/main.cpp\ @@ -13,7 +13,8 @@ SRCS = src/main.cpp\
src/app/browser/header.cpp\
src/app/browser/header/bar.cpp\
src/app/browser/header/bar/title.cpp\
src/app/browser/header/bar/menu.cpp
src/app/browser/header/bar/menu.cpp\
src/app/browser/header/bar/menu/main.cpp
OBJS = $(SRCS:.cpp=.o)

19
src/app/browser/header/bar/menu.cpp

@ -6,9 +6,28 @@ namespace app::browser::header::bar @@ -6,9 +6,28 @@ namespace app::browser::header::bar
Menu::Menu(
Bar *bar
) {
// Init dependencies
this->bar = bar;
// Init GTK
this->gtk = gtk_menu_button_new();
// Init requirements
this->main = new menu::Main(
this
);
// Init main popover
gtk_menu_button_set_popover(
GTK_MENU_BUTTON(
this->gtk
),
GTK_WIDGET(
this->main->gtk
)
);
// Render
gtk_widget_show(
GTK_WIDGET(
this->gtk

17
src/app/browser/header/bar/menu.h

@ -1,20 +1,37 @@ @@ -1,20 +1,37 @@
#ifndef APP_BROWSER_HEADER_BAR_MENU_H
#define APP_BROWSER_HEADER_BAR_MENU_H
// Dependencies
#include "../bar.h"
// Requirements
#include "menu/main.h"
namespace app::browser::header
{
class Bar;
namespace bar
{
namespace menu
{
class Main;
};
class Menu
{
public:
// GTK
GtkWidget *gtk;
// Dependencies
Bar *bar;
// Requirements
menu::Main *main;
// Constructor
Menu(
Bar *bar
);

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

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
#include "main.h"
namespace app::browser::header::bar::menu
{
// Construct
Main::Main(
Menu *menu
) {
// Init dependencies
this->menu = menu;
// Init GTK
this->gtk = gtk_popover_new();
}
}

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

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
#ifndef APP_BROWSER_HEADER_BAR_MENU_MAIN_H
#define APP_BROWSER_HEADER_BAR_MENU_MAIN_H
// Dependencies
#include "../menu.h"
// Requirements
// ..
namespace app::browser::header::bar
{
class Menu;
namespace menu
{
class Main
{
public:
// GTK
GtkWidget *gtk;
// Dependencies
Menu *menu;
// Requirements
// ..
// Constructor
Main(
Menu *menu
);
};
};
};
#endif
Loading…
Cancel
Save