diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2021-05-25 14:13:19 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-06 19:14:31 +0200 |
commit | ca2c81251a7d036f586f3d0a32bc35e2b9f93144 (patch) | |
tree | 130d63311e74c262c5cf685418ab701d7aa27165 /Userland/Libraries/LibGUI/AbstractView.h | |
parent | 5cd2e0f3a26fb4e548c11056e6ec962392e50f15 (diff) | |
download | serenity-ca2c81251a7d036f586f3d0a32bc35e2b9f93144.zip |
Everywhere: Replace Model::update() with Model::invalidate()
Most of the models were just calling did_update anyway, which is
pointless since it can be unified to the base Model class. Instead, code
calling update() will now call invalidate(), which functions identically
and is more obvious in what it does.
Additionally, a default implementation is provided, which removes the
need to add empty implementations of update() for each model subclass.
Co-Authored-By: Ali Mohammad Pur <ali.mpfard@gmail.com>
Diffstat (limited to 'Userland/Libraries/LibGUI/AbstractView.h')
-rw-r--r-- | Userland/Libraries/LibGUI/AbstractView.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Userland/Libraries/LibGUI/AbstractView.h b/Userland/Libraries/LibGUI/AbstractView.h index 69f734c87f..2fbb86ae64 100644 --- a/Userland/Libraries/LibGUI/AbstractView.h +++ b/Userland/Libraries/LibGUI/AbstractView.h @@ -173,7 +173,6 @@ protected: bool m_editable { false }; bool m_searchable { true }; - ModelIndex m_edit_index; RefPtr<Widget> m_edit_widget; Gfx::IntRect m_edit_widget_content_rect; OwnPtr<ModelEditingDelegate> m_editing_delegate; @@ -181,20 +180,22 @@ protected: Gfx::IntPoint m_left_mousedown_position; bool m_might_drag { false }; - ModelIndex m_hovered_index; - ModelIndex m_highlighted_search_index; - int m_key_column { -1 }; SortOrder m_sort_order; + ModelIndex m_edit_index; + ModelIndex m_hovered_index; + ModelIndex m_highlighted_search_index; + private: + ModelIndex m_selection_start_index; + ModelIndex m_cursor_index; + ModelIndex m_drop_candidate_index; + RefPtr<Model> m_model; ModelSelection m_selection; - ModelIndex m_selection_start_index; String m_searching; RefPtr<Core::Timer> m_searching_timer; - ModelIndex m_cursor_index; - ModelIndex m_drop_candidate_index; SelectionBehavior m_selection_behavior { SelectionBehavior::SelectItems }; SelectionMode m_selection_mode { SelectionMode::SingleSelection }; unsigned m_edit_triggers { EditTrigger::DoubleClicked | EditTrigger::EditKeyPressed }; |