1 /******************************************************************************** 2 / 3 / File: TranslatorAddOn.h 4 / 5 / Description: This header file defines the interface that should be 6 / implemented and exported by a Tanslation Kit add-on. 7 / You will only need to include this header when building 8 / an actual add-on, not when just using the kit. 9 / 10 / Copyright 1998, Be Incorporated, All Rights Reserved. 11 / Copyright 1995-1997, Jon Watte 12 / 13 ********************************************************************************/ 14 15 #ifndef _TRANSLATOR_ADD_ON_H 16 #define _TRANSLATOR_ADD_ON_H 17 18 19 #include <TranslationDefs.h> 20 21 class BMessage; 22 class BView; 23 class BRect; 24 class BPositionIO; 25 26 27 /* This is the 4.0 and 4.5 compatible API. For later versions, use the */ 28 /* BTranslator-based API (make_nth_translator) */ 29 30 /* These variables and functions should be exported by a translator add-on */ 31 32 extern "C" { 33 34 _EXPORT extern char translatorName[]; /* required, C string, ex "Jon's Sound" */ 35 _EXPORT extern char translatorInfo[]; /* required, descriptive C string, ex "Jon's Sound Translator (shareware $5: user@mail.net) v1.00" */ 36 _EXPORT extern int32 translatorVersion; /* required, integer, ex 100 */ 37 38 _EXPORT extern translation_format inputFormats[]; /* optional (else Identify is always called) */ 39 _EXPORT extern translation_format outputFormats[]; /* optional (else Translate is called anyway) */ 40 /* Translators that don't export outputFormats */ 41 /* will not be considered by files looking for */ 42 /* specific output formats. */ 43 44 /* Return B_NO_TRANSLATOR if not handling this data. */ 45 /* Even if inputFormats exists, may be called for data without hints */ 46 /* Ff outType is not 0, must be able to export in wanted format */ 47 48 _EXPORT extern status_t Identify( /* required */ 49 BPositionIO * inSource, 50 const translation_format * inFormat, /* can beNULL */ 51 BMessage * ioExtension, /* can be NULL */ 52 translator_info * outInfo, 53 uint32 outType); 54 55 /* Return B_NO_TRANSLATOR if not handling the output format */ 56 /* If outputFormats exists, will only be called for those formats */ 57 58 _EXPORT extern status_t Translate( /* required */ 59 BPositionIO * inSource, 60 const translator_info * inInfo, 61 BMessage * ioExtension, /* can be NULL */ 62 uint32 outType, 63 BPositionIO * outDestination); 64 65 /* The view will get resized to what the parent thinks is */ 66 /* reasonable. However, it will still receive MouseDowns etc. */ 67 /* Your view should change settings in the translator immediately, */ 68 /* taking care not to change parameters for a translation that is */ 69 /* currently running. Typically, you'll have a global struct for */ 70 /* settings that is atomically copied into the translator function */ 71 /* as a local when translation starts. */ 72 /* Store your settings wherever you feel like it. */ 73 74 _EXPORT extern status_t MakeConfig( /* optional */ 75 BMessage * ioExtension, /* can be NULL */ 76 BView * * outView, 77 BRect * outExtent); 78 79 /* Copy your current settings to a BMessage that may be passed */ 80 /* to BTranslators::Translate at some later time when the user wants to */ 81 /* use whatever settings you're using right now. */ 82 83 _EXPORT extern status_t GetConfigMessage( /* optional */ 84 BMessage * ioExtension); 85 86 87 } 88 89 90 91 #endif /* _TRANSLATOR_ADD_ON_H */ 92 93 94