Class FileDropType
See Also: Class DropType, , Class URLTab, Class SceneFileDropType, Class ImageFileDropType, Class ImportFileDropType, Class ScriptFileDropType, List of DropTypes
class FileDropType : public DropType
Description:
This class is available in release 4.0 and later only.
This is an intermediate base class for drop content that comes in the form of a package of filenames or URLS. This class maintains a list of all its subclass singleton instances and provides utility methods for finding an appropriate subclass instance, based on the dropped filename, and for download URL packages.
Data Members:
protected:
static Tab<FileDropType*> fileDropTypes;
The table of FileDropTypes.
static TSTR download_directory;
Cache for current default URL package download directory .
public
static URLTab current_package;
Currently dropping URL package. Filled in by the active DropClipFormat in its ParseDataObject() method .
Methods:
public:
Prototype:
FileDropType();
Remarks:
Constructor.
Prototype:
static void Init();
Remarks:
This method clears the currently-parsed drop data.
Default Implementation:
{ current_package.Clear(); DropType::Init(); }
Prototype:
virtual int TypeCode()=0;
Remarks:
This method returns the typecode of the DropType.
Default Implementation:
{ return FILE_DROPTYPE; }
Prototype:
virtual bool IsDropType(int code);
Remarks:
This method returns TRUE if the DropType is of the specified DropType code, otherwise FALSE.
Parameters:
int code
The DropType code.
Default Implementation:
{ return code == TypeCode() || code == FILE_DROPTYPE; }
Prototype:
virtual bool Load(bool showProgress = true);
Remarks:
This method will load the URLTab in current_package (filled in by the current DropClipFormat).
Parameters:
bool showProgress = true
The download progress dialog can be displayed by passing true.
Prototype:
static FileDropType* FindDropType(TCHAR* filename, IDataObject* pDataObject = NULL);
Remarks:
This method finds and returns the FileDropType subclass corresponding to the given filename suffix. See the List of DropTypes for more details.
Parameters:
TCHAR* filename
The filename suffix.
IDataObject* pDataObject = NULL
A pointer to the IDataObject.
Return Value:
The FileDropType that corresponds to the filename suffix. This could be one of the following; sceneFileDropType, imageFileDropType, importFileDropType, dropScriptFileDropType.
Prototype:
virtual bool CheckDropType(TCHAR* filename);
Remarks:
Subclasses should implement this method to recognize the file types associated with this drop type. This is used by FindDropType().
Parameters:
TCHAR* filename
The filename suffix.
Return Value:
TRUE if the filename suffix checks out, otherwise FALSE.
Default Implementation:
{ return false; }
Prototype:
static bool DownloadPackage(URLTab& package, TCHAR* szDirectory, HWND hwnd = NULL, bool showProgress = true);
Remarks:
This method serves as a utility function that can be used to download a package of URLs to the specified directory. If the hwnd argument is supplied, any progress or other messages are centered over that window.
Parameters:
URLTab& package
A reference to the local copies of the URL strings.
TCHAR* directory
The directory path string to download to.
HWND hwnd = NULL
A handle to the window. If this is set to NULL, the default 3ds max window is used.
bool showProgress = false
The download progress dialog can be displayed by passing true.
Return Value:
TRUE if the download was successful, otherwise FALSE.
Prototype:
static TCHAR* GetDownloadDirectory();
Remarks:
This method returns the fully-specified path to the directory in which package drops are downloaded.
Prototype:
static bool DownloadUrlToDisk(HWND hwnd, TCHAR* szUrl, TCHAR* szPathname, DWORD flags=0);
Remarks:
This method allows you to download the file referenced by the URL to disk.
Parameters:
HWND hwnd = NULL
A handle to the window.
TCHAR* url
The URL string of the file to download.
TCHAR* fileName
The filename string of the URL to store on disk.
DWORD flags=0
Additional controls to the download behavior. Currently only one flag is supported, DOWNLOADDLG_NOPLACE, which hides an option in the progress dialog that allows the user to place (move) a dropped object immediately after being dropped.
Return Value:
TRUE if the download was successful, otherwise FALSE.