3ds Max C++ API Reference
FilterList Class Reference

class FilterList More...

#include <strclass.h>

+ Inheritance diagram for FilterList:

Public Member Functions

UtilExport FilterList ()
 Constructor. More...
 
UtilExport void Append (const MCHAR *name)
 
UtilExport void Append (FilterList &filters)
 
UtilExport operator const MCHAR * ()
 
UtilExport int GetFilterIndex ()
 Returns the current filter index that will be used in OPENFILENAME structure. More...
 
UtilExport void SetFilterIndex (int filterIndex)
 Sets the filter index to be used by OPENFILENAME structure. More...
 
UtilExport int GetNewFilterIndex ()
 Returns the new filter index reflecting the users choice of filter. More...
 
UtilExport void SetNewFilterIndex (int filterIndex)
 Sets the new filter index as returned by OPENFILENAME. More...
 
UtilExport const MCHARGetFilterDescriptor (unsigned int filterIndex)
 Returns the file description string identified by an index into the filter list. More...
 
UtilExport const MCHARGetFilterExtension (unsigned int filterIndex)
 Returns the file extension string identified by an index into the filter list. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

class FilterList

Description:
A class whose sole purpose is for building up a filter list to pass to the Windows API functions GetSaveFileName() and GetOpenFileName(). It automatically puts in the embedded nulls and two terminating nulls. All methods are implemented by the system.

Example usage:

FilterList filterList;

filterList.Append(_M("MAX files(*.max)"));

filterList.Append(_M("*.max"));

ofn.lpstrFilter = filterList;

GetSaveFileName(&ofn)

persistent filter support is supported by this class. The index can be used by OPENFILENAME structure.
The default value is 1 and both DoMaxSaveAsDialog and DoMaxOpenDialog have been updated to honour these settings. The developer has to simply store the new index and set it as the actual index the next time these functions are used.
CAUTION: The resulting filter list string is used as-is in the Windows file selector, and expects pairs of entries (a description entry and a wildcard entry, as shown in the example usage above). Providing an odd number of Appended strings can result in a crash.
An example is shown below, and assumes filterIndex is a global variable.
FilterList filterList;
filterList.Append(_M("MAX files(*.max)"));
filterList.Append(_M("*.max"));
filters.SetFilterIndex(filterIndex);
if (GetCOREInterface8()->DoMaxOpenDialog(hWnd, title, filename, initDir, filterList))
{
filterIndex = filters.GetNewFilterIndex();
}
class FilterList
Definition: strclass.h:1113
UtilExport void Append(const MCHAR *name)
CoreExport Interface8 * GetCOREInterface8()
#define _M(x)
Used to wrap string literals.
Definition: strbasic.h:67

Constructor & Destructor Documentation

◆ FilterList()

Constructor.

Member Function Documentation

◆ Append() [1/2]

UtilExport void Append ( const MCHAR name)
Remarks
Appends the string passed to buf.

◆ Append() [2/2]

UtilExport void Append ( FilterList filters)

◆ operator const MCHAR *()

UtilExport operator const MCHAR * ( )
Remarks
Returns the address of buf.

◆ GetFilterIndex()

UtilExport int GetFilterIndex ( )

Returns the current filter index that will be used in OPENFILENAME structure.

Returns
The current index

◆ SetFilterIndex()

UtilExport void SetFilterIndex ( int  filterIndex)

Sets the filter index to be used by OPENFILENAME structure.

Parameters
filterIndexThe index to use

◆ GetNewFilterIndex()

UtilExport int GetNewFilterIndex ( )

Returns the new filter index reflecting the users choice of filter.

Currently DoMaxSaveAsDialog and DoMaxOpenDialog store this value when they successfully run.
It allows a developer to set the new index correctly using SetFilterIndex()

Returns
The new index as chosen by the user.

◆ SetNewFilterIndex()

UtilExport void SetNewFilterIndex ( int  filterIndex)

Sets the new filter index as returned by OPENFILENAME.

DoMaxSaveAsDialog and DoMaxOpenDialog store this value for the developer automatically

Parameters
filterIndexThe new index to set reflecting the users input.

◆ GetFilterDescriptor()

UtilExport const MCHAR* GetFilterDescriptor ( unsigned int  filterIndex)

Returns the file description string identified by an index into the filter list.

Parameters
filterIndex- 1 based index into the filter list
Returns
Pointer to the string representing the file filter description

◆ GetFilterExtension()

UtilExport const MCHAR* GetFilterExtension ( unsigned int  filterIndex)

Returns the file extension string identified by an index into the filter list.

Parameters
filterIndex- 1 based index into the filter list
Returns
Pointer to the string representing the file filter extension. The returned extension is exactly in the form in which it's been recorded in the FilterList instance.