Eclipse SUMO - Simulation of Urban MObility
GUIDialog_GLObjChooser.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // Class for the window that allows to choose a street, junction or vehicle
18 /****************************************************************************/
19 #ifndef GUIDialog_GLObjChooser_h
20 #define GUIDialog_GLObjChooser_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <vector>
30 #include <set>
31 #include <fx.h>
33 
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class GUIGlChildWindow;
39 class GUIGlObjectStorage;
40 class GUIGlObject;
41 
42 
43 // ===========================================================================
44 // class definition
45 // ===========================================================================
52 class GUIDialog_GLObjChooser : public FXMainWindow {
53  // FOX-declarations
54  FXDECLARE(GUIDialog_GLObjChooser)
55 
56 public:
63  GUIDialog_GLObjChooser(GUIGlChildWindow* parent, FXIcon* icon, const FXString& title,
64  const std::vector<GUIGlID>& ids,
65  GUIGlObjectStorage& glStorage);
66 
67 
69  virtual ~GUIDialog_GLObjChooser();
70 
71 
76  return static_cast<GUIGlObject*>(mySelected);
77  }
78 
79 
80 
83 
85  long onCmdCenter(FXObject*, FXSelector, void*);
86 
88  long onCmdTrack(FXObject*, FXSelector, void*);
89 
91  long onCmdClose(FXObject*, FXSelector, void*);
92 
94  long onChgText(FXObject*, FXSelector, void*);
95 
97  long onCmdText(FXObject*, FXSelector, void*);
98 
100  long onListKeyPress(FXObject*, FXSelector, void*);
101 
103  long onCmdFilter(FXObject*, FXSelector, void*);
104 
106  long onCmdToggleSelection(FXObject*, FXSelector, void*);
107 
109  long onCmdLocateByName(FXObject*, FXSelector, void*);
111 
113  void show();
114 
115 protected:
116 
118  virtual void toggleSelection(int listIndex);
119 
121  void refreshList(const std::vector<GUIGlID>& ids);
122 
124  virtual std::string getObjectName(GUIGlObject* o) const;
125 
126 private:
128  FXList* myList;
129 
131  FXButton* myCenterButton;
132 
134  FXButton* myTrackButton;
135 
138 
141 
143  FXTextField* myTextEntry;
144 
146  //volatile pointers to GUIGlObject
147  std::set<GUIGlID> myIDs;
148 
151 
152 protected:
155 
156 };
157 
158 
159 #endif
160 
161 /****************************************************************************/
162 
void show()
sets the focus after the window is created to work-around bug in libfox
long onCmdFilter(FXObject *, FXSelector, void *)
Callback: Hides unselected items if pressed.
virtual void toggleSelection(int listIndex)
toggle selection (handled differently in NETEDIT)
virtual ~GUIDialog_GLObjChooser()
Destructor.
long onCmdCenter(FXObject *, FXSelector, void *)
Callback: The selected item shall be centered within the calling view.
long onCmdText(FXObject *, FXSelector, void *)
Callback: Selects to current item if enter is pressed.
long onCmdToggleSelection(FXObject *, FXSelector, void *)
Callback: Toggle selection status of current object.
long onCmdLocateByName(FXObject *, FXSelector, void *)
Callback: Toggle locator by name.
virtual std::string getObjectName(GUIGlObject *o) const
retrieve name for the given object
long onCmdTrack(FXObject *, FXSelector, void *)
Callback: The selected vehicle shall be tracked within the calling view.
bool myLocateByName
whether to locate by object name instead of id
FXList * myList
The list that holds the ids.
GUIGlChildWindow * myParent
The parent window.
A storage for of displayed objects via their numerical id.
void refreshList(const std::vector< GUIGlID > &ids)
update the list with the given ids
long onCmdClose(FXObject *, FXSelector, void *)
Callback: The dialog shall be closed.
FXButton * myTrackButton
The button that triggers tracking on the select vehicle.
FXButton * myCenterButton
The button that triggers centering on the select object.
std::set< GUIGlID > myIDs
myList contains (void) pointers to elements of myIDs instead of the more
GUIGlObject * getObject() const
Returns the chosen (selected) object.
long onListKeyPress(FXObject *, FXSelector, void *)
Callback: Selects to current item if enter is pressed.
GUIGlObject * mySelected
The chosen id.
FXTextField * myTextEntry
The text field.
long onChgText(FXObject *, FXSelector, void *)
Callback: Something has been typed into the the field.
GUIDialog_GLObjChooser()
FOX needs this.