52 FXIMPLEMENT(
GUIDialog_GLChosenEditor, FXMainWindow, GUIDialog_GLChosenEditorMap, ARRAYNUMBER(GUIDialog_GLChosenEditorMap))
62 myParent(parent), myStorage(str) {
63 myStorage->add2Update(
this);
88 myParent->addChild(
this);
103 for (
auto i : chosen) {
105 if (
object !=
nullptr) {
107 FXListItem* item =
myList->getItem(
myList->appendItem(name.c_str()));
108 item->setData(
object);
118 FXMainWindow::update();
125 FXFileDialog opendialog(
this,
TL(
"Open List of Selected Items"));
127 opendialog.setSelectMode(SELECTFILE_EXISTING);
128 opendialog.setPatternList(
"*.txt\nAll files (*)");
132 if (opendialog.execute()) {
134 std::string file = opendialog.getFilename().text();
137 FXMessageBox::error(
this, MBOX_OK,
TL(
"Errors while loading Selection"),
"%s", msg.c_str());
155 FXMessageBox::error(
this, MBOX_OK,
TL(
"Storing failed!"),
"%s", e.what());
163 FXint no =
myList->getNumItems();
165 std::vector<GUIGlID> selected;
166 for (i = 0; i < no; ++i) {
167 if (
myList->getItem(i)->isSelected()) {
172 for (i = 0; i < (FXint) selected.size(); ++i) {
@ MID_CANCEL
Cancel-button pressed.
@ MID_CHOOSEN_SAVE
Save set.
@ MID_CHOOSEN_DESELECT
Deselect selected items.
@ MID_CHOOSER_LIST
Object list.
@ MID_CHOOSEN_LOAD
Load set.
@ MID_CHOOSEN_CLEAR
Clear set.
#define GUIDesignChooserButtons
design for Chooser buttons
#define GUIDesignChooserLayoutLeft
design for Chooser Layout left
#define GUIDesignChooserLayoutRight
design for Chooser Layout right
#define GUIDesignHorizontalSeparator
#define GUIDesignChooserLayoutList
design for Chooser Layout list
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
#define GUIDesignChooserDialog
#define GUIDesignChooserListMultiple
design for Chooser List
FXDEFMAP(GUIDialog_GLChosenEditor) GUIDialog_GLChosenEditorMap[]
GUISelectedStorage gSelected
A global holder of selected objects.
FXString gCurrentFolder
The folder used as last.
GUIIcon
An enumeration of icons used by the gui applications.
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
Editor for the list of chosen objects.
FXList * myList
The list that holds the ids.
GUISelectedStorage * myStorage
The storage.
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user presses the Load-button.
long onCmdDeselect(FXObject *, FXSelector, void *)
Called when the user presses the Deselect-button.
GUIMainWindow * myParent
The parent window.
~GUIDialog_GLChosenEditor()
Destructor (Notifies both the parent and the storage about being destroyed)
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user presses the Save-button.
long onCmdClose(FXObject *, FXSelector, void *)
Called when the user presses the Close-button.
void selectionUpdated()
called when selection is updated
long onCmdClear(FXObject *, FXSelector, void *)
Called when the user presses the Clear-button.
void rebuildList()
Rebuilds the entire list.
const std::string & getFullName() const
GUIGlID getGlID() const
Returns the numerical id of the object.
void unblockObject(GUIGlID id)
Marks an object as unblocked.
GUIGlObject * getObjectBlocking(GUIGlID id) const
Returns the object from the container locking it.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void updateChildren(int msg=MID_SIMSTEP)
update childrens
void removeChild(FXMainWindow *child)
removes the given child window from the list (FXMainWindow)
Persists window position in the registry.
Storage for "selected" objects.
void save(GUIGlObjectType type, const std::string &filename)
Saves a selection list.
std::string load(const std::string &filename, GUIGlObjectType type=GLO_MAX)
Loads a selection list (optionally with restricted type)
void clear()
Clears the list of selected objects.
void remove2Update()
Removes the dialog to be updated.
void deselect(GUIGlID id)
Deselects the object with the given id.
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.