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

LibGUI: Move table view headers into their own widget

This patch introduces the HeaderView class, which is a widget that
implements the column headers of TableView and TreeView.

This greatly simplifies event management in the view implementations
and also makes it much easier to eventually implement row headers.
This commit is contained in:
Andreas Kling 2020-08-25 11:25:39 +02:00
parent eca6ff353e
commit 44e371635e
16 changed files with 555 additions and 351 deletions

View file

@ -42,7 +42,7 @@ public:
ModelSelection& selection() { return m_selection; }
const ModelSelection& selection() const { return m_selection; }
virtual void select_all() = 0;
virtual void select_all() { }
bool is_editable() const { return m_editable; }
void set_editable(bool editable) { m_editable = editable; }
@ -55,7 +55,7 @@ public:
virtual void did_update_selection();
virtual Gfx::IntRect content_rect(const ModelIndex&) const { return {}; }
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const = 0;
virtual ModelIndex index_at_event_position(const Gfx::IntPoint&) const { return {}; }
void begin_editing(const ModelIndex&);
void stop_editing();
@ -78,6 +78,9 @@ public:
void set_key_column_and_sort_order(int column, SortOrder);
int key_column() const { return m_key_column; }
SortOrder sort_order() const { return m_sort_order; }
protected:
AbstractView();
virtual ~AbstractView() override;