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-2022 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>
30#include "GUIAppEnum.h"
31
32
33// ===========================================================================
34// class declarations
35// ===========================================================================
38class GUIGlObject;
39
40
41// ===========================================================================
42// class definition
43// ===========================================================================
50class GUIDialog_ChooserAbstract : public FXMainWindow {
51 // FOX-declarations
53
54public:
62 GUIDialog_ChooserAbstract(GUIGlChildWindow* windowsParent, int messageId,
63 FXIcon* icon, const FXString& title, const std::vector<GUIGlID>& ids,
64 GUIGlObjectStorage& glStorage);
65
68
72 GUIGlObject* getObject() const;
73
76
78 long onCmdCenter(FXObject*, FXSelector, void*);
79
81 long onCmdTrack(FXObject*, FXSelector, void*);
82
84 long onCmdClose(FXObject*, FXSelector, void*);
85
87 long onChgText(FXObject*, FXSelector, void*);
88
90 long onCmdText(FXObject*, FXSelector, void*);
91
93 long onListKeyPress(FXObject*, FXSelector, void*);
94
96 long onChgList(FXObject*, FXSelector, void*);
97
99 long onChgListSel(FXObject*, FXSelector, void*);
100
102 long onCmdFilter(FXObject*, FXSelector, void*);
103
105 long onCmdFilterSubstr(FXObject*, FXSelector, void*);
106
108 long onCmdToggleSelection(FXObject*, FXSelector, void*);
109 long onCmdAddListSelection(FXObject*, FXSelector, void*);
110 long onCmdClearListSelection(FXObject*, FXSelector, void*);
111
113 long onCmdLocateByName(FXObject*, FXSelector, void*);
114
116 long onCmdUpdate(FXObject*, FXSelector, void*);
118
120 void show();
121
122 int getMessageId() const {
123 return myMessageId;
124 }
125
126protected:
128 FOX_CONSTRUCTOR(GUIDialog_ChooserAbstract)
129
130
131 virtual void toggleSelection(int listIndex);
132
134 virtual void select(int listIndex);
135
137 virtual void deselect(int listIndex);
138
140 virtual void filterACs(const std::vector<GUIGlID>& GLIDs);
141
143 void refreshList(const std::vector<GUIGlID>& ids);
144
146 virtual std::string getObjectName(GUIGlObject* o) const;
147
148private:
151
154
156 FXList* myList;
157
159 FXButton* myCenterButton;
160
162 FXButton* myTrackButton;
163
166
168 FXTextField* myTextEntry;
169
171 std::set<GUIGlID> myIDs;
172
175
178
180 FXLabel* myCountLabel;
181
183 FXCheckButton* myCaseSensitive;
184
186 FXCheckButton* myInstantCenter;
187
188};
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.