Eclipse SUMO - Simulation of Urban MObility
GUIDialog_ChooserAbstract.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-2020 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 /****************************************************************************/
20 // Class for the window that allows to choose a street, junction or vehicle
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <string>
26 #include <vector>
27 #include <set>
28 #include <fx.h>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class GUISUMOViewParent;
36 class GNEViewParent;
37 class GUIGlChildWindow;
38 class GUIGlObjectStorage;
39 class GUIGlObject;
40 
41 
42 // ===========================================================================
43 // class definition
44 // ===========================================================================
51 class GUIDialog_ChooserAbstract : public FXMainWindow {
52  // FOX-declarations
53  FXDECLARE(GUIDialog_ChooserAbstract)
54 
55 public:
64  FXIcon* icon, const FXString& title, const std::vector<GUIGlID>& ids,
65  GUIGlObjectStorage& glStorage);
66 
69 
73  GUIGlObject* getObject() const;
74 
77 
79  long onCmdCenter(FXObject*, FXSelector, void*);
80 
82  long onCmdTrack(FXObject*, FXSelector, void*);
83 
85  long onCmdClose(FXObject*, FXSelector, void*);
86 
88  long onChgText(FXObject*, FXSelector, void*);
89 
91  long onCmdText(FXObject*, FXSelector, void*);
92 
94  long onListKeyPress(FXObject*, FXSelector, void*);
95 
97  long onCmdFilter(FXObject*, FXSelector, void*);
98 
100  long onCmdFilterSubstr(FXObject*, FXSelector, void*);
101 
103  long onCmdToggleSelection(FXObject*, FXSelector, void*);
104 
106  long onCmdLocateByName(FXObject*, FXSelector, void*);
108 
110  void show();
111 
112 protected:
114  FOX_CONSTRUCTOR(GUIDialog_ChooserAbstract)
115 
116 
117  virtual void toggleSelection(int listIndex);
118 
120  virtual void filterACs(const std::vector<GUIGlID>& GLIDs);
121 
123  void refreshList(const std::vector<GUIGlID>& ids);
124 
126  virtual std::string getObjectName(GUIGlObject* o) const;
127 
128 private:
131 
133  FXList* myList;
134 
136  FXButton* myCenterButton;
137 
139  FXButton* myTrackButton;
140 
143 
145  FXTextField* myTextEntry;
146 
148  std::set<GUIGlID> myIDs;
149 
152 
155 };
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:81
bool myLocateByName
whether to locate by object name instead of id
FXButton * myCenterButton
The button that triggers centering on the select object.
long onCmdText(FXObject *, FXSelector, void *)
Callback: Selects to current item if enter is pressed.
long onCmdClose(FXObject *, FXSelector, void *)
Callback: The dialog shall be closed.
void refreshList(const std::vector< GUIGlID > &ids)
update the list with the given ids
long onCmdCenter(FXObject *, FXSelector, void *)
Callback: The selected item shall be centered within the calling view.
virtual ~GUIDialog_ChooserAbstract()
Destructor.
long onCmdFilter(FXObject *, FXSelector, void *)
Callback: Hides unselected items if pressed.
long onCmdFilterSubstr(FXObject *, FXSelector, void *)
Callback: Hides unmatched items if pressed.
void show()
sets the focus after the window is created to work-around bug in libfox
long onCmdTrack(FXObject *, FXSelector, void *)
Callback: The selected vehicle shall be tracked within the calling view.
long onCmdLocateByName(FXObject *, FXSelector, void *)
Callback: Toggle locator by name.
bool myHaveFilteredSubstring
whether the list was filter by substring
long onListKeyPress(FXObject *, FXSelector, void *)
Callback: Selects to current item if enter is pressed.
long onChgText(FXObject *, FXSelector, void *)
Callback: Something has been typed into the the field.
GUIGlChildWindow * myWindowsParent
window parent
std::set< GUIGlID > myIDs
myList contains (void) pointers to elements of myIDs instead of the more volatile pointers to GUIGlOb...
GUIGlObject * mySelected
The chosen id.
virtual void toggleSelection(int listIndex)
fox need this
FXButton * myTrackButton
The button that triggers tracking on the select vehicle.
virtual std::string getObjectName(GUIGlObject *o) const
@bbrief retrieve name for the given object
virtual void filterACs(const std::vector< GUIGlID > &GLIDs)
filter ACs (needed in NETEDIT)
FXTextField * myTextEntry
The text field.
long onCmdToggleSelection(FXObject *, FXSelector, void *)
Callback: Toggle selection status of current object.
GUIDialog_ChooserAbstract(GUIGlChildWindow *windowsParent, FXIcon *icon, const FXString &title, const std::vector< GUIGlID > &ids, GUIGlObjectStorage &glStorage)
Constructor.
GUIGlObject * getObject() const
Returns the chosen (selected) object.
FXList * myList
The list that holds the ids.
A storage for of displayed objects via their numerical id.
A single child window which contains a view of the simulation area.