user manual

98 Chapter 5: Creating an iTool
Creating a New iTool Class iTool Developers Guide
Registering File Readers and Writers
Registering a file reader or file writer with an iTool class allows instances of the iTool
to read or write files of the type handled by the reader or writer. Any number of file
readers and writers can be registered with a given iTool.
File readers are registered by calling the IDLitTool::RegisterFileReader method:
self->RegisterFileReader,
Reader_Type
,
ReaderType_Class_Name
, $
ICON =
icon
where Reader_Type is the string you will use when referring to the file reader,
ReaderType_Class_Name is a string that specifies the name of the class file that
contains the file writers definition, and icon is a string containing the name of a
bitmap file used to represent the file reader.
Similarly, file writers are registered by calling the IDLitTool::RegisterFileWriter
method:
self->RegisterFileWriter,
Writer_Type
,
WriterType_Class_Name
, $
ICON =
icon
where Reader_Type is the string you will use when referring to the file reader,
ReaderType_Class_Name is a string that specifies the name of the class file that
contains the file writers definition, and icon is a string containing the name of a
bitmap file used to represent the file writer. See “Icon Bitmaps” on page 44 for details
on where bitmap icon files are located.
Note
The class definition files
ReaderType_Class_Name
__define.pro or
WriterType_Class_Name
__define.pro must exist somewhere in IDLs path
for the file reader or writer to be successfully registered.
For example, the following method call registers a file reader named
myReader for
which the class definition is stored in the file
myFileReader__define.pro, and
specifies the file
reader.bmp located in the home/mydir directory as the icon to
use on the toolbar.
self->RegisterFileReader, 'myReader', 'myFileReader', $
ICON = '/home/mydir/reader.bmp'
See “Registering a File Reader” on page 245 for additional details. See “Predefined
iTool File Readers on page 231 for a list of file readers included in the iTool system
as installed with IDL.
Similarly, the following method call registers a file writer named
myWriter for
which the class definition is stored in the file
myFileWriter__define.pro, and