Older/WebApplication/VisitorRecordTableModel.h
luocai 6803f84677
Some checks failed
Deploy / Build (push) Failing after 2m55s
fix model.
2024-11-29 20:01:10 +08:00

33 lines
1.6 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;
std::vector<VisitorRecord> selected() const;
void removeSelected();
private:
Session &m_session;
using Item = std::tuple<VisitorRecord, bool>;
std::vector<Item> m_records;
bool m_selectAll = false;
};
#endif // __VISITORRECORDTABLEMODEL_H__