54FXIMPLEMENT(
GUIDialog_GLChosenEditor, FXMainWindow, GUIDialog_GLChosenEditorMap, ARRAYNUMBER(GUIDialog_GLChosenEditorMap))
62#pragma warning(disable: 4355)
67 myParent(parent), myStorage(str) {
111 for (
auto i : chosen) {
113 if (
object !=
nullptr) {
115 FXListItem* item =
myList->getItem(
myList->appendItem(name.c_str()));
116 item->setData(
object);
126 FXMainWindow::update();
133 FXFileDialog opendialog(
this,
TL(
"Open List of Selected Items"));
135 opendialog.setSelectMode(SELECTFILE_EXISTING);
140 if (opendialog.execute()) {
142 std::string file = opendialog.getFilename().text();
145 FXMessageBox::error(
this, MBOX_OK,
TL(
"Errors while loading Selection"),
"%s", msg.c_str());
165 FXMessageBox::error(
this, MBOX_OK,
TL(
"Storing failed!"),
"%s", e.what());
173 FXint no =
myList->getNumItems();
175 std::vector<GUIGlID> selected;
176 for (i = 0; i < no; ++i) {
177 if (
myList->getItem(i)->isSelected()) {
182 for (i = 0; i < (FXint) selected.size(); ++i) {
194 const FXEvent* e = (FXEvent*) ptr;
195 if(e->code==KEY_Escape){
199 return FXMainWindow::onKeyPress(o, sel, ptr);
@ 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.
long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
void selectionUpdated()
called when selection is updated
GUIDialog_GLChosenEditor()
FOX needs this.
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)
void addChild(FXMainWindow *child)
Adds a further child window to 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.
void clear()
Clears the list of selected objects.
void add2Update(UpdateTarget *updateTarget)
Adds a dialog to be updated.
void remove2Update()
Removes the dialog to be updated.
void deselect(GUIGlID id)
Deselects the object with the given id.
const std::unordered_set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
std::string load(const std::string &filename, GUIGlObjectType type=GLO_MAX, std::ostream *dynamicNotFound=nullptr)
Loads a selection list (optionally with restricted type)
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extensions, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
static StringBijection< TXTFileExtension > TXTFileExtensions
TXT file Extensions.