From 530991a48eb875569b4ce5102c930cd4eb7552f1 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 12 Aug 2024 16:12:36 +0300 Subject: [PATCH] add tab reorderable, focus methods --- src/app/browser/main/tab.cpp | 24 +++++++++++++++++++++--- src/app/browser/main/tab.hpp | 3 +++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/app/browser/main/tab.cpp b/src/app/browser/main/tab.cpp index 5dee1fa7..49ccda1b 100644 --- a/src/app/browser/main/tab.cpp +++ b/src/app/browser/main/tab.cpp @@ -17,8 +17,26 @@ void Tab::append( bool open, bool focus ) { - append_page( // @TODO - * new Gtk::Label("data"), - * new Gtk::Label("tab") + Gtk::Label * data = new Gtk::Label("data"); // @TODO + + append_page( + * data, + * new Gtk::Label( + LABEL + ) + ); + + set_tab_reorderable( + * data, + REORDERABLE ); + + if (focus) + { + set_current_page( + page_num( + * data + ) + ); + } }; \ No newline at end of file diff --git a/src/app/browser/main/tab.hpp b/src/app/browser/main/tab.hpp index 1c6f6194..c4272423 100644 --- a/src/app/browser/main/tab.hpp +++ b/src/app/browser/main/tab.hpp @@ -1,6 +1,7 @@ #ifndef APP_BROWSER_MAIN_TAB_H #define APP_BROWSER_MAIN_TAB_H +#include #include namespace app::browser::main @@ -12,6 +13,8 @@ namespace app::browser::main const bool SCROLLABLE = true; const bool REORDERABLE = true; + const char * LABEL = _("New tab"); + class Navbar { public: