File: table-view.hpp

package info (click to toggle)
ares 126-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 32,600 kB
  • sloc: cpp: 356,508; ansic: 20,394; makefile: 16; sh: 2
file content (74 lines) | stat: -rw-r--r-- 2,964 bytes parent folder | download | duplicates (2)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#if defined(Hiro_TableView)
struct mTableView : mWidget {
  Declare(TableView)
  using mObject::remove;

  auto alignment() const -> Alignment;
  auto append(sTableViewColumn column) -> type&;
  auto append(sTableViewItem item) -> type&;
  auto backgroundColor() const -> Color;
  auto batchable() const -> bool;
  auto batched() const -> vector<TableViewItem>;
  auto bordered() const -> bool;
  auto column(u32 position) const -> TableViewColumn;
  auto columnCount() const -> u32;
  auto columns() const -> vector<TableViewColumn>;
  auto doActivate(sTableViewCell cell) const -> void;
  auto doChange() const -> void;
  auto doContext(sTableViewCell cell) const -> void;
  auto doEdit(sTableViewCell cell) const -> void;
  auto doSort(sTableViewColumn column) const -> void;
  auto doToggle(sTableViewCell cell) const -> void;
  auto foregroundColor() const -> Color;
  auto headered() const -> bool;
  auto item(u32 position) const -> TableViewItem;
  auto itemCount() const -> u32;
  auto items() const -> vector<TableViewItem>;
  auto onActivate(const function<void (TableViewCell)>& callback = {}) -> type&;
  auto onChange(const function<void ()>& callback = {}) -> type&;
  auto onContext(const function<void (TableViewCell)>& callback = {}) -> type&;
  auto onEdit(const function<void (TableViewCell)>& callback = {}) -> type&;
  auto onSort(const function<void (TableViewColumn)>& callback = {}) -> type&;
  auto onToggle(const function<void (TableViewCell)>& callback = {}) -> type&;
  auto remove(sTableViewColumn column) -> type&;
  auto remove(sTableViewItem item) -> type&;
  auto reset() -> type& override;
  auto resizeColumns() -> type&;
  auto selectAll() -> type&;
  auto selectNone() -> type&;
  auto selected() const -> TableViewItem;
  auto setAlignment(Alignment alignment = {}) -> type&;
  auto setBackgroundColor(Color color = {}) -> type&;
  auto setBatchable(bool batchable = true) -> type&;
  auto setBordered(bool bordered = true) -> type&;
  auto setForegroundColor(Color color = {}) -> type&;
  auto setHeadered(bool headered = true) -> type&;
  auto setParent(mObject* parent = nullptr, s32 offset = -1) -> type& override;
  auto setSortable(bool sortable = true) -> type&;
  auto setUsesSidebarStyle(bool usesSidebarStyle = true) -> type&;
  auto sort() -> type&;
  auto sortable() const -> bool;

//private:
  struct State {
    u32 activeColumn = 0;
    Alignment alignment;
    Color backgroundColor;
    bool batchable = false;
    bool bordered = false;
    vector<sTableViewColumn> columns;
    Color foregroundColor;
    bool headered = false;
    vector<sTableViewItem> items;
    function<void (TableViewCell)> onActivate;
    function<void ()> onChange;
    function<void (TableViewCell)> onContext;
    function<void (TableViewCell)> onEdit;
    function<void (TableViewColumn)> onSort;
    function<void (TableViewCell)> onToggle;
    bool sortable = false;
  } state;

  auto destruct() -> void override;
};
#endif