1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:37:36 +00:00

LibGUI: Call on_segment_change handler from on_{click,focus_change}

The on_segment_change handler introduced in
a00fa793b3 was only getting called by
programmatically setting the segment, not by clicking a button or using
tab navigation.
This commit is contained in:
networkException 2022-08-23 12:41:31 +02:00 committed by Andreas Kling
parent c1c11df3b8
commit 2161f20aa6

View file

@ -84,10 +84,12 @@ void Breadcrumbbar::append_segment(String text, Gfx::Bitmap const* icon, String
button.on_click = [this, index = m_segments.size()](auto) {
if (on_segment_click)
on_segment_click(index);
if (on_segment_change && m_selected_segment != index)
on_segment_change(index);
};
button.on_focus_change = [this, index = m_segments.size()](auto has_focus, auto) {
if (has_focus && on_segment_click)
on_segment_click(index);
if (has_focus && on_segment_change && m_selected_segment != index)
on_segment_change(index);
};
button.on_drop = [this, index = m_segments.size()](auto& drop_event) {
if (on_segment_drop)