 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
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();
90 myParent->getParent()->addChild(
this);
104 FXMainWindow::show();
111 int selected =
myList->getCurrentItem();
122 int selected =
myList->getCurrentItem();
125 GUIGlID id = *static_cast<GUIGlID*>(
myList->getItemData(selected));
148 const int numItems =
myList->getNumItems();
150 for (
int i = 0; i < numItems; i++) {
151 if (
myList->getItemText(i).lower().find(t) >= 0) {
160 if (
myList->getNumItems() > 0) {
168 myList->makeItemVisible(
id);
170 myList->setCurrentItem(
id,
true);
179 int current =
myList->getCurrentItem();
180 if (current >= 0 &&
myList->isItemSelected(current)) {
190 FXEvent*
event = (FXEvent*)ptr;
191 switch (event->code) {
205 std::vector<GUIGlID> selectedGlIDs;
206 const int numItems =
myList->getNumItems();
207 for (
int i = 0; i < numItems; i++) {
208 const GUIGlID glID = *static_cast<GUIGlID*>(
myList->getItemData(i));
210 selectedGlIDs.push_back(glID);
220 std::vector<GUIGlID> selectedGlIDs;
221 const int numItems =
myList->getNumItems();
223 for (
int i = 0; i < numItems; i++) {
224 if (
myList->getItemText(i).lower().find(t) >= 0) {
225 const GUIGlID glID = *static_cast<GUIGlID*>(
myList->getItemData(i));
226 selectedGlIDs.push_back(glID);
265 int i =
myList->getCurrentItem();
269 myList->setItemIcon(i,
nullptr);
282 std::vector<std::pair<std::string, GUIGlID> > namesAndIDs;
284 const int numItems =
myList->getNumItems();
285 for (
int i = 0; i < numItems; i++) {
286 GUIGlID glID = *static_cast<GUIGlID*>(
myList->getItemData(i));
290 namesAndIDs.push_back(std::make_pair(name, glID));
294 std::sort(namesAndIDs.begin(), namesAndIDs.end());
295 std::vector<GUIGlID> selectedGlIDs;
296 for (
const auto& item : namesAndIDs) {
297 selectedGlIDs.push_back(item.second);
307 GUIGlID* glID = static_cast<GUIGlID*>(
myList->getItemData(listIndex));
const unsigned char flag[]
bool myLocateByName
whether to locate by object name instead of id
FXList * myList
The list that holds the ids.
virtual void stopTrack()
stop track
A storage for of displayed objects via their numerical id.
#define GUIDesignChooserLayoutLeft
design for Chooser Layout left
virtual ~GUIDialog_GLObjChooser()
Destructor.
long onCmdClose(FXObject *, FXSelector, void *)
Callback: The dialog shall be closed.
long onCmdToggleSelection(FXObject *, FXSelector, void *)
Callback: Toggle selection status of current object.
Filter list by substring.
long onListKeyPress(FXObject *, FXSelector, void *)
Callback: Selects to current item if enter is pressed.
virtual const std::string getOptionalName() const
Returns the name of the object (default "")
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
long onCmdFilterSubstr(FXObject *, FXSelector, void *)
Callback: Hides unmatched items if pressed.
long onCmdCenter(FXObject *, FXSelector, void *)
Callback: The selected item shall be centered within the calling view.
long onChgText(FXObject *, FXSelector, void *)
Callback: Something has been typed into the the field.
FXDEFMAP(GUIDialog_GLObjChooser) GUIDialog_GLObjChooserMap[]
virtual std::string getObjectName(GUIGlObject *o) const
@bbrief retrieve name for the given object
long onCmdFilter(FXObject *, FXSelector, void *)
Callback: Hides unselected items if pressed.
#define GUIDesignHorizontalSeparator
GUIGlID getGlID() const
Returns the numerical id of the object.
void removeChild(FXMainWindow *child)
GUIMainWindow * getParent()
Returns the main window.
long onCmdLocateByName(FXObject *, FXSelector, void *)
Callback: Toggle locator by name.
GUIGlChildWindow * myParent
The parent window.
FXTextField * myTextEntry
The text field.
#define GUIDesignChooserTextField
design for Chooser TextField
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
#define GUIDesignChooserButtons
design for Chooser buttons
FXButton * myTrackButton
The button that triggers tracking on the select vehicle.
virtual void toggleSelection(int listIndex)
toggle selection (handled differently in NETEDIT)
virtual void startTrack(int)
star track
#define GUIDesignChooserListSingle
design for Chooser List
void unblockObject(GUIGlID id)
Marks an object as unblocked.
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.
virtual bool isSelected(GUIGlObject *o) const
true if the object is selected (may include extra logic besides calling gSelected)
void setView(GUIGlID id)
Centers the view onto the given artifact.
long onCmdTrack(FXObject *, FXSelector, void *)
Callback: The selected vehicle shall be tracked within the calling view.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
std::set< GUIGlID > myIDs
myList contains (void) pointers to elements of myIDs instead of the more
GUISelectedStorage gSelected
A global holder of selected objects.
#define GUIDesignChooserLayoutList
design for Chooser Layout list
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frames used to pack another frames extended in all directions
#define GUIDesignChooserDialog
void show()
sets the focus after the window is created to work-around bug in libfox
void refreshList(const std::vector< GUIGlID > &ids)
update the list with the given ids
void toggleSelection(GUIGlID id)
Toggles selection of an object.
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
#define GUIDesignChooserLayoutRight
design for Chooser Layout right
GUISUMOAbstractView * getView() const
return GUISUMOAbstractView