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)
persistant filter support is supported by this class. The index can
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.
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();
}
#include <strclass.h>
List of all
members.
Public Member Functions
|
UtilExport |
FilterList
() |
|
Constructor.
|
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.
|
UtilExport
void |
SetFilterIndex
(int filterIndex) |
|
Sets the filter index to be used by
OPENFILENAME structure.
|
UtilExport
int |
GetNewFilterIndex
() |
|
Returns the new filter index reflecting the
users choice of filter.
|
UtilExport
void |
SetNewFilterIndex
(int filterIndex) |
|
Sets the new filter index as returned by
OPENFILENAME.
|
UtilExport const
MCHAR * |
GetFilterDescriptor
(unsigned int filterIndex) |
|
Returns the file description string
identified by an index into the filter list.
|
UtilExport const
MCHAR * |
GetFilterExtension
(unsigned int filterIndex) |
|
Returns the file extension string identified
by an index into the filter list.
|
Constructor & Destructor Documentation
Member Function Documentation
UtilExport void Append |
( |
const MCHAR * |
name |
) |
|
UtilExport operator const MCHAR * |
( |
|
) |
|
UtilExport int GetFilterIndex |
( |
|
) |
|
Returns the current filter index that will be used in
OPENFILENAME structure.
- Returns:
- The current index
UtilExport void SetFilterIndex |
( |
int |
filterIndex |
) |
|
Sets the filter index to be used by OPENFILENAME structure.
- Parameters:
-
filterIndex |
The index to use |
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.
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:
-
filterIndex |
The new index to set reflecting the users input. |
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
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.
FilterList FilterList FilterList
FilterList FilterList FilterList FilterList FilterList FilterList
FilterList
FilterList FilterList FilterList
FilterList FilterList FilterList FilterList FilterList FilterList
FilterList