mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 10:12:25 -05:00
LibGUI: Allow double clicking on tabwidgets
This commit is contained in:
parent
5ca242ce30
commit
0cfe446d3f
Notes:
sideshowbarker
2024-07-17 23:17:41 +09:00
Author: https://github.com/ebiederstadt Commit: https://github.com/SerenityOS/serenity/commit/0cfe446d3f5 Pull-request: https://github.com/SerenityOS/serenity/pull/11139 Reviewed-by: https://github.com/alimpfard
2 changed files with 14 additions and 0 deletions
|
@ -635,6 +635,18 @@ void TabWidget::context_menu_event(ContextMenuEvent& context_menu_event)
|
|||
}
|
||||
}
|
||||
|
||||
void TabWidget::doubleclick_event(MouseEvent&)
|
||||
{
|
||||
for (auto& tab : m_tabs) {
|
||||
if (auto* widget = tab.widget) {
|
||||
deferred_invoke([this, widget] {
|
||||
if (on_double_click)
|
||||
on_double_click(*widget);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TabWidget::set_container_margins(GUI::Margins const& margins)
|
||||
{
|
||||
m_container_margins = margins;
|
||||
|
|
|
@ -86,6 +86,7 @@ public:
|
|||
Function<void(Widget&)> on_middle_click;
|
||||
Function<void(Widget&)> on_tab_close_click;
|
||||
Function<void(Widget&, const ContextMenuEvent&)> on_context_menu_request;
|
||||
Function<void(Widget&)> on_double_click;
|
||||
|
||||
protected:
|
||||
TabWidget();
|
||||
|
@ -99,6 +100,7 @@ protected:
|
|||
virtual void leave_event(Core::Event&) override;
|
||||
virtual void keydown_event(KeyEvent&) override;
|
||||
virtual void context_menu_event(ContextMenuEvent&) override;
|
||||
virtual void doubleclick_event(MouseEvent&) override;
|
||||
|
||||
private:
|
||||
Gfx::IntRect child_rect_for_size(const Gfx::IntSize&) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue