56 FXIMPLEMENT(
GUIDialog_GLObjChooser, FXMainWindow, GUIDialog_GLObjChooserMap, ARRAYNUMBER(GUIDialog_GLObjChooserMap))
65 myLocateByName(false) {
78 if (title.text() != std::string(
"Vehicle Chooser")) {
79 myTrackButton->disable();
80 myTrackButton->hide();
89 myParent->getParent()->addChild(
this);
103 FXMainWindow::show();
110 int selected =
myList->getCurrentItem();
121 int selected =
myList->getCurrentItem();
147 const int numItems =
myList->getNumItems();
149 for (
int i = 0; i < numItems; i++) {
150 if (
myList->getItemText(i).lower().find(t) >= 0) {
159 if (
myList->getNumItems() > 0) {
167 myList->makeItemVisible(
id);
169 myList->setCurrentItem(
id,
true);
178 int current =
myList->getCurrentItem();
179 if (current >= 0 &&
myList->isItemSelected(current)) {
189 FXEvent*
event = (FXEvent*)ptr;
190 switch (event->code) {
204 std::vector<GUIGlID> selectedGlIDs;
205 const int numItems =
myList->getNumItems();
206 for (
int i = 0; i < numItems; i++) {
209 selectedGlIDs.push_back(glID);
247 int i =
myList->getCurrentItem();
251 myList->setItemIcon(i,
nullptr);
253 myList->setItemIcon(i, flag);
264 std::vector<std::pair<std::string, GUIGlID> > namesAndIDs;
266 const int numItems =
myList->getNumItems();
267 for (
int i = 0; i < numItems; i++) {
272 namesAndIDs.push_back(std::make_pair(name, glID));
276 std::sort(namesAndIDs.begin(), namesAndIDs.end());
277 std::vector<GUIGlID> selectedGlIDs;
278 for (
const auto& item : namesAndIDs) {
279 selectedGlIDs.push_back(item.second);
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.
void toggleSelection(GUIGlID id)
Toggles selection of an object.
#define GUIDesignChooserDialog
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.
FXDEFMAP(GUIDialog_GLObjChooser) GUIDialog_GLObjChooserMap[]
virtual void stopTrack()
stop track
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.
long onCmdLocateByName(FXObject *, FXSelector, void *)
Callback: Toggle locator by name.
const unsigned char flag[]
virtual void startTrack(int)
star track
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frames used to pack another frames extended in all directions ...
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
#define GUIDesignHorizontalSeparator
#define GUIDesignChooserLayoutList
design for Chooser Layout list
virtual std::string getObjectName(GUIGlObject *o) const
retrieve name for the given object
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
long onCmdTrack(FXObject *, FXSelector, void *)
Callback: The selected vehicle shall be tracked within the calling view.
bool myLocateByName
whether to locate by object name instead of id
FXList * myList
The list that holds the ids.
#define GUIDesignChooserLayoutLeft
design for Chooser Layout left
GUIGlChildWindow * myParent
The parent window.
#define GUIDesignChooserButtons
design for Chooser buttons
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
A storage for of displayed objects via their numerical id.
void refreshList(const std::vector< GUIGlID > &ids)
update the list with the given ids
#define GUIDesignChooserLayoutRight
design for Chooser Layout right
long onCmdClose(FXObject *, FXSelector, void *)
Callback: The dialog shall be closed.
virtual const std::string getOptionalName() const
Returns the name of the object (default "")
FXButton * myTrackButton
The button that triggers tracking on the select vehicle.
void setView(GUIGlID id)
Centers the view onto the given artifact.
void removeChild(FXMainWindow *child)
GUISUMOAbstractView * getView() const
return GUISUMOAbstractView
#define GUIDesignChooserTextField
design for Chooser TextField
GUIGlID getGlID() const
Returns the numerical id of the object.
FXButton * myCenterButton
The button that triggers centering on the select object.
GUIMainWindow * getParent()
Returns the main window.
virtual bool isSelected(GUIGlObject *o) const
true if the object is selected (may include extra logic besides calling gSelected) ...
std::set< GUIGlID > myIDs
myList contains (void) pointers to elements of myIDs instead of the more
void unblockObject(GUIGlID id)
Marks an object as unblocked.
#define GUIDesignChooserListSingle
design for Chooser List
long onListKeyPress(FXObject *, FXSelector, void *)
Callback: Selects to current item if enter is pressed.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
GUISelectedStorage gSelected
A global holder of selected objects.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
FXTextField * myTextEntry
The text field.
long onChgText(FXObject *, FXSelector, void *)
Callback: Something has been typed into the the field.