summaryrefslogtreecommitdiff
path: root/Applications/ChanViewer/BoardListModel.h
blob: 13a997c85eade077ad7d68fd5dc7dc68d7aeba8d (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
#pragma once

#include <AK/JsonArray.h>
#include <LibGUI/GModel.h>

class BoardListModel final : public GModel {
public:
    enum Column {
        Board,
        __Count,
    };

    static NonnullRefPtr<BoardListModel> create() { return adopt(*new BoardListModel); }
    virtual ~BoardListModel() override;

    virtual int row_count(const GModelIndex& = GModelIndex()) const override;
    virtual int column_count(const GModelIndex& = GModelIndex()) const override { return Column::__Count; }
    virtual String column_name(int) const override;
    virtual ColumnMetadata column_metadata(int) const override;
    virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
    virtual void update() override;

private:
    BoardListModel();

    JsonArray m_boards;
};