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(GNEDialog* parentDialog, FXVerticalFrame* contentFrame, SumoXMLTag tag, GNEElementList::Options options);
51
54
56 void enableList();
57
59 void disableList(const std::string& reason);
60
62 bool isListValid() const;
63
66
68 virtual long updateList() = 0;
69
71 virtual long addNewElement() = 0;
72
74 virtual long sortRows() = 0;
75
77 virtual long removeElement(const size_t rowIndex) = 0;
78
80 virtual long openElementDialog(const size_t rowIndex) = 0;
81
84
86 long onCmdAddRow(FXObject* sender, FXSelector, void*);
87
89 long onCmdSort(FXObject* sender, FXSelector, void*);
90
92
93protected:
95 FOX_CONSTRUCTOR(GNEElementList)
96
97
99
102
105
107 void removeElementRecursively(GNEAdditional* additionalElement) const;
108
110 void removeElementRecursively(GNEDemandElement* demandElement) const;
111
112private:
114 FXButton* myAddButton = nullptr;
115
117 FXButton* mySortButton = nullptr;
118
120 FXLabel* myLabel = nullptr;
121
124
126 GNEElementList& operator=(const GNEElementList&) = delete;
127};
128
131 return static_cast<GNEElementList::Options>(static_cast<int>(a) | static_cast<int>(b));
132}
133
136 return (static_cast<int>(a) & static_cast<int>(b)) != 0;
137}
constexpr bool operator&(GNEElementList::Options a, GNEElementList::Options b)
override attribute parent bit operator
SumoXMLTag
Numbers representing SUMO-XML - element names.
~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
pointer to tag property
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
GNEDialog * myDialogParent
FOX needs this.
bool isListValid() const
check if the current list is valid
FXButton * myAddButton
add button
void removeElementRecursively(GNEAdditional *additionalElement) const
delete additional element recursively
GNEDialog * getDialogParent()
pointer to dialog parent