From f6e855e4b294ec118775e74bc405fbaf15be8dd5 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 5 Aug 2024 05:56:45 +0300 Subject: [PATCH] init header menu --- Makefile | 3 ++- src/app/browser/header.cpp | 12 ++++++++++++ src/app/browser/header.h | 14 ++++++++++++++ src/app/browser/menu.cpp | 21 +++++++++++++++++++++ src/app/browser/menu.h | 25 +++++++++++++++++++++++++ 5 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 src/app/browser/menu.cpp create mode 100644 src/app/browser/menu.h diff --git a/Makefile b/Makefile index 802fe3a3..5862e339 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,8 @@ SRCS = src/main.cpp\ src/app/browser/container.cpp\ src/app/browser/container/page.cpp\ src/app/browser/container/tab.cpp\ - src/app/browser/header.cpp + src/app/browser/header.cpp\ + src/app/browser/menu.cpp OBJS = $(SRCS:.cpp=.o) diff --git a/src/app/browser/header.cpp b/src/app/browser/header.cpp index 4bbf8504..4bb9dbd5 100644 --- a/src/app/browser/header.cpp +++ b/src/app/browser/header.cpp @@ -8,6 +8,9 @@ namespace app Header::Header( Browser *browser ) { + // Init dependencies + this->browser = browser; + // Init GTK this->gtk = gtk_header_bar_new(); @@ -18,6 +21,15 @@ namespace app Header::SHOW_TITLE_BUTTONS ); + // Init title widget + gtk_header_bar_set_title_widget( + GTK_HEADER_BAR( + this->gtk + ), + (new Menu(this->browser))->gtk // @TODO + ); + + // Render gtk_widget_show( GTK_WIDGET( this->gtk diff --git a/src/app/browser/header.h b/src/app/browser/header.h index 36df7803..7d3c38d8 100644 --- a/src/app/browser/header.h +++ b/src/app/browser/header.h @@ -1,22 +1,36 @@ #ifndef APP_BROWSER_HEADER_H #define APP_BROWSER_HEADER_H +// Dependencies #include "../browser.h" +// Requirements +#include "menu.h" + namespace app { class Browser; namespace browser { + class Menu; + class Header { public: + // GTK GtkWidget *gtk; + // Defaults const gboolean SHOW_TITLE_BUTTONS = true; + // Dependencies + Browser *browser; + + // Requirements + Menu *menu; + Header( Browser *browser ); diff --git a/src/app/browser/menu.cpp b/src/app/browser/menu.cpp new file mode 100644 index 00000000..7cec68b3 --- /dev/null +++ b/src/app/browser/menu.cpp @@ -0,0 +1,21 @@ +#include "header.h" + +namespace app +{ + namespace browser + { + // Construct + Menu::Menu( + Browser *browser + ) { + // Init GTK + this->gtk = gtk_menu_button_new(); + + gtk_widget_show( + GTK_WIDGET( + this->gtk + ) + ); + } + } +} diff --git a/src/app/browser/menu.h b/src/app/browser/menu.h new file mode 100644 index 00000000..027dbeed --- /dev/null +++ b/src/app/browser/menu.h @@ -0,0 +1,25 @@ +#ifndef APP_BROWSER_MENU_H +#define APP_BROWSER_MENU_H + +#include "../menu.h" + +namespace app +{ + class Browser; + + namespace browser + { + class Menu + { + public: + + GtkWidget *gtk; + + Menu( + Browser *browser + ); + }; + }; +}; + +#endif \ No newline at end of file