mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
LibGUI: Allow double-clicking PathBreadcrumbbar buttons to edit path
When viewing a deeply nested path, there may be very little of the PathBreadcrumbbar itself visible to double-click on. This solves that by allowing double-clicks on its segment buttons to behave the same. (With the caveat that it first selects the double-clicked segment.) In order to make this work, `on_double_click` now takes the modifiers instead of the MouseEvent. In this case we don't use it so that's fine, but maybe we should make all mouse callbacks consistently take the MouseEvent& as a parameter.
This commit is contained in:
parent
8f717927f2
commit
5b77346f53
3 changed files with 7 additions and 3 deletions
|
@ -86,6 +86,10 @@ void Breadcrumbbar::append_segment(DeprecatedString text, Gfx::Bitmap const* ico
|
|||
if (on_segment_change && m_selected_segment != index)
|
||||
on_segment_change(index);
|
||||
};
|
||||
button.on_double_click = [this](auto modifiers) {
|
||||
if (on_doubleclick)
|
||||
on_doubleclick(modifiers);
|
||||
};
|
||||
button.on_focus_change = [this, index = m_segments.size()](auto has_focus, auto) {
|
||||
if (has_focus && on_segment_change && m_selected_segment != index)
|
||||
on_segment_change(index);
|
||||
|
@ -154,7 +158,7 @@ void Breadcrumbbar::set_selected_segment(Optional<size_t> index)
|
|||
void Breadcrumbbar::doubleclick_event(MouseEvent& event)
|
||||
{
|
||||
if (on_doubleclick)
|
||||
on_doubleclick(event);
|
||||
on_doubleclick(event.modifiers());
|
||||
}
|
||||
|
||||
void Breadcrumbbar::resize_event(ResizeEvent&)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue