implement separated tab label class

This commit is contained in:
yggverse 2024-08-13 07:55:23 +03:00
parent 6e115ca3c1
commit 88e5ba3736
6 changed files with 87 additions and 46 deletions

View file

@ -1,4 +1,5 @@
#include "tab.hpp"
#include "tab/label.hpp"
using namespace app::browser::main;
@ -17,35 +18,14 @@ void Tab::append(
bool focus
) {
// Init new tab label
Gtk::Label * name = new Gtk::Label(
_("New tab")
);
// Setup label controller
auto controller = Gtk::GestureClick::create();
/* @TODO remove as default
controller->set_button(
GDK_BUTTON_PRIMARY
);*/
controller->signal_pressed().connect(
sigc::mem_fun(
* this,
& Tab::on_label_click
)
);
name->add_controller(
controller
);
label = new tab::Label();
// Init tab data container @TODO
Gtk::Label * data = new Gtk::Label("data");
append_page(
* data,
* name
* label
);
set_tab_reorderable(
@ -88,17 +68,4 @@ void Tab::close_all()
-1 // active
);
}
}
void Tab::on_label_click(
int n,
double x,
double y
) {
if (n == 2) // double click
{
close(
-1 // active
);
}
}