mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 20:35:06 +00:00
LibGUI: Add a mode where GTableModel automatically activates on selection.
This commit is contained in:
parent
84f5312dc2
commit
c1f2f5a153
4 changed files with 20 additions and 1 deletions
|
@ -58,9 +58,12 @@ 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; }
|
||||
void set_selected_index(const GModelIndex&);
|
||||
GModelIndex selected_index() const { return m_selected_index; }
|
||||
|
||||
bool activates_on_selection() const { return m_activates_on_selection; }
|
||||
void set_activates_on_selection(bool b) { m_activates_on_selection = b; }
|
||||
|
||||
virtual int key_column() const { return -1; }
|
||||
virtual GSortOrder sort_order() const { return GSortOrder::None; }
|
||||
virtual void set_key_column_and_sort_order(int, GSortOrder) { }
|
||||
|
@ -69,6 +72,7 @@ public:
|
|||
void unregister_view(Badge<GTableView>, GTableView&);
|
||||
|
||||
Function<void(GTableModel&)> on_model_update;
|
||||
Function<void(const GModelIndex&)> on_selection_changed;
|
||||
|
||||
protected:
|
||||
GTableModel();
|
||||
|
@ -79,4 +83,5 @@ protected:
|
|||
private:
|
||||
HashTable<GTableView*> m_views;
|
||||
GModelIndex m_selected_index;
|
||||
bool m_activates_on_selection { false };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue