mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
LibGUI: Add hook when a tab is middle clicked
This commit is contained in:
parent
cbbfc08f1d
commit
bb6258229a
2 changed files with 10 additions and 1 deletions
|
@ -236,7 +236,15 @@ void TabWidget::mousedown_event(MouseEvent& event)
|
|||
auto button_rect = this->button_rect(i);
|
||||
if (!button_rect.contains(event.position()))
|
||||
continue;
|
||||
set_active_widget(m_tabs[i].widget);
|
||||
if (event.button() == MouseButton::Left) {
|
||||
set_active_widget(m_tabs[i].widget);
|
||||
} else if (event.button() == MouseButton::Middle) {
|
||||
auto* widget = m_tabs[i].widget;
|
||||
deferred_invoke([this, widget](auto&) {
|
||||
if (on_middle_click && widget)
|
||||
on_middle_click(*widget);
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue