Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEElementTable.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-2025 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 in GNEElementList
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include "GNEElementList.h"
24
25// ===========================================================================
26// class declaration
27// ===========================================================================
28
30
31// ===========================================================================
32// class definitions
33// ===========================================================================
34
35class GNEElementTable : public FXVerticalFrame {
36
37public:
39 class ColumnHeader : protected FXHorizontalFrame {
40
41 public:
43 ColumnHeader(GNEElementTable* elementTable, const GNETagProperties* tagProperties);
44
47
49 void enableRowHeader();
50
52 void disableRowHeader();
53
55 size_t getNumColumns() const;
56
58 int getAttributeIndex(SumoXMLAttr attr) const;
59
61 const std::vector<SumoXMLAttr>& getSortableAttributes();
62
63 private:
65 std::vector<SumoXMLAttr> mySortableAttrs;
66
68 std::vector<std::pair<SumoXMLAttr, FXLabel*> > myLabels;
69
71 ColumnHeader(const ColumnHeader&) = delete;
72
75 };
76
78 class Row : protected FXHorizontalFrame {
80 FXDECLARE(Row)
81
82 public:
84 Row(GNEElementTable* elementTable, const size_t rowIndex,
86
88 ~Row();
89
91 void enableRow();
92
94 void disableRow();
95
98
100 std::string getValue(const size_t column) const;
101
103 bool isValid() const;
104
107
109 long onCmdEditRow(FXObject* sender, FXSelector, void*);
110
112 long onCmdRemoveRow(FXObject* sender, FXSelector, void*);
113
115 long onCmdOpenElementDialog(FXObject* sender, FXSelector, void*);
116
118 long onCmdOpenVClassDialog(FXObject* sender, FXSelector, void*);
119
121
122 protected:
124 FOX_CONSTRUCTOR(Row)
125
126
128
130 const size_t myRowIndex = 0;
131
134
136 FXLabel* myIndexLabel = nullptr;
137
140
142 FXButton* myRemoveButton = nullptr;
143
145 FXButton* myOpenVClassButton = nullptr;
146
148 FXButton* myOpenDialogButton = nullptr;
149
150 private:
152 Row(const Row&) = delete;
153
155 Row& operator=(const Row&) = delete;
156 };
157
159 GNEElementTable(GNEElementList* elementList, const GNETagProperties* tagProperties, GNEElementList::Options options);
160
163
166
168 void enableTable();
169
171 void disableTable();
172
174 bool isValid() const;
175
177 void resizeTable(const size_t numRows);
178
180 void updateRow(const size_t index, GNEAttributeCarrier* AC);
181
183 std::string getValue(const size_t rowIndex, const size_t columnIndex) const;
184
185
186protected:
189
192
195
197 FXScrollWindow* myScrollWindow = nullptr;
198
200 FXVerticalFrame* myRowsFrame = nullptr;
201
203 std::vector<Row*> myRows;
204
205private:
208
210 GNEElementTable& operator=(const GNEElementTable&) = delete;
211};
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
ColumnHeader & operator=(const ColumnHeader &)=delete
Invalidated assignment operator.
int getAttributeIndex(SumoXMLAttr attr) const
get column with the given
ColumnHeader(const ColumnHeader &)=delete
Invalidated duplicate constructor.
const std::vector< SumoXMLAttr > & getSortableAttributes()
get sortable attributes
void disableRowHeader()
disable row header
std::vector< std::pair< SumoXMLAttr, FXLabel * > > myLabels
labels
std::vector< SumoXMLAttr > mySortableAttrs
sortable attributes
void enableRowHeader()
enable row header
size_t getNumColumns() const
get num columns
long onCmdEditRow(FXObject *sender, FXSelector, void *)
called when user edits a row
FXButton * myRemoveButton
remove button
long onCmdOpenVClassDialog(FXObject *sender, FXSelector, void *)
called when user press open vClass dialog button
std::vector< std::pair< SumoXMLAttr, MFXTextFieldIcon * > > myAttributeTextFields
list with textfields and their associated attribute
long onCmdOpenElementDialog(FXObject *sender, FXSelector, void *)
called when user press open element dialog button
void enableRow()
enable row
GNEAttributeCarrier * myAC
attribute carrier
FXButton * myOpenDialogButton
open dialog button
void updateRow(GNEAttributeCarrier *AC)
update row
bool isValid() const
check if current value is valid
FXButton * myOpenVClassButton
open vClass button
FXLabel * myIndexLabel
index label
std::string getValue(const size_t column) const
get value of the given column index
GNEElementTable * myElementTable
FOX needs this.
const size_t myRowIndex
index of the row
long onCmdRemoveRow(FXObject *sender, FXSelector, void *)
called when user press remove button
void disableRow()
disable row
ColumnHeader * myColumnHeader
column header
GNEElementList * myElementList
pointer to the parent element list
GNEElementList::Options myOptions
GNEElementList options.
FXScrollWindow * myScrollWindow
scrollWindow for rows
void disableTable()
Disable table.
std::vector< Row * > myRows
rows
FXVerticalFrame * myRowsFrame
vertical frame for rows
void resizeTable(const size_t numRows)
resize table
ColumnHeader * getColumnHeader() const
get column header
void enableTable()
Enable table.
Definition json.hpp:4471