mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:07:36 +00:00
LibGUI: Allow double clicking on tabwidgets
This commit is contained in:
parent
5ca242ce30
commit
0cfe446d3f
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
Add a link
Reference in a new issue