File: table-view-column.cpp

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 (161 lines) | stat: -rw-r--r-- 3,873 bytes parent folder | download | duplicates (4)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#if defined(Hiro_TableView)

auto mTableViewColumn::allocate() -> pObject* {
  return new pTableViewColumn(*this);
}

//

//TODO: active(), setActive() ... is this the best way to do this?

auto mTableViewColumn::active() const -> bool {
  if(auto tableView = parentTableView(true)) return tableView->state.activeColumn == offset();
  return false;
}

auto mTableViewColumn::alignment() const -> Alignment {
  return state.alignment;
}

auto mTableViewColumn::backgroundColor() const -> Color {
  return state.backgroundColor;
}

auto mTableViewColumn::editable() const -> bool {
  return state.editable;
}

auto mTableViewColumn::expandable() const -> bool {
  return state.expandable;
}

auto mTableViewColumn::foregroundColor() const -> Color {
  return state.foregroundColor;
}

auto mTableViewColumn::horizontalAlignment() const -> f32 {
  return state.horizontalAlignment;
}

auto mTableViewColumn::icon() const -> multiFactorImage {
  return state.icon;
}

auto mTableViewColumn::remove() -> type& {
  if(auto tableView = parentTableView()) tableView->remove(*this);
  return *this;
}

auto mTableViewColumn::resizable() const -> bool {
  return state.resizable;
}

auto mTableViewColumn::setActive() -> type& {
  if(auto tableView = parentTableView(true)) tableView->state.activeColumn = offset();
  signal(setActive);
  return *this;
}

auto mTableViewColumn::setAlignment(Alignment alignment) -> type& {
  state.alignment = alignment;
  signal(setAlignment, alignment);
  return *this;
}

auto mTableViewColumn::setBackgroundColor(Color color) -> type& {
  state.backgroundColor = color;
  signal(setBackgroundColor, color);
  return *this;
}

auto mTableViewColumn::setEditable(bool editable) -> type& {
  state.editable = editable;
  signal(setEditable, editable);
  return *this;
}

auto mTableViewColumn::setExpandable(bool expandable) -> type& {
  state.expandable = expandable;
  signal(setExpandable, expandable);
  return *this;
}

auto mTableViewColumn::setForegroundColor(Color color) -> type& {
  state.foregroundColor = color;
  signal(setForegroundColor, color);
  return *this;
}

auto mTableViewColumn::setHorizontalAlignment(f32 alignment) -> type& {
  alignment = max(0.0, min(1.0, alignment));
  state.horizontalAlignment = alignment;
  signal(setHorizontalAlignment, alignment);
  return *this;
}

auto mTableViewColumn::setIcon(const multiFactorImage& icon) -> type& {
  state.icon = icon;
  signal(setIcon, icon);
  return *this;
}

auto mTableViewColumn::setResizable(bool resizable) -> type& {
  state.resizable = resizable;
  signal(setResizable, resizable);
  return *this;
}

auto mTableViewColumn::setSorting(Sort sorting) -> type& {
  if(auto tableView = parentTableView()) {
    for(auto& column : tableView->state.columns) {
      column->state.sorting = Sort::None;
      signalex(column, setSorting, Sort::None);
    }
  }
  state.sorting = sorting;
  signal(setSorting, sorting);
  return *this;
}

auto mTableViewColumn::setText(const string& text) -> type& {
  state.text = text;
  signal(setText, text);
  return *this;
}

auto mTableViewColumn::setVerticalAlignment(f32 alignment) -> type& {
  alignment = max(0.0, min(1.0, alignment));
  state.verticalAlignment = alignment;
  signal(setVerticalAlignment, alignment);
  return *this;
}

auto mTableViewColumn::setVisible(bool visible) -> type& {
  state.visible = visible;
  signal(setVisible, visible);
  return *this;
}

auto mTableViewColumn::setWidth(f32 width) -> type& {
  state.width = max(0, width);
  signal(setWidth, width);
  return *this;
}

auto mTableViewColumn::sorting() const -> Sort {
  return state.sorting;
}

auto mTableViewColumn::text() const -> string {
  return state.text;
}

auto mTableViewColumn::verticalAlignment() const -> f32 {
  return state.verticalAlignment;
}

auto mTableViewColumn::width() const -> f32 {
  return state.width;
}

#endif