#ifndef DateiDialog_H #define DateiDialog_H #include "Array.h" #include "Thread.h" namespace Framework { class Text; //! Text.h void InitDialog(); //! Creates a file open/save dialog class DateiDialog : public virtual ReferenceCounter { private: RCArray* typeName; RCArray* type; int fileIndex; public: //! Constructor DLLEXPORT DateiDialog(); //! Destructor DLLEXPORT ~DateiDialog(); //! Clears the list of allowed file types DLLEXPORT void removeDateiTypen(); //! Adds an allowed file type //! \param name The name of the file type. Visible to the user in the //! select box \param typ The file type that may be selected DLLEXPORT void addDateiTyp(const char* name, const char* typ); //! Adds an allowed file type //! \param name The name of the file type. Visible to the user in the //! select box \param typ The file type that may be selected DLLEXPORT void addDateiTyp(Text* name, Text* typ); //! Sets the initially selected file type //! \param i The index of the file type. The one added first //! has index 0. DLLEXPORT void setDateiTypAuswahl(int i); //! Shows the file dialog //! \param open true if the dialog should be used for opening. false for //! saving \return The path to the selected file DLLEXPORT Text* anzeigen(bool open) const; }; //! Manages a file open/save dialog without blocking class DateiDialogTh : public Thread { private: DateiDialog* dialog; Text* ret; bool open; public: //! Constructor DLLEXPORT DateiDialogTh(); //! Destructor DLLEXPORT ~DateiDialogTh(); //! Sets whether the dialog is for opening or saving //! \param b 1 if for opening. 0 if for saving DLLEXPORT void setOpen(bool b); //! Clears the list of allowed file types DLLEXPORT void removeDateiTypen(); //! Adds an allowed file type //! \param name The name of the file type. Visible to the user in the //! select box \param typ The file type that may be selected DLLEXPORT void addDateiTyp(const char* name, const char* typ); //! Adds an allowed file type //! \param name The name of the file type. Visible to the user in the //! select box \param typ The file type that may be selected DLLEXPORT void addDateiTyp(Text* name, Text* typ); //! Sets the initially selected file type //! \param i The index of the file type. The one added first //! has index 0. DLLEXPORT void setDateiTypAuswahl(int i); //! This function is called by the class itself. //! Use the start function to show the dialog DLLEXPORT void thread() override; //! Returns the path to the file. //! Only works after the thread has finished DLLEXPORT Text* getPfad() const; //! Returns the path to the file without increased reference counter. //! Only works after the thread has finished DLLEXPORT Text* zPfad() const; }; }; // namespace Framework #endif