blob: a134d5541c3487c04b1bba87df95c936dfa37ec6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#pragma once
#include <LibGUI/GWidget.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
class GScrollBar;
class GTableModel;
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; }
void set_model(OwnPtr<GTableModel>&&);
GTableModel* model() { return m_model.ptr(); }
const GTableModel* model() const { return m_model.ptr(); }
void did_update_model();
private:
virtual void paint_event(GPaintEvent&) override;
virtual void resize_event(GResizeEvent&) override;
virtual void mousedown_event(GMouseEvent&) override;
void update_scrollbar_range();
int item_count() const;
Rect row_rect(int item_index) const;
GScrollBar* m_scrollbar { nullptr };
OwnPtr<GTableModel> m_model;
};
|