1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:18:12 +00:00

LibGUI: Move selection behavior from TableView up to AbstractView

Let's make SelectionBehavior a view concept where views can either
select individual items (row, index) or whole rows. Maybe some day
we'll do whole columns, but I don't think we need that now.
This commit is contained in:
Andreas Kling 2020-12-17 00:49:42 +01:00
parent c8fb00fe4d
commit f0138fcb25
5 changed files with 13 additions and 15 deletions

View file

@ -60,6 +60,11 @@ public:
ClearIfNotSelected
};
enum class SelectionBehavior {
SelectItems,
SelectRows,
};
virtual void move_cursor(CursorMovement, SelectionUpdate) { }
void set_model(RefPtr<Model>);
@ -88,6 +93,9 @@ public:
unsigned edit_triggers() const { return m_edit_triggers; }
void set_edit_triggers(unsigned);
SelectionBehavior selection_behavior() const { return m_selection_behavior; }
void set_selection_behavior(SelectionBehavior behavior) { m_selection_behavior = behavior; }
bool is_multi_select() const { return m_multi_select; }
void set_multi_select(bool);
@ -188,6 +196,7 @@ private:
String m_searching;
RefPtr<Core::Timer> m_searching_timer;
ModelIndex m_cursor_index;
SelectionBehavior m_selection_behavior { SelectionBehavior::SelectItems };
unsigned m_edit_triggers { EditTrigger::DoubleClicked | EditTrigger::EditKeyPressed };
bool m_activates_on_selection { false };
bool m_multi_select { true };