FileRequester
Availability: LightWave 5.5 - 6.0, Inspire 1.0
Component: Layout, Modeler
File request plug-ins prompt the user for a file selection. At a minimum, they should
provide the same functionality as the operating system's default file dialog, allowing
users to browse his file system to select or enter a file name.
See the "File Request 2" global for a
discussion of file requests from the host's point of view.
Handler Activation Function
XCALL_( int ) MyFileReq( long version, GlobalFunc *global,
LWFileReqLocal *local, void *serverData );
The local argument to a file request plug-in's activation function is an
LWFileReqLocal.
typedef struct st_LWFileReqLocal {
int reqType;
int result;
const char *title;
const char *fileType;
char *path;
char *baseName;
char *fullName;
int bufLen;
int (*pickName) (void);
} LWFileReqLocal;
- reqType
- Indicates the type of file request. Possible values are
FREQ_LOAD
FREQ_SAVE
FREQ_DIRECTORY
FREQ_MULTILOAD
- result
- The result of the request. Set this to 1 if the user selects a file, 0 if the user
cancels the request, and a negative number to indicate an error.
title
- The title string. This is generally displayed near the top of the file dialog and tells
the user what kind of file is being requested.
fileType
- A file type pattern string. This should be used to filter the names displayed in the
dialog. See the "File Type Pattern"
global for more information about the form a pattern string might take.
path
- The initial path on entry. This is where browsing of the file system should begin. The
initial path can be either absolute (fully qualified) or relative to the operating
system's current default path, also sometimes called the current working directory. If the
user completes the file request, the plug-in should write the fully qualified path of the
selected file in this field.
If the operation of the file request plug-in changes the
current working directory, this should be restored before the file request is completed.
- baseName
- The initial file name, not including the path. This may be empty, or it may contain a
default name. If the user selects a file, the initial name should be replaced with the
name (not including the path) of the selected file.
fullName
- The file request returns the selected file name, including the path, in this string. The
initial contents are ignored.
bufLen
- The size in bytes of the baseName, path and fullName strings.
When writing to these strings, the file request plug-in should not write more than bufLen
characters, including the NULL terminating byte.
pickName()
- A callback function provided by the host for MULTILOAD requests. This function
should be called for each selected file when the request type is MULTILOAD, even
if only one file is selected. For each call, the baseName, path and fullName
fields should be filled with the data for the next selected file in the list. The function
returns 0 to continue and any non-zero value to stop processing the files in a multiple
file selection.
|