Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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-2025 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// ===========================================================================
39class GUIGlObject;
40
41
42// ===========================================================================
43// class definition
44// ===========================================================================
51class GUIDialog_ChooserAbstract : public FXMainWindow, public GUIPersistentWindowPos {
52 // FOX-declarations
54
55public:
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
80 long onKeyPress(FXObject* o, FXSelector sel, void* data);
82
84 long onCmdCenter(FXObject*, FXSelector, void*);
85
87 long onCmdTrack(FXObject*, FXSelector, void*);
88
90 long onCmdClose(FXObject*, FXSelector, void*);
91
93 long onChgText(FXObject*, FXSelector, void*);
94
96 long onCmdText(FXObject*, FXSelector, void*);
97
99 long onChgList(FXObject*, FXSelector, void*);
100
102 long onChgListSel(FXObject*, FXSelector, void*);
103
105 long onCmdFilter(FXObject*, FXSelector, void*);
106
108 long onCmdFilterSubstr(FXObject*, FXSelector, void*);
109
111 long onCmdToggleSelection(FXObject*, FXSelector, void*);
112 long onCmdAddListSelection(FXObject*, FXSelector, void*);
113 long onCmdClearListSelection(FXObject*, FXSelector, void*);
114
116 long onCmdLocateByName(FXObject*, FXSelector, void*);
117
119 long onCmdUpdate(FXObject*, FXSelector, void*);
121
123 void show();
124 using FXMainWindow::show; // to silence the warning C4266 about a hidden function
125
126 int getMessageId() const {
127 return myMessageId;
128 }
129
130protected:
132 FOX_CONSTRUCTOR(GUIDialog_ChooserAbstract)
133
134
135 virtual void toggleSelection(int listIndex);
136
138 virtual void select(int listIndex);
139
141 virtual void deselect(int listIndex);
142
144 virtual void filterACs(const std::vector<GUIGlID>& GLIDs);
145
147 void refreshList(const std::vector<GUIGlID>& ids);
148
150 virtual std::string getObjectName(GUIGlObject* o) const;
151
152private:
155
158
160 FXList* myList;
161
163 FXButton* myCenterButton;
164
166 FXButton* myTrackButton;
167
170
172 FXTextField* myTextEntry;
173
175 std::set<GUIGlID> myIDs;
176
179
182
184 FXLabel* myCountLabel;
185
187 FXCheckButton* myCaseSensitive;
188
190 FXCheckButton* myInstantCenter;
191
192};
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.
long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
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 onChgText(FXObject *, FXSelector, void *)
Callback: Something has been typed into 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
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 / 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.