mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
77 lines
No EOL
1.2 KiB
C++
77 lines
No EOL
1.2 KiB
C++
#include "tab.hpp"
|
|
|
|
using namespace app::browser::main;
|
|
|
|
Tab::Tab()
|
|
{
|
|
set_scrollable(
|
|
SCROLLABLE
|
|
);
|
|
}
|
|
|
|
Tab::~Tab() = default;
|
|
|
|
void Tab::append(
|
|
const char * request,
|
|
bool open,
|
|
bool focus
|
|
) {
|
|
// Init new tab label
|
|
Gtk::Label * name = new Gtk::Label(
|
|
LABEL
|
|
);
|
|
|
|
// 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
|
|
);
|
|
|
|
// Init tab data container @TODO
|
|
Gtk::Label * data = new Gtk::Label("data");
|
|
|
|
append_page(
|
|
* data,
|
|
* name
|
|
);
|
|
|
|
set_tab_reorderable(
|
|
* data,
|
|
REORDERABLE
|
|
);
|
|
|
|
if (focus)
|
|
{
|
|
set_current_page(
|
|
page_num(
|
|
* data
|
|
)
|
|
);
|
|
}
|
|
};
|
|
|
|
void Tab::on_label_click(
|
|
int n,
|
|
double x,
|
|
double y
|
|
) {
|
|
if (n == 2) // double click
|
|
{
|
|
remove_page(
|
|
get_current_page()
|
|
);
|
|
}
|
|
} |