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.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 /****************************************************************************/
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>
31 #include "GUIAppEnum.h"
32 
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class GUIGlChildWindow;
38 class GUIGlObjectStorage;
39 class GUIGlObject;
40 
41 
42 // ===========================================================================
43 // class definition
44 // ===========================================================================
51 class GUIDialog_ChooserAbstract : public FXMainWindow, public GUIPersistentWindowPos {
52  // FOX-declarations
53  FXDECLARE(GUIDialog_ChooserAbstract)
54 
55 public:
63  GUIDialog_ChooserAbstract(GUIGlChildWindow* windowsParent, int messageId,
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 onChgList(FXObject*, FXSelector, void*);
98 
100  long onChgListSel(FXObject*, FXSelector, void*);
101 
103  long onCmdFilter(FXObject*, FXSelector, void*);
104 
106  long onCmdFilterSubstr(FXObject*, FXSelector, void*);
107 
109  long onCmdToggleSelection(FXObject*, FXSelector, void*);
110  long onCmdAddListSelection(FXObject*, FXSelector, void*);
111  long onCmdClearListSelection(FXObject*, FXSelector, void*);
112 
114  long onCmdLocateByName(FXObject*, FXSelector, void*);
115 
117  long onCmdUpdate(FXObject*, FXSelector, void*);
119 
121  void show();
122 
123  int getMessageId() const {
124  return myMessageId;
125  }
126 
127 protected:
129  FOX_CONSTRUCTOR(GUIDialog_ChooserAbstract)
130 
131 
132  virtual void toggleSelection(int listIndex);
133 
135  virtual void select(int listIndex);
136 
138  virtual void deselect(int listIndex);
139 
141  virtual void filterACs(const std::vector<GUIGlID>& GLIDs);
142 
144  void refreshList(const std::vector<GUIGlID>& ids);
145 
147  virtual std::string getObjectName(GUIGlObject* o) const;
148 
149 private:
152 
155 
157  FXList* myList;
158 
160  FXButton* myCenterButton;
161 
163  FXButton* myTrackButton;
164 
167 
169  FXTextField* myTextEntry;
170 
172  std::set<GUIGlID> myIDs;
173 
176 
179 
181  FXLabel* myCountLabel;
182 
184  FXCheckButton* myCaseSensitive;
185 
187  FXCheckButton* myInstantCenter;
188 
189 };
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.
FXCheckButton * myCaseSensitive
Whether search is case sensitive.
int myMessageId
the object type being chosen
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.
virtual void deselect(int listIndex)
unset selection (handled differently in netedit)
virtual void select(int listIndex)
set selection (handled differently in netedit)
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
FXLabel * myCountLabel
label for declaring list size
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
long onCmdUpdate(FXObject *, FXSelector, void *)
Callback: Update list.
std::set< GUIGlID > myIDs
myList contains (void) pointers to elements of myIDs instead of the more volatile pointers to GUIGlOb...
long onChgListSel(FXObject *, FXSelector, void *)
Callback: Current list item selection has changed.
GUIGlObject * mySelected
The chosen id.
long onCmdClearListSelection(FXObject *, FXSelector, void *)
long onCmdAddListSelection(FXObject *, FXSelector, void *)
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
GUIDialog_ChooserAbstract(GUIGlChildWindow *windowsParent, int messageId, FXIcon *icon, const FXString &title, const std::vector< GUIGlID > &ids, GUIGlObjectStorage &glStorage)
Constructor.
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 / list.
FXCheckButton * myInstantCenter
Whether each change in the list should re-center the view.
long onChgList(FXObject *, FXSelector, void *)
Callback: Current list item has changed.
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.
Persists window position in the registry.