Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEElementList.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// ===========================================================================
24// class declaration
25// ===========================================================================
26
27class GNEDialog;
28class GNEElementTable;
30
31// ===========================================================================
32// class definitions
33// ===========================================================================
34
35class GNEElementList : public FXVerticalFrame {
37 FXDECLARE_ABSTRACT(GNEElementList)
38
39public:
41 enum class Options : int {
42 NONE = 1 << 0, // nothing to show
43 SORTELEMENTS = 1 << 1, // show button sort elements
44 DIALOG_ELEMENT = 1 << 2, // show button for open dialog element
45 DIALOG_VCLASS = 1 << 3, // show button for open dialog vClass
46 FIXED_HEIGHT = 1 << 4, // fixed height
47 };
48
50 GNEElementList(FXVerticalFrame* contentFrame, const GNETagProperties* tagProperty, GNEElementList::Options options);
51
54
56 void enableList();
57
59 void disableList(const std::string& reason);
60
62 bool isListValid() const;
63
65 virtual long updateList() = 0;
66
68 virtual long addNewElement() = 0;
69
71 virtual long sortRows() = 0;
72
74 virtual long removeElement(const size_t rowIndex) = 0;
75
77 virtual long openElementDialog(const size_t rowIndex) = 0;
78
81
83 long onCmdAddRow(FXObject* sender, FXSelector, void*);
84
86 long onCmdSort(FXObject* sender, FXSelector, void*);
87
89
90protected:
92 FOX_CONSTRUCTOR(GNEElementList)
93
94
96
99
101 void removeElementRecursively(GNEAdditional* additionalElement) const;
102
104 void removeElementRecursively(GNEDemandElement* demandElement) const;
105
106private:
108 FXButton* myAddButton = nullptr;
109
111 FXButton* mySortButton = nullptr;
112
114 FXLabel* myLabel = nullptr;
115
118
120 GNEElementList& operator=(const GNEElementList&) = delete;
121};
122
125 return static_cast<GNEElementList::Options>(static_cast<int>(a) | static_cast<int>(b));
126}
127
130 return (static_cast<int>(a) & static_cast<int>(b)) != 0;
131}
constexpr bool operator&(GNEElementList::Options a, GNEElementList::Options b)
override attribute parent bit operator
~GNEElementList()
destructor
virtual long updateList()=0
update element list
virtual long removeElement(const size_t rowIndex)=0
remove element
virtual long openElementDialog(const size_t rowIndex)=0
open element dialog
long onCmdAddRow(FXObject *sender, FXSelector, void *)
called when user press add button
virtual long sortRows()=0
open dialog
Options
FOX-declaration.
void disableList(const std::string &reason)
disable list
void enableList()
enable list
const GNETagProperties * myTagProperty
FOX needs this.
FXLabel * myLabel
label
virtual long addNewElement()=0
add element
GNEElementTable * myElementTable
element table
long onCmdSort(FXObject *sender, FXSelector, void *)
called when user press sort button
FXButton * mySortButton
sort button
bool isListValid() const
check if the current list is valid
FXButton * myAddButton
add button
void removeElementRecursively(GNEAdditional *additionalElement) const
delete additional element recursively