Browse Source

init new tab button

CPP-GTK4
yggverse 4 months ago
parent
commit
2fc4ac9541
  1. 1
      Makefile
  2. 12
      src/app/browser/header.cpp
  3. 3
      src/app/browser/header.h
  4. 29
      src/app/browser/header/tab.cpp
  5. 34
      src/app/browser/header/tab.h

1
Makefile

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

12
src/app/browser/header.cpp

@ -29,6 +29,18 @@ namespace app
(new header::Bar(this))->gtk // @TODO (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 // Render
gtk_widget_show( gtk_widget_show(
GTK_WIDGET( GTK_WIDGET(

3
src/app/browser/header.h

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

29
src/app/browser/header/tab.cpp

@ -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
)
);
}
}

34
src/app/browser/header/tab.h

@ -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
Loading…
Cancel
Save