Browse Source

init tab class

CPP-GTK4
yggverse 4 months ago
parent
commit
3bcffc4326
  1. 1
      Makefile
  2. 14
      src/app/browser/container.cpp
  3. 14
      src/app/browser/container.h
  4. 31
      src/app/browser/container/tab.cpp
  5. 30
      src/app/browser/container/tab.h

1
Makefile

@ -8,6 +8,7 @@ TARGET = bin/Yoda @@ -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)

14
src/app/browser/container.cpp

@ -19,6 +19,20 @@ namespace app @@ -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
)
);
}
}
}

14
src/app/browser/container.h

@ -1,22 +1,36 @@ @@ -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
);

31
src/app/browser/container/tab.cpp

@ -0,0 +1,31 @@ @@ -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
)
);
}
}
}
}

30
src/app/browser/container/tab.h

@ -0,0 +1,30 @@ @@ -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
Loading…
Cancel
Save