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 GUIGLObjectPopupMenu.h
15 : /// @author Daniel Krajzewicz
16 : /// @author Jakob Erdmann
17 : /// @author Michael Behrisch
18 : /// @date Sept 2002
19 : ///
20 : // The popup menu of a globject.
21 : /****************************************************************************/
22 : #pragma once
23 : #include <config.h>
24 :
25 : #include <vector>
26 : #include <utils/foxtools/fxheader.h>
27 : #include <utils/geom/Position.h>
28 :
29 :
30 : // ===========================================================================
31 : // class declarations
32 : // ===========================================================================
33 : class GUISUMOAbstractView;
34 : class GUIGlObject;
35 : class GUIMainWindow;
36 :
37 :
38 : // ===========================================================================
39 : // class definitions
40 : // ===========================================================================
41 : /**
42 : * @class GUIGLObjectPopupMenu
43 : * @brief The popup menu of a globject
44 : */
45 : class GUIGLObjectPopupMenu : public FXMenuPane {
46 : // FOX-declarations
47 0 : FXDECLARE(GUIGLObjectPopupMenu)
48 :
49 : public:
50 :
51 : /// @name cursor dialog type
52 : enum class PopupType {
53 : ATTRIBUTES,
54 : PROPERTIES,
55 : SELECT_ELEMENT,
56 : DELETE_ELEMENT,
57 : FRONT_ELEMENT
58 : };
59 :
60 : /** @brief Constructor
61 : * @param[in] app The main window for instantiation of other windows
62 : * @param[in] parent The parent view for changing it
63 : * @param[in] o The object of interest
64 : */
65 : GUIGLObjectPopupMenu(GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject& o);
66 :
67 : /** @brief Constructor
68 : * @param[in] app The main window for instantiation of other windows
69 : * @param[in] parent The parent view for changing it
70 : */
71 : GUIGLObjectPopupMenu(GUIMainWindow* app, GUISUMOAbstractView* parent, PopupType popupType);
72 :
73 : /// @brief Destructor
74 : virtual ~GUIGLObjectPopupMenu();
75 :
76 : /// @brief Insert a sub-menu pane in this GUIGLObjectPopupMenu
77 : void insertMenuPaneChild(FXMenuPane* child);
78 :
79 : // @brief remove popup menu from objects
80 : void removePopupFromObject();
81 :
82 : /// @brief return the real owner of this popup
83 : GUISUMOAbstractView* getParentView();
84 :
85 : /// @brief popup type;
86 : PopupType getPopupType() const;
87 :
88 : /// @name FX Calls
89 : /// @{
90 : /// @brief Called if the assigned objects shall be centered
91 : long onCmdCenter(FXObject*, FXSelector, void*);
92 :
93 : /// @brief Called if the name shall be copied to clipboard
94 : long onCmdCopyName(FXObject*, FXSelector, void*);
95 :
96 : /// @brief Called if the typed name shall be copied to clipboard
97 : long onCmdCopyTypedName(FXObject*, FXSelector, void*);
98 :
99 : /// @brief Called if the edge name shall be copied to clipboard (for lanes only)
100 : long onCmdCopyEdgeName(FXObject*, FXSelector, void*);
101 :
102 : /// @brief Called if the test coordinates shall be copied to clipboard (only if gui-testing option is enabled)
103 : long onCmdCopyTestCoordinates(FXObject*, FXSelector, void*);
104 :
105 : /// @brief Called if the cursor position shall be copied to clipboard
106 : long onCmdCopyCursorPosition(FXObject*, FXSelector, void*);
107 :
108 : /// @brief Called if the cursor geo-position shall be copied to clipboard
109 : long onCmdCopyCursorGeoPosition(FXObject*, FXSelector, void*);
110 :
111 : /// @brief Called if the current geo-boundary shall be copied to clipboard
112 : long onCmdCopyViewGeoBoundary(FXObject*, FXSelector, void*);
113 :
114 : /// @brief Called if the cursor geo-position shall be shown online
115 : long onCmdShowCursorGeoPositionOnline(FXObject*, FXSelector, void*);
116 :
117 : /// @brief Called if the parameter of this object shall be shown
118 : long onCmdShowPars(FXObject*, FXSelector, void*);
119 :
120 : /// @brief Called if the type parameter of this object shall be shown
121 : long onCmdShowTypePars(FXObject*, FXSelector, void*);
122 :
123 : /// @brief Called if the object shall be added to the list of selected objects
124 : long onCmdAddSelected(FXObject*, FXSelector, void*);
125 :
126 : /// @brief Called if the object shall be removed from the list of selected objects
127 : long onCmdRemoveSelected(FXObject*, FXSelector, void*);
128 :
129 : /// @}
130 :
131 : protected:
132 : /// @brief FOX needs this
133 : GUIGLObjectPopupMenu();
134 :
135 : /// @brief The parent window
136 : GUISUMOAbstractView* myParent;
137 :
138 : /// @brief The object that belongs to this popup-menu
139 : GUIGlObject* myObject;
140 :
141 : /// @brief The main application
142 : GUIMainWindow* myApplication;
143 :
144 : /// @brief popup type;
145 : const PopupType myPopupType;
146 :
147 : /// @brief The position within the network the cursor was above when instanting the popup
148 : const Position myNetworkPosition;
149 :
150 : /// @brief The test coordinates position when instanting the popup
151 : const std::string myTestCoordinates;
152 :
153 : /// @brief vector mit Sub-MenuPanes
154 : std::vector<FXMenuPane*> myMenuPanes;
155 : };
|