summaryrefslogtreecommitdiff
path: root/LibGUI/GTableModel.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-01 13:03:13 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-01 13:03:13 +0100
commite1d0a3f2262034fcf4d28980eabcac11019609a8 (patch)
treee5ab9cd7c7cdcd34757126067999e1bda5101a26 /LibGUI/GTableModel.h
parent9c21874d33cdffb431cbb70ac14fe7273a74aa4a (diff)
downloadserenity-e1d0a3f2262034fcf4d28980eabcac11019609a8.zip
LibGUI: Let GTableModel handle the selection instead of doing it virtually.
It's silly to force every subclass models to deal with selection.
Diffstat (limited to 'LibGUI/GTableModel.h')
-rw-r--r--LibGUI/GTableModel.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/LibGUI/GTableModel.h b/LibGUI/GTableModel.h
index 3ea5a2f88f..b1c6a5e46f 100644
--- a/LibGUI/GTableModel.h
+++ b/LibGUI/GTableModel.h
@@ -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;
};