mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:58:11 +00:00
LibGUI: Let GTableModel handle the selection instead of doing it virtually.
It's silly to force every subclass models to deal with selection.
This commit is contained in:
parent
9c21874d33
commit
e1d0a3f226
3 changed files with 6 additions and 22 deletions
|
@ -46,8 +46,6 @@ public:
|
|||
virtual String column_name(int) const { return { }; }
|
||||
virtual ColumnMetadata column_metadata(int) const { return { }; }
|
||||
virtual GVariant data(int row, int column) const = 0;
|
||||
virtual void set_selected_index(GModelIndex) { }
|
||||
virtual GModelIndex selected_index() const { return GModelIndex(); }
|
||||
virtual void update() = 0;
|
||||
|
||||
bool is_valid(GModelIndex index) const
|
||||
|
@ -55,6 +53,9 @@ public:
|
|||
return index.row() >= 0 && index.row() < row_count() && index.column() >= 0 && index.column() < column_count();
|
||||
}
|
||||
|
||||
void set_selected_index(const GModelIndex& index) { m_selected_index = index; }
|
||||
GModelIndex selected_index() const { return m_selected_index; }
|
||||
|
||||
void register_view(Badge<GTableView>, GTableView&);
|
||||
void unregister_view(Badge<GTableView>, GTableView&);
|
||||
|
||||
|
@ -66,4 +67,5 @@ protected:
|
|||
|
||||
private:
|
||||
HashTable<GTableView*> m_views;
|
||||
GModelIndex m_selected_index;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue