1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 06:45:07 +00:00

LibGUI: Make GTreeView inherit from GAbstractColumnView

This makes GTreeView able to support multi-column models!

Only one column can be the "tree column", this is column 0 by default
but can be changed by overriding GModel::tree_column().
This commit is contained in:
Andreas Kling 2019-12-13 23:36:36 +01:00
parent b909d991f1
commit 0ac74d3778
7 changed files with 248 additions and 121 deletions

View file

@ -35,7 +35,6 @@ public:
int horizontal_padding() const { return m_horizontal_padding; }
Point adjusted_position(const Point&) const;
GModelIndex index_at_event_position(const Point&) const;
virtual Rect content_rect(const GModelIndex&) const override;
Rect content_rect(int row, int column) const;
@ -56,6 +55,9 @@ protected:
virtual void leave_event(CEvent&) override;
virtual void context_menu_event(GContextMenuEvent&) override;
virtual GModelIndex index_at_event_position(const Point&, bool& is_toggle) const;
virtual void toggle_index(const GModelIndex&) {}
void paint_headers(GPainter&);
Rect header_rect(int column) const;
@ -80,8 +82,8 @@ protected:
Rect column_resize_grabbable_rect(int) const;
int column_width(int) const;
void update_content_size();
void update_column_sizes();
int item_count() const;
virtual void update_column_sizes();
virtual int item_count() const;
private:
bool m_headers_visible { true };