From 3bcffc43265248f9d69d6892910c43d2059bda0c Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 5 Aug 2024 03:52:02 +0300 Subject: [PATCH] init tab class --- Makefile | 1 + src/app/browser/container.cpp | 14 ++++++++++++++ src/app/browser/container.h | 14 ++++++++++++++ src/app/browser/container/tab.cpp | 31 +++++++++++++++++++++++++++++++ src/app/browser/container/tab.h | 30 ++++++++++++++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100644 src/app/browser/container/tab.cpp create mode 100644 src/app/browser/container/tab.h diff --git a/Makefile b/Makefile index 301b7a65..a9f322eb 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ TARGET = bin/Yoda SRCS = src/main.cpp\ src/app/browser.cpp\ src/app/browser/container.cpp\ + src/app/browser/container/tab.cpp\ src/app/browser/header.cpp OBJS = $(SRCS:.cpp=.o) diff --git a/src/app/browser/container.cpp b/src/app/browser/container.cpp index c5c2a748..b6a01076 100644 --- a/src/app/browser/container.cpp +++ b/src/app/browser/container.cpp @@ -19,6 +19,20 @@ namespace app this->gtk ) ); + + // Init tab + this->tab = new container::Tab( + this + ); + + gtk_box_append( + GTK_BOX( + this->gtk + ), + GTK_WIDGET( + this->tab + ) + ); } } } diff --git a/src/app/browser/container.h b/src/app/browser/container.h index 62f2298b..4981684d 100644 --- a/src/app/browser/container.h +++ b/src/app/browser/container.h @@ -1,22 +1,36 @@ #ifndef APP_BROWSER_CONTAINER_H #define APP_BROWSER_CONTAINER_H +// Dependencies #include "../browser.h" +// Requirements +#include "container/tab.h" + namespace app { class Browser; namespace browser { + namespace container + { + class Tab; + } + class Container { public: + // GTK GtkWidget *gtk; + // Defaults const gint SPACING = 0; + // Requirements + container::Tab *tab; + Container( Browser *browser ); diff --git a/src/app/browser/container/tab.cpp b/src/app/browser/container/tab.cpp new file mode 100644 index 00000000..3ae6e33b --- /dev/null +++ b/src/app/browser/container/tab.cpp @@ -0,0 +1,31 @@ +#include "tab.h" + +namespace app +{ + namespace browser + { + namespace container + { + // Construct + Tab::Tab( + Container *container + ) { + // Init GTK + this->gtk = gtk_notebook_new(); + + gtk_notebook_set_scrollable( + GTK_NOTEBOOK( + this->gtk + ), + Tab::SCROLLABLE + ); + + gtk_widget_show( + GTK_WIDGET( + this->gtk + ) + ); + } + } + } +} diff --git a/src/app/browser/container/tab.h b/src/app/browser/container/tab.h new file mode 100644 index 00000000..eeb9b3a3 --- /dev/null +++ b/src/app/browser/container/tab.h @@ -0,0 +1,30 @@ +#ifndef APP_BROWSER_CONTAINER_TAB_H +#define APP_BROWSER_CONTAINER_TAB_H + +#include "../container.h" + +namespace app +{ + namespace browser + { + class Container; + + namespace container + { + class Tab + { + public: + + GtkWidget *gtk; + + const gboolean SCROLLABLE = true; + + Tab( + Container *container + ); + }; + }; + }; +}; + +#endif \ No newline at end of file