Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 7 - Translation Manager / Translation Extension Reference
Translation Extension-Defined Routines / File Translation Extension Routines


A file translation extension must respond to the kTranslateGetFileTranslationList request code. Whenever it first notices the extension, Macintosh Easy Open calls your extension with this request code to obtain a list of the file types that the extension can translate. You can handle this request by calling the CallComponentFunctionWithStorage function and passing it a pointer to a function with the syntax defined by the DoGetFileTranslationList function.

FUNCTION DoGetFileTranslationList 
                  (self: ComponentInstance; 
                   translationList: FileTranslationListHandle) 
                   : ComponentResult;
A component instance that identifies the component containing the translation extension.
A handle to a file translation list.
Your DoGetFileTranslationList function should return, through the translationList parameter, a handle to a list of the file types from and into which your translation extension can translate. On entry to DoGetFileTranslationList, the translationList parameter contains a handle to a structure of type FileTranslationList. If your translation extension can translate any files at all, your DoGetFileTranslationList function should resize that handle and fill the block with a list of the file types it can translate. If the translation list whose handle you return in translationList has the groupCount field set to 0, Macintosh Easy Open assumes that your extension cannot translate any file types.

Macintosh Easy Open calls your translation extension's DoGetFileTranslationList function when it first becomes aware of your extension. For improved performance, Macintosh Easy Open remembers each translation extension's most recently returned file translation list and passes that list to DoGetFileTranslationList in the translationList parameter. If you determine that the list hasn't changed, you should simply return the same handle to Macintosh Easy Open.

The DoGetFileTranslationList function should return noErr if successful, or an appropriate result code otherwise.

See "File Translation Lists" on page 7-48 for a description of the FileTranslationList data structure. See "Writing a Translation Extension" beginning on page 7-18 for more information about implementing a translation extension. See Listing 7-6 on page 7-30 for a routine that constructs a sample file translation list.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996