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-2018 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 onCmdClose(FXObject*, FXSelector, void*);
89 
91  long onChgText(FXObject*, FXSelector, void*);
92 
94  long onCmdText(FXObject*, FXSelector, void*);
95 
97  long onListKeyPress(FXObject*, FXSelector, void*);
98 
100  long onCmdFilter(FXObject*, FXSelector, void*);
101 
103  long onCmdToggleSelection(FXObject*, FXSelector, void*);
105 
107  void show();
108 
109 protected:
110 
112  virtual void toggleSelection(int listIndex);
113 
115  void refreshList(const std::vector<GUIGlID>& ids);
116 
118  virtual std::string getObjectName(GUIGlObject* o) const;
119 
120 private:
122  FXList* myList;
123 
125  FXButton* myCenterButton;
126 
129 
132 
134  FXTextField* myTextEntry;
135 
137  //volatile pointers to GUIGlObject
138  std::set<GUIGlID> myIDs;
139 
140 
141 protected:
144 
145 };
146 
147 
148 #endif
149 
150 /****************************************************************************/
151 
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.
virtual std::string getObjectName(GUIGlObject *o) const
retrieve name for the given object
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 * 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.