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

LibGUI: Add (optional) row headers to GUI::TableView

You can now get row headers in your TableView by simply calling:

    table_view.row_header().set_visible(true)

Note that rows are not yet resizable.
This commit is contained in:
Andreas Kling 2020-08-26 15:54:03 +02:00
parent 49a5038a1a
commit 447b65bf7b
5 changed files with 92 additions and 18 deletions

View file

@ -82,6 +82,12 @@ public:
virtual void did_scroll() override;
HeaderView& column_header() { return *m_column_header; }
const HeaderView& column_header() const { return *m_column_header; }
HeaderView& row_header() { return *m_row_header; }
const HeaderView& row_header() const { return *m_row_header; }
protected:
virtual ~AbstractTableView() override;
AbstractTableView();
@ -96,15 +102,16 @@ protected:
void update_content_size();
virtual void update_column_sizes();
virtual void update_row_sizes();
virtual int item_count() const;
TableCellPaintingDelegate* column_painting_delegate(int column) const;
HeaderView& column_header() { return *m_column_header; }
const HeaderView& column_header() const { return *m_column_header; }
private:
void layout_headers();
RefPtr<HeaderView> m_column_header;
RefPtr<HeaderView> m_row_header;
HashMap<int, OwnPtr<TableCellPaintingDelegate>> m_column_painting_delegate;