Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/gui/div/GUIDialog_GLChosenEditor.h
169684 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 GUIDialog_GLChosenEditor.h
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @date Thu, 11.03.2004
18
///
19
// Editor for the list of chosen objects
20
/****************************************************************************/
21
#pragma once
22
#include <config.h>
23
24
#include <string>
25
#include <vector>
26
#include <utils/foxtools/fxheader.h>
27
28
#include <utils/gui/div/GUISelectedStorage.h>
29
#include <utils/gui/div/GUIPersistentWindowPos.h>
30
#include <utils/gui/windows/GUIMainWindow.h>
31
32
// ===========================================================================
33
// class declarations
34
// ===========================================================================
35
class GUIMainWindow;
36
37
38
// ===========================================================================
39
// class definition
40
// ===========================================================================
41
/**
42
* @class GUIDialog_GLChosenEditor
43
* @brief Editor for the list of chosen objects
44
*
45
* @see GUIMainWindow
46
* @see GUISelectedStorage
47
*/
48
class GUIDialog_GLChosenEditor : public FXMainWindow, public GUISelectedStorage::UpdateTarget, GUIPersistentWindowPos {
49
// FOX-declarations
50
FXDECLARE(GUIDialog_GLChosenEditor)
51
52
public:
53
/** @brief Constructor (Notifies both the parent and the storage about being initialised)
54
* @param[in] parent The parent window
55
* @param[in] str The storage of object selections to use
56
*/
57
GUIDialog_GLChosenEditor(GUIMainWindow* parent, GUISelectedStorage* str);
58
59
/// @brief Destructor (Notifies both the parent and the storage about being destroyed)
60
~GUIDialog_GLChosenEditor();
61
62
/// @brief Rebuilds the entire list
63
void rebuildList();
64
65
// @brief called if the global selection changes
66
void selectionUpdated();
67
68
/// @name FOX-callbacks
69
/// @{
70
71
/// @brief keyboard functions
72
//@{
73
long onKeyPress(FXObject* o, FXSelector sel, void* data);
74
//@}
75
76
/** @brief Called when the user presses the Load-button
77
*
78
* Opens a file dialog and forces the parent to load the list of selected
79
* objects when a file was chosen. Rebuilds the list, then, and redraws
80
* itself.
81
*
82
* @todo Recheck loading/saving of selections
83
*/
84
long onCmdLoad(FXObject*, FXSelector, void*);
85
86
/** @brief Called when the user presses the Save-button
87
*
88
* Opens a file dialog and forces the selection container to save the list
89
* of selected objects when a file was chosen.
90
*
91
* If the saving failed, a message window is shown.
92
*
93
* @todo Recheck loading/saving of selections
94
*/
95
long onCmdSave(FXObject*, FXSelector, void*);
96
97
/** @brief Called when the user presses the Deselect-button
98
*
99
* Determines which items were chosen and calls GUISelectedStorage::deselect
100
* for each.
101
*/
102
long onCmdDeselect(FXObject*, FXSelector, void*);
103
104
/** @brief Called when the user presses the Clear-button
105
*
106
* Clear the internal list and calls GUISelectedStorage::clear.
107
* Repaints itself
108
*/
109
long onCmdClear(FXObject*, FXSelector, void*);
110
111
/** @brief Called when the user presses the Close-button
112
*
113
* Closes itself.
114
*/
115
long onCmdClose(FXObject*, FXSelector, void*);
116
/// @}
117
118
protected:
119
/// FOX needs this
120
GUIDialog_GLChosenEditor() {}
121
122
private:
123
/// @brief The list that holds the ids
124
FXList* myList = nullptr;
125
126
/// @brief The parent window
127
GUIMainWindow* myParent = nullptr;
128
129
/// @brief The storage
130
GUISelectedStorage* myStorage = nullptr;
131
};
132
133