34 lines
1.7 KiB
C++
34 lines
1.7 KiB
C++
#ifndef __VISITORRECORDTABLEMODEL_H__
|
|
#define __VISITORRECORDTABLEMODEL_H__
|
|
|
|
#include "Database/VisitorRecord.h"
|
|
#include <Wt/WAbstractTableModel.h>
|
|
|
|
class Session;
|
|
|
|
class VisitorRecordTableModel : public Wt::WAbstractTableModel {
|
|
public:
|
|
VisitorRecordTableModel(Session &session);
|
|
Wt::cpp17::any data(const Wt::WModelIndex &index, Wt::ItemDataRole role = Wt::ItemDataRole::Display) const final;
|
|
bool setData(const Wt::WModelIndex &index, const Wt::cpp17::any &value, Wt::ItemDataRole role = Wt::ItemDataRole::Edit) final;
|
|
int columnCount(const Wt::WModelIndex &parent = Wt::WModelIndex()) const final;
|
|
int rowCount(const Wt::WModelIndex &parent = Wt::WModelIndex()) const final;
|
|
Wt::WFlags<Wt::ItemFlag> flags(const Wt::WModelIndex &index) const final;
|
|
Wt::WFlags<Wt::HeaderFlag> headerFlags(int section, Wt::Orientation orientation = Wt::Orientation::Horizontal) const final;
|
|
Wt::cpp17::any headerData(int section, Wt::Orientation orientation = Wt::Orientation::Horizontal,
|
|
Wt::ItemDataRole role = Wt::ItemDataRole::Display) const final;
|
|
bool setHeaderData(int section, Wt::Orientation orientation, const Wt::cpp17::any &value,
|
|
Wt::ItemDataRole role = Wt::ItemDataRole::Edit) final;
|
|
void sort(int column, Wt::SortOrder order = Wt::SortOrder::Ascending) final;
|
|
Wt::WModelIndexSet selectedIndexes() const;
|
|
|
|
bool removeRows(int row, int count, const Wt::WModelIndex &parent = Wt::WModelIndex()) final;
|
|
bool removeSelectedRows(const Wt::WModelIndexSet &indexes);
|
|
|
|
private:
|
|
Session &m_session;
|
|
using Item = std::tuple<VisitorRecord, bool>;
|
|
std::vector<Item> m_records;
|
|
bool m_selectAll = false;
|
|
};
|
|
#endif // __VISITORRECORDTABLEMODEL_H__
|