mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibGUI: Add on_segment_change handler to Breadcrumbbar
This allows programs to respond to any selection changes of the Breadcrumbbar, not just ones made by clicking one of the buttons.
This commit is contained in:
parent
f86b671de2
commit
a00fa793b3
Notes:
sideshowbarker
2024-07-17 08:05:04 +09:00
Author: https://github.com/weisJ 🔰
Commit: a00fa793b3
Pull-request: https://github.com/SerenityOS/serenity/pull/14964
2 changed files with 3 additions and 0 deletions
|
@ -146,6 +146,8 @@ void Breadcrumbbar::set_selected_segment(Optional<size_t> index)
|
|||
auto& segment = m_segments[index.value()];
|
||||
VERIFY(segment.button);
|
||||
segment.button->set_checked(true);
|
||||
if (on_segment_change)
|
||||
on_segment_change(index);
|
||||
relayout();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
void set_selected_segment(Optional<size_t> index);
|
||||
Optional<size_t> selected_segment() const { return m_selected_segment; }
|
||||
|
||||
Function<void(Optional<size_t> index)> on_segment_change;
|
||||
Function<void(size_t index)> on_segment_click;
|
||||
Function<void(size_t index, DropEvent&)> on_segment_drop;
|
||||
Function<void(size_t index, DragEvent&)> on_segment_drag_enter;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue