init new tab button

This commit is contained in:
yggverse 2024-08-06 21:07:55 +03:00
parent 00920d39a9
commit 2fc4ac9541
5 changed files with 79 additions and 0 deletions

View File

@ -11,6 +11,7 @@ SRCS = src/main.cpp\
src/app/browser/container/page.cpp\
src/app/browser/container/tab.cpp\
src/app/browser/header.cpp\
src/app/browser/header/tab.cpp\
src/app/browser/header/bar.cpp\
src/app/browser/header/bar/menu.cpp\
src/app/browser/header/bar/menu/main.cpp\

View File

@ -29,6 +29,18 @@ namespace app
(new header::Bar(this))->gtk // @TODO
);
// Init new tab button
this->tab = new header::Tab(
this
);
gtk_header_bar_pack_start(
GTK_HEADER_BAR(
this->gtk
),
this->tab->gtk
);
// Render
gtk_widget_show(
GTK_WIDGET(

View File

@ -6,6 +6,7 @@
// Requirements
#include "header/bar.h"
#include "header/tab.h"
namespace app
{
@ -16,6 +17,7 @@ namespace app
namespace header
{
class Bar;
class Tab;
}
class Header
@ -33,6 +35,7 @@ namespace app
// Requirements
header::Bar *bar;
header::Tab *tab;
Header(
Browser *browser

View File

@ -0,0 +1,29 @@
#include "tab.h"
namespace app::browser::header
{
// Construct
Tab::Tab(
Header *header
) {
// Init dependencies
this->header = header;
// Init GTK
this->gtk = gtk_button_new();
gtk_button_set_label (
GTK_BUTTON(
this->gtk
),
Tab::LABEL
);
// Render
gtk_widget_show(
GTK_WIDGET(
this->gtk
)
);
}
}

View File

@ -0,0 +1,34 @@
#ifndef APP_BROWSER_HEADER_TAB_H
#define APP_BROWSER_HEADER_TAB_H
// Dependencies
#include "../header.h"
namespace app::browser
{
class Header;
namespace header
{
class Tab
{
public:
// GTK
GtkWidget *gtk;
// Dependencies
Header *header;
// Defaults
const gchar *LABEL = "New tab";
// Constructor
Tab(
Header *header
);
};
};
};
#endif