 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
53 FXIMPLEMENT(
GUIDialog_GLChosenEditor, FXMainWindow, GUIDialog_GLChosenEditorMap, ARRAYNUMBER(GUIDialog_GLChosenEditorMap))
62 myParent(parent), myStorage(str) {
63 myStorage->add2Update(
this);
88 myParent->addChild(
this);
102 for (
auto i : chosen) {
104 if (
object !=
nullptr) {
106 FXListItem* item =
myList->getItem(
myList->appendItem(name.c_str()));
107 item->setData(
object);
117 FXMainWindow::update();
124 FXFileDialog opendialog(
this,
"Open List of Selected Items");
126 opendialog.setSelectMode(SELECTFILE_EXISTING);
127 opendialog.setPatternList(
"*.txt\nAll files (*)");
131 if (opendialog.execute()) {
133 std::string file = opendialog.getFilename().text();
136 FXMessageBox::error(
this, MBOX_OK,
"Errors while loading Selection",
"%s", msg.c_str());
153 FXMessageBox::error(
this, MBOX_OK,
"Storing failed!",
"%s", e.what());
161 FXint no =
myList->getNumItems();
163 std::vector<GUIGlID> selected;
164 for (i = 0; i < no; ++i) {
165 if (
myList->getItem(i)->isSelected()) {
166 selected.push_back(static_cast<GUIGlObject*>(
myList->getItem(i)->getData())->getGlID());
170 for (i = 0; i < (FXint) selected.size(); ++i) {
long onCmdClear(FXObject *, FXSelector, void *)
Called when the user presses the Clear-button.
#define GUIDesignChooserLayoutLeft
design for Chooser Layout left
void save(GUIGlObjectType type, const std::string &filename)
Saves a selection list.
~GUIDialog_GLChosenEditor()
Destructor (Notifies both the parent and the storage about being destroyed)
long onCmdDeselect(FXObject *, FXSelector, void *)
Called when the user presses the Deselect-button.
GUIMainWindow * myParent
The parent window.
const std::string & getFullName() const
GUISelectedStorage * myStorage
The storage.
void rebuildList()
Rebuilds the entire list.
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user presses the Load-button.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
std::string load(const std::string &filename, GUIGlObjectType type=GLO_MAX)
Loads a selection list (optionally with restricted type)
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
void selectionUpdated()
called when selection is updated
FXDEFMAP(GUIDialog_GLChosenEditor) GUIDialog_GLChosenEditorMap[]
long onCmdClose(FXObject *, FXSelector, void *)
Called when the user presses the Close-button.
#define GUIDesignHorizontalSeparator
void remove2Update()
Removes the dialog to be updated.
void removeChild(FXMainWindow *child)
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
#define GUIDesignChooserButtons
design for Chooser buttons
FXString gCurrentFolder
The folder used as last.
void clear()
Clears the list of selected objects.
void unblockObject(GUIGlID id)
Marks an object as unblocked.
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user presses the Save-button.
Storage for "selected" objects.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
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
#define GUIDesignChooserListMultiple
design for Chooser List
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
#define GUIDesignChooserLayoutRight
design for Chooser Layout right
void deselect(GUIGlID id)
Deselects the object with the given id.
FXList * myList
The list that holds the ids.
Editor for the list of chosen objects.