Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2001-2024 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 0 : 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 Called when the user presses the Load-button
72 : *
73 : * Opens a file dialog and forces the parent to load the list of selected
74 : * objects when a file was chosen. Rebuilds the list, then, and redraws
75 : * itself.
76 : *
77 : * @todo Recheck loading/saving of selections
78 : */
79 : long onCmdLoad(FXObject*, FXSelector, void*);
80 :
81 : /** @brief Called when the user presses the Save-button
82 : *
83 : * Opens a file dialog and forces the selection container to save the list
84 : * of selected objects when a file was chosen.
85 : *
86 : * If the saving failed, a message window is shown.
87 : *
88 : * @todo Recheck loading/saving of selections
89 : */
90 : long onCmdSave(FXObject*, FXSelector, void*);
91 :
92 : /** @brief Called when the user presses the Deselect-button
93 : *
94 : * Determines which items were chosen and calls GUISelectedStorage::deselect
95 : * for each.
96 : */
97 : long onCmdDeselect(FXObject*, FXSelector, void*);
98 :
99 : /** @brief Called when the user presses the Clear-button
100 : *
101 : * Clear the internal list and calls GUISelectedStorage::clear.
102 : * Repaints itself
103 : */
104 : long onCmdClear(FXObject*, FXSelector, void*);
105 :
106 : /** @brief Called when the user presses the Close-button
107 : *
108 : * Closes itself.
109 : */
110 : long onCmdClose(FXObject*, FXSelector, void*);
111 : /// @}
112 :
113 : protected:
114 : /// FOX needs this
115 0 : GUIDialog_GLChosenEditor() {}
116 :
117 : private:
118 : /// @brief The list that holds the ids
119 : FXList* myList = nullptr;
120 :
121 : /// @brief The parent window
122 : GUIMainWindow* myParent = nullptr;
123 :
124 : /// @brief The storage
125 : GUISelectedStorage* myStorage = nullptr;
126 : };
|