Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MFXDecalsTable.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Table used for show and edit decal values
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include <vector>
24
27
28// ===========================================================================
29// class declaration
30// ===========================================================================
31
33
34// ===========================================================================
35// class definitions
36// ===========================================================================
40class MFXDecalsTable : public FXVerticalFrame {
42 FXDECLARE(MFXDecalsTable)
43
44public:
46 MFXDecalsTable(GUIDialog_ViewSettings* dialogViewSettingsParent, FXComposite* parent);
47
50
52 void clearTable();
53
55 void setItemText(FXint row, FXint column, const std::string& text);
56
58 std::string getItemText(const int row, const int column) const;
59
61 int getNumRows() const;
62
64 int getCurrentSelectedRow() const;
65
67 void selectRow(const int rowIndex);
68
70 void setColumnLabel(const int column, const std::string& text, const std::string& tooltip = "");
71
73 void fillTable();
74
77
79 long onFocusRow(FXObject*, FXSelector, void*);
80
82 long onCmdKeyPress(FXObject*, FXSelector, void*);
83
85 long onCmdEditRowString(FXObject*, FXSelector, void*);
86
88 long onCmdEditRowSpinner(FXObject*, FXSelector, void*);
89
91 long onCmdEditRowCheckBox(FXObject*, FXSelector, void*);
92
94 long onCmdOpenDecal(FXObject*, FXSelector, void*);
95
97 long onCmdAddRow(FXObject*, FXSelector, void*);
98
100 long onUpdAddRow(FXObject*, FXSelector, void*);
101
103 long onCmdRemoveRow(FXObject*, FXSelector, void*);
104
106
107protected:
109 FOX_CONSTRUCTOR(MFXDecalsTable)
110
111
113
114 public:
116 Cell(MFXDecalsTable* decalsTable, FXTextField* textField, int col, int row);
117
119 Cell(MFXDecalsTable* decalsTable, FXLabel* indexLabel, FXLabel* indexLabelBold, int col, int row);
120
122 Cell(MFXDecalsTable* decalsTable, FXButton* button, int col, int row);
123
125 Cell(MFXDecalsTable* decalsTable, FXCheckButton* checkButton, int col, int row);
126
128 Cell(MFXDecalsTable* decalsTable, FXRealSpinner* spinner, int col, int row);
129
131 ~Cell();
132
134 bool hasFocus() const;
135
137 void setFocus();
138
140 FXTextField* getTextField() const;
141
143 FXLabel* getIndexLabel() const;
144
146 FXButton* getButton();
147
149 FXCheckButton* getCheckButton();
150
152 FXRealSpinner* getSpinner();
153
155 void showIndexLabelNormal();
156
158 void showIndexLabelBold();
159
161 int getCol() const;
162
164 int getRow() const;
165
167 char getType() const;
168
169 private:
171 MFXDecalsTable* myDecalsTable = nullptr;
172
174 FXTextField* myTextField = nullptr;
175
177 FXLabel* myIndexLabel = nullptr;
178
180 FXLabel* myIndexLabelBold = nullptr;
181
183 FXButton* myButton = nullptr;
184
186 FXRealSpinner* mySpinner = nullptr;
187
189 FXCheckButton* myCheckButton = nullptr;
190
192 const int myCol;
193
195 const int myRow;
196
198 Cell();
199 };
200
202 class Column {
203
204 public:
206 Column(MFXDecalsTable* table, const int index, const char type);
207
209 ~Column();
210
212 FXVerticalFrame* getVerticalCellFrame() const;
213
215 char getType() const;
216
218 FXString getColumnLabel() const;
219
221 void setColumnLabel(const std::string& text, const std::string& tooltip);
222
223 private:
226
228 FXVerticalFrame* myVerticalFrame = nullptr;
229
232
234 FXVerticalFrame* myVerticalCellFrame = nullptr;
235
237 const int myIndex;
238
240 const char myType;
241
243 void adjustColumnWidth();
244
246 Column();
247 };
248
250 class Row {
251
252 public:
254 Row(MFXDecalsTable* table);
255
257 ~Row();
258
260 std::string getText(int index) const;
261
263 void setText(int index, const std::string& text) const;
264
266 const std::vector<Cell*>& getCells() const;
267
270
271 protected:
274
276 std::vector<Cell*> myCells;
277
278 private:
280 Row();
281 };
282
284 void updateIndexLabel();
285
287 bool moveFocus();
288
290 FXHorizontalFrame* myColumnsFrame = nullptr;
291
293 FXFont* myIndexFont = nullptr;
294
296 FXFont* myIndexSelectedFont = nullptr;
297
300
302 std::vector<Column*> myColumns;
303
305 std::vector<Row*> myRows;
306
308 FXButton* myAddButton = nullptr;
309
312
313private:
316
319};
The dialog to change the view (gui) settings.
const int myCol
column index
const int myRow
row index
char getType() const
get column type
MFXLabelTooltip * myTopLabel
column top tooltip label
FXVerticalFrame * myVerticalCellFrame
vertical frame
const char myType
column type
FXVerticalFrame * getVerticalCellFrame() const
get vertical cell frame
const int myIndex
column index
void setColumnLabel(const std::string &text, const std::string &tooltip)
set column label
void adjustColumnWidth()
adjust column width
Column()
default constructor
MFXDecalsTable * myTable
pointer to table
FXVerticalFrame * myVerticalFrame
vertical frame
FXString getColumnLabel() const
get column label
Row()
default constructor
std::vector< Cell * > myCells
list wtih cells
MFXDecalsTable * myTable
poiner to table parent
void setText(int index, const std::string &text) const
set text
void disableButtons()
disable row buttons
const std::vector< Cell * > & getCells() const
get cells
std::string getText(int index) const
get text
MFXDecalsTable & operator=(const MFXDecalsTable &)=delete
Invalidated assignment operator.
bool moveFocus()
move focus to current row
long onCmdAddRow(FXObject *, FXSelector, void *)
called when add row button is pressed
std::vector< Column * > myColumns
columns
int getCurrentSelectedRow() const
Get current selected row.
FXHorizontalFrame * myColumnsFrame
horizontal columns frame
int getNumRows() const
Get number of rows.
long onFocusRow(FXObject *, FXSelector, void *)
called when a row is focused
MFXDecalsTable(const MFXDecalsTable &)=delete
Invalidated duplicate constructor.
~MFXDecalsTable()
destructor (Called automatically)
long onCmdRemoveRow(FXObject *, FXSelector, void *)
called when remove row button is pressed
int myCurrentSelectedRow
current selected row
void selectRow(const int rowIndex)
Select a row.
long onCmdEditRowSpinner(FXObject *, FXSelector, void *)
called when a spinner is updated
void setItemText(FXint row, FXint column, const std::string &text)
Modify cell text.
long onCmdEditRowCheckBox(FXObject *, FXSelector, void *)
called when a checkBox is updated
FXFont * myIndexSelectedFont
font for index selected
FXButton * myAddButton
add button
void fillTable()
fill table
long onCmdEditRowString(FXObject *, FXSelector, void *)
called when a string is updated
void setColumnLabel(const int column, const std::string &text, const std::string &tooltip="")
Change column header text.
FXFont * myIndexFont
font for index
std::vector< Row * > myRows
rows
std::string getItemText(const int row, const int column) const
Return cell text.
void clearTable()
clear table
void updateIndexLabel()
update index labels
long onCmdKeyPress(FXObject *, FXSelector, void *)
called when a key is pressed
GUIDialog_ViewSettings * myDialogViewSettings
@frame pointer to GUIDialog_ViewSettings parent
long onCmdOpenDecal(FXObject *, FXSelector, void *)
called when open decal button is pressed
long onUpdAddRow(FXObject *, FXSelector, void *)
update add row button
every row value