LibGUI: Expand GModelIndex a bit, adding internal data and model pointers.

This will be useful for implementing more complicated models.
This commit is contained in:
Andreas Kling 2019-03-29 04:58:15 +01:00
commit d02238af48
Notes: sideshowbarker 2024-07-19 14:54:19 +09:00
10 changed files with 94 additions and 34 deletions

View file

@ -76,12 +76,16 @@ public:
Function<void(GModel&)> on_model_update;
Function<void(const GModelIndex&)> on_selection_changed;
virtual GModelIndex index(int row, int column) const { return create_index(row, column); }
protected:
GModel();
void for_each_view(Function<void(GAbstractView&)>);
void did_update();
GModelIndex create_index(int row, int column, void* data = nullptr) const;
private:
HashTable<GAbstractView*> m_views;
GModelIndex m_selected_index;