// [03/14/07] The file dialogs need refactoring, and will be refactored in Jugg.
// Things that might need to change:
// - The interface is not in fact platform agnotsic, it is win32 oriented.
// - Filter format is highly windows specific, and is a little fragile, both for
// win32 and for other platforms.
// - Platform specific path strings are exposed to the console, because the
// protected validators save them as such.
// - Several of the FDS_XXX values are not options we want to give the user, such
// as NOT warning on file overwrite. The values FDS_OVERWRITEPROMPT,
// FDS_MUSTEXIST, and FDS_CHANGEPATH are not good things to give the user.
// - The Execute method is virtual for good reason. It should be implemented for
// each subclass. If common behavior is needed for Execute(), it can be
// factored out in hidden platform specific code.
/// @defgroup SystemDialogs Using System Dialogs
/// @ingroup SystemDialogs
/// FileDialogOpaqueData is both defined and implemented on a platform specific
/// basis.
classFileDialogOpaqueData;
/// @ingroup SystemDialogs
/// @internal
/// Platform Agnostic Structure for holding information about a file dialog.
structFileDialogData
{
public:
FileDialogData();
~FileDialogData();
enumDialogStyle
{
FDS_OPEN=BIT(0),///< This is an open dialog.
FDS_SAVE=BIT(1),///< This is a save dialog.
FDS_OVERWRITEPROMPT=BIT(2),///< Can only be used in conjunction with style SaveDialog: prompt for a confirmation if a file will be overwritten.
FDS_MUSTEXIST=BIT(3),///< The user may only select files that actually exist.
FDS_MULTIPLEFILES=BIT(4),///< Can only be used in conjunction with style OpenDialog: allows selecting multiple files.
FDS_CHANGEPATH=BIT(5),///< Change the current working path to the directory where the file(s) chosen by the user are.
FDS_BROWSEFOLDER=BIT(6)///< Select folders instead of files
};
U8mStyle;///< Specifies the Style of the File Dialog @see DialogStyle
StringTableEntrymFilters;///< List of Filters pipe separated e.g. "BMP Files (*.bmp)|*.bmp|JPG Files (*.jpg)|*.jpg"
//StringTableEntry mFiles; // this is never used ///< Should only be referenced when using dialogStyle OpenDialog AND MultipleFiles: List of Files returned pipe separated
StringTableEntrymFile;///< Should be referenced when dialogStyle MultipleFiles is NOT used: the file path of the user selected file.
StringTableEntrymDefaultPath;///< Default path of dialog
StringTableEntrymDefaultFile;///< Default selected file of dialog
StringTableEntrymTitle;///< Title to display in file dialog
FileDialogOpaqueData*mOpaqueData;///< Stores platform specific info about the dialog
};
/// @ingroup SystemDialogs
/// FileDialog is a platform agnostic dialog interface for querying the user for
/// file locations. It is designed to be used through the exposed
/// scripting interface.
///
/// FileDialog is the base class for Native File Dialog controls in Torque. It provides these
/// basic areas of functionality:
///
/// - Inherits from SimObject and is exposed to the scripting interface
/// - Provides blocking interface to allow instant return to script execution
/// - Simple object configuration makes practical use easy and effective
///
/// @attention
/// FileDialog is *NOT* intended to be used directly in script and is only exposed to script
/// to expose generic file dialog attributes.
/// @see OpenFileDialog for a practical example on opening a file
/// @see SaveFileDialog for a practical example of saving a file
///
///
/// @{
classFileDialog:publicSimObject
{
typedefSimObjectParent;
protected:
FileDialogDatamData;///< Stores platform agnostic information about the dialogs properties
boolmChangePath;///< Exposed ChangePath Property
boolmBoolTranslator;///< Internally used to translate boolean values into their respective bits of dialog style