Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/frames/GNEAttributesEditorRow.h
169678 views
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
/****************************************************************************/
14
/// @file GNEAttributesEditorRow.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2024
17
///
18
// Row used for edit attributes in GNEAttributesEditorType
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEAttributesEditorType.h"
24
25
// ===========================================================================
26
// class declaration
27
// ===========================================================================
28
29
class GNEAttributeCarrier;
30
class MFXLabelTooltip;
31
class MFXTextFieldIcon;
32
33
// ===========================================================================
34
// class definitions
35
// ===========================================================================
36
37
class GNEAttributesEditorRow : protected FXHorizontalFrame {
38
/// @brief FOX-declaration
39
FXDECLARE(GNEAttributesEditorRow)
40
41
public:
42
/// @brief constructor
43
GNEAttributesEditorRow(GNEAttributesEditorType* attributeTable);
44
45
/// @brief return true if attribute row was successfully show
46
bool showAttributeRow(GNEAttributesEditorType* attributeTable, const GNEAttributeProperties* attrProperty, const bool forceDisable);
47
48
/// @brief hide attribute row (always return false)
49
bool hideAttributeRow();
50
51
/// @brief disable
52
void disable();
53
54
/// @brief get attribute property
55
const GNEAttributeProperties* getAttrProperty() const;
56
57
/// @brief get current value in string format
58
std::string getCurrentValue() const;
59
60
/// @brief check if current attribute row is valid
61
bool isValueValid() const;
62
63
/// @brief check if current attribute row is shown
64
bool isAttributeRowShown() const;
65
66
/// @brief fill sumo Base object
67
SumoXMLAttr fillSumoBaseObject(CommonXMLStructure::SumoBaseObject* baseObject, const bool insertDefaultValues) const;
68
69
/// @name FOX-callbacks
70
/// @{
71
72
/// @brief set new string/bool attribute
73
long onCmdSetAttribute(FXObject* obj, FXSelector, void*);
74
75
/// @brief called when user press the checkBox for toogle enable/disable attribute
76
long onCmdToggleEnableAttribute(FXObject*, FXSelector, void*);
77
78
/// @brief called when user press "edit color" dialog
79
long onCmdOpenColorDialog(FXObject* sender, FXSelector, void* arg);
80
81
/// @brief called when user press "open allow" dialog
82
long onCmdOpenVClassDialog(FXObject*, FXSelector, void*);
83
84
/// @brief called when user press "open file" dialog
85
long onCmdOpenFileDialog(FXObject*, FXSelector, void*);
86
87
/// @brief called when user press reparent button
88
long onCmdReparent(FXObject*, FXSelector, void*);
89
90
/// @brief called when user press "inspect parent"
91
long onCmdInspectParent(FXObject*, FXSelector, void*);
92
93
/// @brief called when user press "move lane up"
94
long onCmdMoveLaneUp(FXObject*, FXSelector, void*);
95
96
/// @brief called when user press "move lane down"
97
long onCmdMoveLaneDown(FXObject*, FXSelector, void*);
98
99
/// @}
100
101
protected:
102
/// @brief default constructor (needed for FOX)
103
GNEAttributesEditorRow();
104
105
/// @brief get value from edited ACs
106
const std::string getAttributeValue(const bool enabled) const;
107
108
/// @brief show attribute toogle enable
109
void showAttributeToggleEnable(const GNEAttributeProperties* attrProperty, const bool value);
110
111
/// @brief show attribute button reparent
112
void showAttributeReparent(const bool enabled);
113
114
/// @brief show attribute button inspect parent
115
void showAttributeInspectParent(const GNEAttributeProperties* attrProperty, const bool enabled);
116
117
/// @brief show attribute button vClass
118
void showAttributeVClass(const GNEAttributeProperties* attrProperty, const bool enabled);
119
120
/// @brief show attribute button color
121
void showAttributeColor(const GNEAttributeProperties* attrProperty, const bool enabled);
122
123
/// @brief show attribute button file
124
void showAttributeFile(const GNEAttributeProperties* attrProperty, const bool enabled);
125
126
/// @brief show attribute label
127
void showAttributeLabel(const GNEAttributeProperties* attrProperty);
128
129
/// @brief hide all attribute elements
130
void hideAllAttributeElements();
131
132
/// @brief show value for check button
133
void showValueCheckButton(const std::string& value, const bool enabled, const bool computed);
134
135
/// @brief show value for combo Box
136
void showValueComboBox(const GNEAttributeProperties* attrProperty, const std::string& value, const bool enabled, const bool computed);
137
138
/// @brief show value for strings
139
void showValueString(const std::string& value, const bool enabled, const bool computed);
140
141
/// @brief show move lane buttons
142
void showMoveLaneButtons(const std::string& laneID);
143
144
/// @brief check if enable or disable all elements depending of current supermode or forceDisable
145
void enableElements(const GNEAttributeProperties* attrProperty, const bool forceDisable);
146
147
/// @brief check if the given attribute is enabled
148
bool isAttributeEnabled(const GNEAttributeProperties* attrProperty) const;
149
150
private:
151
/// @brief pointer to attribute table parent
152
GNEAttributesEditorType* myAttributeTable;
153
154
/// @brief edited attribute property
155
const GNEAttributeProperties* myAttrProperty = nullptr;
156
157
/// @brief pointer to attribute label
158
MFXLabelTooltip* myAttributeLabel = nullptr;
159
160
/// @brief pointer to attribute menu check
161
FXCheckButton* myAttributeToggleEnableCheckButton = nullptr;
162
163
/// @brief pointer to button that can be used for files, color, parent, vclass or inspect
164
MFXButtonTooltip* myAttributeButton = nullptr;
165
166
/// @brief pointer to text field for modify values
167
MFXTextFieldIcon* myValueTextField = nullptr;
168
169
/// @brief pointer to combo box for select choices
170
MFXComboBoxIcon* myValueComboBox = nullptr;
171
172
/// @brief pointer to menu check
173
FXCheckButton* myValueCheckButton = nullptr;
174
175
/// @brief Button for move lane up
176
MFXButtonTooltip* myValueLaneUpButton = nullptr;
177
178
/// @brief Button for move lane down
179
MFXButtonTooltip* myValueLaneDownButton = nullptr;
180
181
/// @brief Invalidated copy constructor.
182
GNEAttributesEditorRow(GNEAttributesEditorRow*) = delete;
183
184
/// @brief Invalidated assignment operator.
185
GNEAttributesEditorRow& operator=(GNEAttributesEditorRow*) = delete;
186
};
187
188