mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
GAbstractView: Add on_selection callback.
This callback is fired whenever the model's selection is updated. Note that it only fires when there is a model, and when the index is valid.
This commit is contained in:
parent
dd6b8135c2
commit
d0b7d5e84c
Notes:
sideshowbarker
2024-07-19 13:31:42 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d0b7d5e84c9
2 changed files with 3 additions and 0 deletions
|
@ -44,6 +44,8 @@ void GAbstractView::did_update_selection()
|
|||
{
|
||||
if (!model() || model()->selected_index() != m_edit_index)
|
||||
stop_editing();
|
||||
if (model() && on_selection && model()->selected_index().is_valid())
|
||||
on_selection(model()->selected_index());
|
||||
}
|
||||
|
||||
void GAbstractView::did_scroll()
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
bool activates_on_selection() const { return m_activates_on_selection; }
|
||||
|
||||
Function<void(const GModelIndex&)> on_activation;
|
||||
Function<void(const GModelIndex&)> on_selection;
|
||||
Function<void(const GModelNotification&)> on_model_notification;
|
||||
|
||||
virtual const char* class_name() const override { return "GAbstractView"; }
|
||||
|
|
Loading…
Reference in a new issue