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) {
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) {
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
FXDEFMAP(GUIDialog_GLChosenEditor) GUIDialog_GLChosenEditorMap[]
#define GUIDesignChooserDialog
void remove2Update()
Removes the dialog to be updated.
Editor for the list of chosen objects.
FXString gCurrentFolder
The folder used as last.
~GUIDialog_GLChosenEditor()
Destructor (Notifies both the parent and the storage about being destroyed)
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
long onCmdClear(FXObject *, FXSelector, void *)
Called when the user presses the Clear-button.
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frames used to pack another frames extended in all directions ...
#define GUIDesignHorizontalSeparator
#define GUIDesignChooserLayoutList
design for Chooser Layout list
long onCmdDeselect(FXObject *, FXSelector, void *)
Called when the user presses the Deselect-button.
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user presses the Load-button.
void rebuildList()
Rebuilds the entire list.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
#define GUIDesignChooserLayoutLeft
design for Chooser Layout left
#define GUIDesignChooserButtons
design for Chooser buttons
std::string load(const std::string &filename, GUIGlObjectType type=GLO_MAX)
Loads a selection list (optionally with restricted type)
void removeChild(FXMDIChild *child)
removes the given child window from the list
#define GUIDesignChooserLayoutRight
design for Chooser Layout right
long onCmdClose(FXObject *, FXSelector, void *)
Called when the user presses the Close-button.
Storage for "selected" objects.
#define GUIDesignChooserListMultiple
design for Chooser List
void deselect(GUIGlID id)
Deselects the object with the given id.
void clear()
Clears the list of selected objects.
void unblockObject(GUIGlID id)
Marks an object as unblocked.
const std::string & getFullName() const
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user presses the Save-button.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
GUIMainWindow * myParent
The parent window.
GUISelectedStorage gSelected
A global holder of selected objects.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
GUISelectedStorage * myStorage
The storage.
void selectionUpdated()
called when selection is updated
FXList * myList
The list that holds the ids.
void save(GUIGlObjectType type, const std::string &filename)
Saves a selection list.