mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 08:48:49 +00:00
LibGUI: Add GModelSelection to help implementing multiple-select views
Each GAbstractView now has a GModelSelection backed by a simple HashTable<GModelIndex>. When the selection changes somehow, the view gets notified via the notify_selection_changed() callback. In the future it will probably make sense to move to using some kind of ranges as the internal representation instead.
This commit is contained in:
parent
19b69741ed
commit
82559e211d
Notes:
sideshowbarker
2024-07-19 12:13:55 +09:00
Author: https://github.com/awesomekling
Commit: 82559e211d
5 changed files with 95 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
GAbstractView::GAbstractView(GWidget* parent)
|
||||
: GScrollableWidget(parent)
|
||||
, m_selection(*this)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -96,3 +97,8 @@ void GAbstractView::activate(const GModelIndex& index)
|
|||
if (on_activation)
|
||||
on_activation(index);
|
||||
}
|
||||
|
||||
void GAbstractView::notify_selection_changed(Badge<GModelSelection>)
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue