ArcdpsExtension
 
Loading...
Searching...
No Matches
DemoTable.h
Go to the documentation of this file.
1#pragma once
2
3#include "../MainTable.h"
4
5#include "../../arcdps_structs.h"
6
7namespace ArcdpsExtension {
8 using std::string_literals::operator""s;
9
10 static const std::vector<MainTableColumn> tableColumns = {
11 {0, [] { return "Column1"s; }, [] { return nullptr; }, "0" },
12 {1, [] { return "Column2"s; }, [] { return nullptr; }, "0" },
13 {2, [] { return "Column3"s; }, [] { return nullptr; }, "1" },
14 {3, [] { return "Column4"s; }, [] { return nullptr; }, "1.1"},
15 };
16
20 struct Row {
21 std::string Column1;
22 std::string Column2;
23 std::string Column3;
24 std::string Column4;
25 std::string HoveredText;
26 };
27
28 static inline std::vector<Row> Rows = {
29 {"1Row1.1", "4Row1.2", "3Row1.3", "3Row1.4", "Row1 Hovered Text"},
30 {"2Row2.1", "3Row2.2", "5Row2.3", "1Row2.4", "Row2 Hovered Text"},
31 {"3Row3.1", "5Row3.2", "2Row3.3", "5Row3.4", "Row3 Hovered Text"},
32 {"4Row4.1", "2Row4.2", "1Row4.3", "4Row4.4", "Row4 Hovered Text"},
33 {"5Row5.1", "1Row5.2", "4Row5.3", "2Row5.4", "Row5 Hovered Text"},
34 };
35
36 class DemoTable : public MainTable<> {
37 public:
38 explicit DemoTable(MainWindow* pMainWindow) : MainTable<>(tableColumns, pMainWindow, MainTableFlags_SubWindow) {}
39
40 protected:
41 Alignment& getAlignment() override;
42 Alignment& getHeaderAlignment() override;
43 std::string getTableId() override;
44 int& getMaxDisplayed() override;
45 const char* getCategoryName(const std::string& pCat) override;
46 bool& getShowAlternatingBackground() override;
47 TableSettings& getTableSettings() override;
48 bool& getHighlightHoveredRows() override;
49 bool& getShowHeaderAsText() override;
50
51 void DrawRows(TableColumnIdx pFirstColumnIndex) override;
52 void Sort(const ImGuiTableColumnSortSpecs* mColumnSortSpecs) override;
53
54 private:
55 Alignment mAlignment = Alignment::Left;
56 Alignment mHeaderAlignment = Alignment::Left;
57 int mMaxDisplayed = 0;
58 bool mAlternatingBackground = false;
59 TableSettings mSettings;
60 bool mHighlightHoveredRows = true;
61 bool mShowHeaderAsText = false;
62 };
63} // namespace ArcdpsExtension
Alignment
Definition arcdps_structs.h:64
Definition DemoTable.h:36
int & getMaxDisplayed() override
Definition DemoTable.cpp:15
Alignment & getHeaderAlignment() override
Definition DemoTable.cpp:7
Alignment & getAlignment() override
Definition DemoTable.cpp:3
DemoTable(MainWindow *pMainWindow)
Definition DemoTable.h:38
void Sort(const ImGuiTableColumnSortSpecs *mColumnSortSpecs) override
Definition DemoTable.cpp:66
std::string getTableId() override
Definition DemoTable.cpp:11
bool & getHighlightHoveredRows() override
Definition DemoTable.cpp:33
bool & getShowHeaderAsText() override
Definition DemoTable.cpp:37
void DrawRows(TableColumnIdx pFirstColumnIndex) override
Definition DemoTable.cpp:41
TableSettings & getTableSettings() override
Definition DemoTable.cpp:29
const char * getCategoryName(const std::string &pCat) override
Definition DemoTable.cpp:19
bool & getShowAlternatingBackground() override
Definition DemoTable.cpp:25
Definition MainTable.h:129
Definition MainWindow.h:22
Definition ArcdpsExtension.h:10
@ MainTableFlags_SubWindow
Definition MainTable.h:92
ImS16 TableColumnIdx
Definition MainTable.h:45
Definition DemoTable.h:20
std::string Column1
Definition DemoTable.h:21
std::string Column4
Definition DemoTable.h:24
std::string HoveredText
Definition DemoTable.h:25
std::string Column2
Definition DemoTable.h:22
std::string Column3
Definition DemoTable.h:23