From 5075798b0e03e237ffbb09c801138dec2f65cef1 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 5 Aug 2024 19:08:38 +0300 Subject: [PATCH] implement main menu popover (container) --- Makefile | 3 +- src/app/browser/header/bar/menu.cpp | 19 ++++++++++++ src/app/browser/header/bar/menu.h | 17 +++++++++++ src/app/browser/header/bar/menu/main.cpp | 15 ++++++++++ src/app/browser/header/bar/menu/main.h | 37 ++++++++++++++++++++++++ 5 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 src/app/browser/header/bar/menu/main.cpp create mode 100644 src/app/browser/header/bar/menu/main.h diff --git a/Makefile b/Makefile index c167d266..2e49bf6c 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/src/app/browser/header/bar/menu.cpp b/src/app/browser/header/bar/menu.cpp index 198a4c59..e022c573 100644 --- a/src/app/browser/header/bar/menu.cpp +++ b/src/app/browser/header/bar/menu.cpp @@ -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 diff --git a/src/app/browser/header/bar/menu.h b/src/app/browser/header/bar/menu.h index 6d17caca..38de3794 100644 --- a/src/app/browser/header/bar/menu.h +++ b/src/app/browser/header/bar/menu.h @@ -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 ); diff --git a/src/app/browser/header/bar/menu/main.cpp b/src/app/browser/header/bar/menu/main.cpp new file mode 100644 index 00000000..7311dbde --- /dev/null +++ b/src/app/browser/header/bar/menu/main.cpp @@ -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(); + } +} diff --git a/src/app/browser/header/bar/menu/main.h b/src/app/browser/header/bar/menu/main.h new file mode 100644 index 00000000..378f91b3 --- /dev/null +++ b/src/app/browser/header/bar/menu/main.h @@ -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 \ No newline at end of file