Browse Source

use entire tab area to change pin status

CPP-GTK4
yggverse 2 months ago
parent
commit
e24667785a
  1. 25
      src/app/browser/main/tab.cpp
  2. 1
      src/app/browser/main/tab.hpp
  3. 53
      src/app/browser/main/tab/label.cpp
  4. 1
      src/app/browser/main/tab/label.hpp

25
src/app/browser/main/tab.cpp

@ -31,6 +31,31 @@ Tab::Tab(
SCROLLABLE SCROLLABLE
); );
// Init additional controllers
const auto EVENT__BUTTON_PRIMARY = Gtk::GestureClick::create();
/* use defaults
EVENT__BUTTON_PRIMARY->set_button(
GDK_BUTTON_PRIMARY
);*/
add_controller(
EVENT__BUTTON_PRIMARY
);
// Init events
EVENT__BUTTON_PRIMARY->signal_pressed().connect(
[this](int n, double x, double y)
{
if (n == 2) // double click
{
get_tabLabel(
get_current_page()
)->pin();
}
}
);
signal_switch_page().connect( signal_switch_page().connect(
[this](Gtk::Widget*, guint) [this](Gtk::Widget*, guint)
{ {

1
src/app/browser/main/tab.hpp

@ -5,6 +5,7 @@
#include <glibmm/i18n.h> #include <glibmm/i18n.h>
#include <glibmm/refptr.h> #include <glibmm/refptr.h>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <gtkmm/gestureclick.h>
#include <gtkmm/notebook.h> #include <gtkmm/notebook.h>
#include <sqlite3.h> #include <sqlite3.h>

53
src/app/browser/main/tab/label.cpp

@ -48,59 +48,6 @@ Label::Label(
append( append(
* labelTitle * labelTitle
); );
// Init primary button controller
const auto EVENT__BUTTON_PRIMARY = Gtk::GestureClick::create();
EVENT__BUTTON_PRIMARY->set_button(
GDK_BUTTON_PRIMARY
);
add_controller(
EVENT__BUTTON_PRIMARY
);
// Connect events
EVENT__BUTTON_PRIMARY->signal_pressed().connect(
[this](int n, double x, double y)
{
if (n == 2) // double click
{
update(
!is_pinned // toggle
);
}
}
);
// Init middle button controller
const auto EVENT__BUTTON_MIDDLE = Gtk::GestureClick::create();
EVENT__BUTTON_MIDDLE->set_button(
GDK_BUTTON_MIDDLE
);
add_controller(
EVENT__BUTTON_MIDDLE
);
// Connect events
EVENT__BUTTON_MIDDLE->signal_pressed().connect(
[this](int n, double x, double y)
{
// @TODO activate tab
}
);
EVENT__BUTTON_MIDDLE->signal_released().connect(
[this](int n, double x, double y)
{
if (!is_pinned)
{
// @TODO action__tab_close->activate();
}
}
);
} }
// Actions // Actions

1
src/app/browser/main/tab/label.hpp

@ -7,7 +7,6 @@
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/enums.h> #include <gtkmm/enums.h>
#include <gtkmm/gestureclick.h>
#include <sqlite3.h> #include <sqlite3.h>
namespace app::browser::main::tab namespace app::browser::main::tab

Loading…
Cancel
Save