draft main tab features

This commit is contained in:
yggverse 2024-08-11 22:04:34 +03:00
parent aa4b15076b
commit ee890b9859
11 changed files with 142 additions and 27 deletions

View file

@ -13,8 +13,8 @@ Menu::Menu()
auto tab = Gio::Menu::create();
tab->append(
_("New tab"),
"tab.new"
_("New tab.."),
"win.tab"
);
// Build tool submenu

View file

@ -2,11 +2,11 @@
#define APP_BROWSER_HEADER_TAB_H
#include <glibmm/i18n.h>
#include <gtkmm/menubutton.h>
#include <gtkmm/button.h>
namespace app::browser::header
{
class Tab : public Gtk::MenuButton
class Tab : public Gtk::Button
{
public:

28
src/app/browser/main.cpp Normal file
View file

@ -0,0 +1,28 @@
#include "main.hpp"
#include "main/tab.hpp"
using namespace app::browser;
Main::Main()
{
// Init container
set_homogeneous(
true
);
// Init tabs
tab = new main::Tab();
append(
* tab
);
}
void Main::tabAppend()
{
tab->append(
nullptr,
true,
true
);
};

27
src/app/browser/main.hpp Normal file
View file

@ -0,0 +1,27 @@
#ifndef APP_BROWSER_MAIN_H
#define APP_BROWSER_MAIN_H
#include <gtkmm/box.h>
namespace app::browser
{
namespace main
{
class Tab;
}
class Main : public Gtk::Box
{
private:
app::browser::main::Tab * tab;
public:
Main();
void tabAppend();
};
}
#endif // APP_BROWSER_MAIN_H

View file

@ -0,0 +1,22 @@
#include "tab.hpp"
#include "gtkmm/label.h"
using namespace app::browser::main;
Tab::Tab()
{
set_scrollable(
SCROLLABLE
);
}
void Tab::append(
const char * request,
bool open,
bool focus
) {
append_page( // @TODO
* new Gtk::Label("data"),
* new Gtk::Label("tab")
);
};

View file

@ -1,11 +1,11 @@
#ifndef APP_BROWSER_PAGE_H
#define APP_BROWSER_PAGE_H
#ifndef APP_BROWSER_MAIN_TAB_H
#define APP_BROWSER_MAIN_TAB_H
#include <gtkmm/notebook.h>
namespace app::browser
namespace app::browser::main
{
class Page : public Gtk::Notebook
class Tab : public Gtk::Notebook
{
public:
@ -26,16 +26,16 @@ namespace app::browser
Body();
};
Page();
Tab();
void append(
char* request,
bool open = true,
bool focus = false
const char * request,
bool open,
bool focus
);
void update();
};
}
#endif // APP_BROWSER_PAGE_H
#endif // APP_BROWSER_MAIN_TAB_H

View file

@ -1,10 +0,0 @@
#include "page.hpp"
using namespace app::browser;
Page::Page()
{
set_scrollable(
SCROLLABLE
);
}