Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/dialogs/GNEUndoListDialog.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 GNEUndoListDialog.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Oct 2021
17
///
18
// Dialog for show undo-list
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEDialog.h"
24
25
// ===========================================================================
26
// class declarations
27
// ===========================================================================
28
29
class MFXTextFieldIcon;
30
31
// ===========================================================================
32
// class definitions
33
// ===========================================================================
34
35
class GNEUndoListDialog : public GNEDialog {
36
/// @brief FOX-declaration
37
FXDECLARE(GNEUndoListDialog)
38
39
public:
40
/// @brief Constructor
41
GNEUndoListDialog(GNEApplicationWindow* applicationWindow);
42
43
/// @brief destructor
44
~GNEUndoListDialog();
45
46
/// @brief run internal test
47
void runInternalTest(const InternalTestStep::DialogArgument* dialogArgument);
48
49
/// @name FOX-callbacks
50
/// @{
51
52
/// @brief event after select row
53
long onCmdSelectRow(FXObject*, FXSelector, void*);
54
55
/// @}
56
57
protected:
58
/// @struct class for keep every row value
59
struct UndoListRow {
60
/// @brief constructor
61
UndoListRow(const int index_, FXIcon* icon_, const std::string description_, const std::string timestamp_);
62
63
/// @brief index uses for count undo/redos
64
int index = 0;
65
66
/// @brief icon associated with undo/redo operation
67
FXIcon* icon = nullptr;
68
69
/// @brief definition of undo/redo operation
70
std::string description;
71
72
/// @brief timestamp
73
std::string timestamp;
74
};
75
76
/// @brief row used for show GUI row elements
77
class GUIRow {
78
79
public:
80
/// @brief constructor
81
GUIRow(GNEUndoListDialog* undoListDialog, FXVerticalFrame* mainFrame, MFXStaticToolTip* staticToolTip);
82
83
/// @brief destructor
84
~GUIRow();
85
86
/// @brief update row
87
void update(const UndoListRow& row);
88
89
/// @brief get index
90
int getIndex() const;
91
92
/// @brief get radio button (read only)
93
const FXRadioButton* getRadioButton() const;
94
95
/// @brief set red background
96
void setRedBackground();
97
98
/// @brief set blue background
99
void setBlueBackground();
100
101
/// @brief check row and set background green
102
void checkRow();
103
104
private:
105
/// @brief radioButton
106
FXRadioButton* myRadioButton;
107
108
/// @brief index
109
int myIndex = 0;
110
111
/// @brief label with icon
112
FXLabel* myIcon = nullptr;
113
114
/// @brief textField description
115
MFXTextFieldIcon* myTextFieldDescription = nullptr;
116
117
/// @brief textField timeStamp
118
FXTextField* myTextFieldTimeStamp = nullptr;
119
};
120
121
/// @brief FOX needs this
122
FOX_CONSTRUCTOR(GNEUndoListDialog)
123
124
/// @brief update list destroying and creating rows
125
void updateList();
126
127
/// @brief frame for rows
128
FXVerticalFrame* myRowFrame = nullptr;
129
130
/// @brief vector with rows
131
std::vector<GUIRow*> myGUIRows;
132
133
private:
134
/// @brief Invalidated copy constructor.
135
GNEUndoListDialog(const GNEUndoListDialog&) = delete;
136
137
/// @brief Invalidated assignment operator.
138
GNEUndoListDialog& operator=(const GNEUndoListDialog&) = delete;
139
};
140
141