mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 22:55:23 +00:00
GTableView: Add a way to hide the column headers.
There are many situations where you would want a table view without headers.
This commit is contained in:
@@ -6,19 +6,23 @@
|
||||
#include <AK/HashMap.h>
|
||||
|
||||
class GScrollBar;
|
||||
class Painter;
|
||||
|
||||
class GTableView : public GWidget {
|
||||
public:
|
||||
explicit GTableView(GWidget* parent);
|
||||
virtual ~GTableView() override;
|
||||
|
||||
virtual int header_height() const { return 16; }
|
||||
virtual int item_height() const { return 16; }
|
||||
int header_height() const { return m_headers_visible ? 16 : 0; }
|
||||
int item_height() const { return 16; }
|
||||
|
||||
void set_model(OwnPtr<GTableModel>&&);
|
||||
GTableModel* model() { return m_model.ptr(); }
|
||||
const GTableModel* model() const { return m_model.ptr(); }
|
||||
|
||||
bool headers_visible() const { return m_headers_visible; }
|
||||
void set_headers_visible(bool headers_visible) { m_headers_visible = headers_visible; }
|
||||
|
||||
void did_update_model();
|
||||
|
||||
int content_width() const;
|
||||
@@ -37,6 +41,7 @@ private:
|
||||
virtual void mousedown_event(GMouseEvent&) override;
|
||||
virtual void keydown_event(GKeyEvent&) override;
|
||||
|
||||
void paint_headers(Painter&);
|
||||
void update_scrollbar_ranges();
|
||||
int item_count() const;
|
||||
Rect row_rect(int item_index) const;
|
||||
@@ -45,6 +50,8 @@ private:
|
||||
|
||||
GScrollBar* m_vertical_scrollbar { nullptr };
|
||||
GScrollBar* m_horizontal_scrollbar { nullptr };
|
||||
GWidget* m_corner_widget { nullptr };
|
||||
OwnPtr<GTableModel> m_model;
|
||||
int m_horizontal_padding { 5 };
|
||||
bool m_headers_visible { true };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user