Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | Static Protected Attributes

FileDropType Class Reference

Search for all occurrences

Detailed Description

See also:
Class DropType, Class URLTab, Class SceneFileDropType, Class ImageFileDropType, Class ImportFileDropType, Class ScriptFileDropType, DropTypes.
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 module 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 modules.
Data Members:
protected:

static Tab<FileDropType*> fileDropTypes;

The table of FileDropTypes.

static MSTR download_directory;

Cache for current default URL module download directory .

public

static URLTab current_package;

Currently dropping URL module. Filled in by the active DropClipFormat in its ParseDataObject() method .

#include <idraganddrop.h>

Inheritance diagram for FileDropType:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  FileDropType ()
int  TypeCode ()
bool  IsDropType (int code)
CoreExport bool  Load (bool showProgress=true)
virtual bool  CheckDropType (MCHAR *filename)
STDMETHODIMP  GetData (FORMATETC *pFormatetc, STGMEDIUM *pmedium)
STDMETHODIMP  GetDataHere (FORMATETC *pFormatetc, STGMEDIUM *pmedium)
STDMETHODIMP  QueryGetData (FORMATETC *pFormatetc)

Static Public Member Functions

static void  Init ()
static CoreExport FileDropType FindDropType (MCHAR *filename, IDataObject *pDataObject=NULL)
static CoreExport bool  DownloadPackage (URLTab &module, MCHAR *szDirectory, HWND hwnd=NULL, bool showProgress=true)
static CoreExport MCHAR *  GetDownloadDirectory ()
static CoreExport bool  DownloadUrlToDisk (HWND hwnd, MCHAR *szUrl, MCHAR *szPathname, DWORD flags=0)

Static Public Attributes

static CoreExport URLTab  current_package

Static Protected Member Functions

static CoreExport bool  CheckForCachedFile (MCHAR *filename)
static CoreExport bool  IsInternetCachedFile (const MCHAR *filename)
static CoreExport bool  AppendUrlFilename (const MCHAR *szUrl, MCHAR *szPathname, bool &is_URL)

Static Protected Attributes

static CoreExport Tab
< FileDropType * > 
fileDropTypes
static CoreExport MSTR  download_directory

Constructor & Destructor Documentation

FileDropType ( ) [inline]
Remarks:
Constructor.
{ FileDropType* dt = this; fileDropTypes.Append(1, &dt); }

Member Function Documentation

static CoreExport bool CheckForCachedFile ( MCHAR *  filename ) [static, protected]
static CoreExport bool IsInternetCachedFile ( const MCHAR *  filename ) [static, protected]
static CoreExport bool AppendUrlFilename ( const MCHAR *  szUrl,
MCHAR *  szPathname,
bool &  is_URL 
) [static, protected]
static void Init ( ) [inline, static]
Remarks:
This method clears the currently-parsed drop data.
Default Implementation:
{ current_package.Clear(); DropType::Init(); }

Reimplemented from DropType.

int TypeCode ( ) [inline, virtual]
Remarks:
This method returns the typecode of the DropType.
Default Implementation:
{ return FILE_DROPTYPE; }

Implements DropType.

Reimplemented in SceneFileDropType, ImageFileDropType, ImportFileDropType, ScriptFileDropType, DropScriptFileDropType, MSZipPackageFileDropType, and PathConfigDropType.

{ return FILE_DROPTYPE; }
bool IsDropType ( int  code ) [inline, virtual]
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; }

Reimplemented from DropType.

{ return code == TypeCode() || code == FILE_DROPTYPE; }
CoreExport bool Load ( bool  showProgress = true ) [virtual]
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.

Reimplemented from DropType.

Reimplemented in DropScriptFileDropType, and MSZipPackageFileDropType.

static CoreExport FileDropType* FindDropType ( MCHAR *  filename,
IDataObject *  pDataObject = NULL 
) [static]
Remarks:
This method finds and returns the FileDropType subclass corresponding to the given filename suffix. See DropTypes for more details.
Parameters:
MCHAR* filename

The filename suffix.

IDataObject* pDataObject = NULL

A pointer to the IDataObject.
Returns:
The FileDropType that corresponds to the filename suffix. This could be one of the following; sceneFileDropType, imageFileDropType, importFileDropType, dropScriptFileDropType.
virtual bool CheckDropType ( MCHAR *  filename ) [inline, virtual]
Remarks:
Subclasses should implement this method to recognize the file types associated with this drop type. This is used by FindDropType().
Parameters:
MCHAR* filename

The filename suffix.
Returns:
TRUE if the filename suffix checks out, otherwise FALSE.
Default Implementation:
{ return false; }

Reimplemented in SceneFileDropType, ImageFileDropType, ImportFileDropType, ScriptFileDropType, DropScriptFileDropType, MSZipPackageFileDropType, and PathConfigDropType.

{ return false; } 
static CoreExport bool DownloadPackage ( URLTab module,
MCHAR *  szDirectory,
HWND  hwnd = NULL,
bool  showProgress = true 
) [static]
Remarks:
This method serves as a utility function that can be used to download a module of URLs to the specified directory. If the hwnd argument is supplied, any progress or other messages are centered over that window.
Parameters:
URLTab& module

A reference to the local copies of the URL strings.

MCHAR* 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.
Returns:
TRUE if the download was successful, otherwise FALSE.
static CoreExport MCHAR* GetDownloadDirectory ( ) [static]
Remarks:
This method returns the fully-specified path to the directory in which module drops are downloaded.
static CoreExport bool DownloadUrlToDisk ( HWND  hwnd,
MCHAR *  szUrl,
MCHAR *  szPathname,
DWORD  flags = 0 
) [static]
Remarks:
This method allows you to download the file referenced by the URL to disk.
Parameters:
HWND hwnd = NULL

A handle to the window.

MCHAR* url

The URL string of the file to download.

MCHAR* 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.
Returns:
TRUE if the download was successful, otherwise FALSE.
STDMETHODIMP GetData ( FORMATETC *  pFormatetc,
STGMEDIUM *  pmedium 
) [inline]

Reimplemented from DropType.

{ return E_UNEXPECTED; }
STDMETHODIMP GetDataHere ( FORMATETC *  pFormatetc,
STGMEDIUM *  pmedium 
) [inline]

Reimplemented from DropType.

{ return E_UNEXPECTED; }
STDMETHODIMP QueryGetData ( FORMATETC *  pFormatetc ) [inline]

Reimplemented from DropType.

{ return E_UNEXPECTED; }

Member Data Documentation

CoreExport Tab<FileDropType*> fileDropTypes [static, protected]
CoreExport MSTR download_directory [static, protected]
CoreExport URLTab current_package [static]

FileDropType FileDropType FileDropType FileDropType FileDropType FileDropType FileDropType FileDropType FileDropType FileDropType
FileDropType FileDropType FileDropType FileDropType FileDropType FileDropType FileDropType FileDropType FileDropType FileDropType