home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12otk1.exe / include / scrcomp.idl < prev    next >
Text File  |  1997-04-02  |  17KB  |  414 lines

  1. //#====START_GENERATED_PROLOG======================================
  2. //#
  3. //#
  4. //#   COMPONENT_NAME: odscript
  5. //#
  6. //#   CLASSES: none
  7. //#
  8. //#   ORIGINS: 27
  9. //#
  10. //#
  11. //#   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  12. //#   All Rights Reserved
  13. //#   Licensed Materials - Property of IBM
  14. //#   US Government Users Restricted Rights - Use, duplication or
  15. //#   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16. //#       
  17. //#   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18. //#   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  19. //#   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  20. //#   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  21. //#   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  22. //#   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  23. //#   OR PERFORMANCE OF THIS SOFTWARE.
  24. //#
  25. //#====END_GENERATED_PROLOG========================================
  26. //#
  27. // @(#) 1.11 com/src/odscript/idl/scrcomp.idl, odscript, od96os2, odos29712d 10/31/96 12:44:33 [3/21/97 17:43:11]
  28. // ===========================================================================
  29. //
  30. // ScriptComponent.
  31. //
  32. // This class is the base class for all script components.  A script component
  33. // is a separately built and packaged dll (or dlls) that provides scripting
  34. // support for enabled OpenDoc classes.  See ScriptExtension for a description
  35. // of the requirements for making a Part scriptable.
  36. //
  37.  
  38. // ===========================================================================
  39. //  Change History
  40. //      Monday August 26, 1996  at  4:14:32
  41. //              Add passthru for include ODTypes.h
  42. //      Wednesday September 4, 1996  at  12:45:04
  43. //              Corrections from Review by Stew - use SOMObject and string
  44. //              instead of void * and char *
  45. //
  46. // ===========================================================================
  47. #ifndef _SCRCOMP_
  48. #define _SCRCOMP_
  49.  
  50. #include "comp.idl"
  51.  
  52. //==============================================================================
  53. // Classes defined in this interface
  54. //==============================================================================
  55.  
  56. interface   ODScriptComponent ;
  57.  
  58. //==============================================================================
  59. // Exported symbols
  60. //==============================================================================
  61. //
  62. // Define the 'type' that is used by the component manager
  63. #define kODCompTypeDirectScript  "ODDS"
  64.  
  65. // Define the 'flags' used to identify scripting features
  66. //    A component will identify what subset of these flags it supports.
  67. //    (specified as part of the data registered with the Component Manager)
  68. //
  69. //    A part must set both a 'requires' mask that is set of these bits
  70. //    that represents the support required by the part and a 'significant'
  71. //    mask that indicates which bits are to be tested. e.g. requires 0x06
  72. //    and significant  0x07 indicates that mask 0x01 must be off and mask
  73. //    0x06 must be on for a component that is to support the part.
  74. //
  75. #define kODDSSupportsRegistration       0x0001
  76. #define kODDSSupportsEventSink          0x0002
  77. #define kODDSSupportsPersistance        0x0004
  78. #define kODDSSupportsSourceEdit         0x0008
  79.  
  80.  
  81.  typedef long ODScrRegRet ;
  82.  #define ODScrRegOK     0        // no error
  83.  #define ODScrRegDup    1        // Requested name previously used
  84.  #define ODScrRegMem    2        // Memory allocation error.
  85.  #define ODScrRegNone   3        // Registration not done - no script component
  86.  #define ODScrRegOver   4        // Method not overridden (AddContainedPart)
  87.  #define ODScrRegErr    5        // Component failure - call _GetComponentInstanceError
  88.                                  // for specific error value
  89.  
  90.  
  91. //==============================================================================
  92. // Classes used by this interface
  93. //==============================================================================
  94.  
  95. interface Component ;
  96. interface ODScriptExtension ;
  97.  
  98. //==============================================================================
  99. // ODScriptingComponent
  100. //==============================================================================
  101.  
  102. interface ODScriptComponent : Component
  103. {
  104.  
  105. //  New Public Methods
  106.  
  107.  
  108. //---------------------------------------------------------------------------
  109. //
  110. // InitScriptComponent
  111. //
  112. // Input - theExt - pointer to the ODScriptExtension object that is associated
  113. //              with this script component.
  114. //       - hasInitData - boolean that indicates there is initialization data
  115. //              and this component should use ODScriptExtension::RetrieveComponentData
  116. //              to get that data to initialize its environment.
  117. //
  118. // Output - ODScrRegRet
  119. //
  120. // Function - Allows the ScriptComponent to access the
  121. //            ScriptExtension, primarily for persistent
  122. //            data but other interfaces may be used.
  123. //
  124. //---------------------------------------------------------------------------
  125.  ODScrRegRet  InitScriptComponent( in ODScriptExtension  theExt,
  126.                                    in ODBoolean hasInitData ) ;
  127.  
  128. //---------------------------------------------------------------------------
  129. //
  130. // ActivateScriptComponent
  131. //
  132. // Input - none
  133. //
  134. // Output - ODScrRegRet
  135. //
  136. // Function - Identifies to the ScriptComponent that initialization is
  137. //            complete and that scripts and scripted objects may be
  138. //            initialized. Invoked by the ScriptExtension during the
  139. //            processing of InitFromStorage after InitScriptComponent
  140. //            and any registration calls.
  141. //
  142. //---------------------------------------------------------------------------
  143.  ODScrRegRet  ActivateScriptComponent();
  144.  
  145.  
  146. //---------------------------------------------------------------------------
  147. //
  148. // ReleaseAll
  149. //
  150. // Input - none
  151. //
  152. // Output - none
  153. //
  154. // Function - Allows the ScriptComponent to release resources
  155. //            prior to closing down. It will be called by the
  156. //            ODScriptExtension just prior to that object being deleted.
  157. //
  158. //---------------------------------------------------------------------------
  159.  
  160.  void  ReleaseAll() ;           // Called just before component is released.
  161.  
  162. //---------------------------------------------------------------------------
  163. //
  164. // InitEditor
  165. //
  166. // Input - none
  167. //
  168. // Output - ODScrRegRet
  169. //
  170. // Function - Request for the Script Component to present its script
  171. //            editor interface with the classes and objects previously
  172. //            registered presented in that interface.
  173. //
  174. //---------------------------------------------------------------------------
  175.  
  176.  ODScrRegRet  InitEditor () ;          // initialize interactive edit session
  177.  
  178. //---------------------------------------------------------------------------
  179. //
  180. // CloseScripting
  181. //
  182. // Input - none
  183. //
  184. // Output - none
  185. //
  186. // Function - Request the script component to terminate scripting for the
  187. //      current scope.  All scripts, registration data and internal state
  188. //      should be released.
  189. //
  190. //---------------------------------------------------------------------------
  191.  
  192.  void  CloseScripting () ;              // Terminate scripting for this scope
  193.  
  194. //---------------------------------------------------------------------------
  195. //
  196. // AddClass
  197. //
  198. // Input - classname - string that names a class that is to be exposed to
  199. //              the script interface.
  200. //
  201. // Output - ODScrRegRet
  202. //
  203. // Function - Request to the Script Component to add the named class to
  204. //            the set of classes which are available for script access in
  205. //            this environment.
  206. //
  207. //---------------------------------------------------------------------------
  208.  
  209.  ODScrRegRet  AddClass( in string classname) ;
  210.                                 // register the class for scripting access
  211.  
  212. //---------------------------------------------------------------------------
  213. //
  214. // DropInstance
  215. //
  216. // Input - instance - pointer to an object which was previously registered
  217. //              with this Script Component and which should be removed from
  218. //              the set of objects available for scripting.
  219. //
  220. // Output - ODScrRegRet
  221. //
  222. // Function - The indicated object should be removed from the scripting
  223. //            interface. Correction of references to such an object in the
  224. //            script code is up to the Script Component.
  225. //
  226. //---------------------------------------------------------------------------
  227.  
  228.  ODScrRegRet  DropInstance(in SOMObject instance) ;
  229.                                 // remove object from scripting environment.
  230.  
  231. //---------------------------------------------------------------------------
  232. //
  233. // DropContainer
  234. //
  235. // Input - container - pointer to an object which was previously registered
  236. //              with this Script Component as a container and which should
  237. //              removed from the current scope.
  238. //
  239. // Output - ODScrRegRet
  240. //
  241. // Function - The indicated container should be removed from the scripting
  242. //            interface. Correction of references to such an object in the
  243. //            script code is up to the Script Component.
  244. //
  245. //---------------------------------------------------------------------------
  246.  
  247.  ODScrRegRet  DropContainer(in ODScriptExtension container) ;
  248.                                 // remove container from scripting environment.
  249.  
  250. //---------------------------------------------------------------------------
  251. //
  252. // AddInstance
  253. //
  254. // Input - instance - pointer to an object to be exposed for scripting.
  255. //         classname - name of the class to which that instance belongs.
  256. //         instanceName - name by which that instance should be refered to
  257. //              in the scripts.
  258. //         DefinintExt - The extension object which 'owns' this instance.
  259. //              this object can be accessed for information about containing
  260. //              scopes, etc.
  261. //
  262. // Output - ODScrRegRet
  263. //
  264. // Function - The indicated object should be added to the set of objects that
  265. //            are accessable for script access.
  266. //
  267. //---------------------------------------------------------------------------
  268.  
  269.  ODScrRegRet  AddInstance(in SOMObject instance,
  270.                         in string classname,
  271.                         in string instanceName,
  272.                         in ODScriptExtension DefiningExt ) ;
  273.                                 // register the object for scripting access
  274.  
  275. //---------------------------------------------------------------------------
  276. //
  277. // AddContainer
  278. //
  279. // Input - instance - pointer to the container object, a ODScriptExtension
  280. //         classname - the name of the class for that container.
  281. //         containerName - name by which the contaner should be refered to
  282. //              in the scripts.
  283. //         DefinintExt - The extension object which 'owns' this container
  284. //              this object can be accessed for information about containing
  285. //              scopes, etc.
  286. //
  287. // Output - ODScrRegRet
  288. //
  289. // Function - The indicated container should be added to the set of objects that
  290. //            are accessable for script access.
  291. //
  292. //---------------------------------------------------------------------------
  293.  
  294.  ODScrRegRet  AddContainer( in SOMObject instance,
  295.                           in string classname,
  296.                           in string containerName,
  297.                           in ODScriptExtension DefiningExt ) ;
  298.                                 // register the object for scripting access
  299.  
  300.  
  301. //---------------------------------------------------------------------------
  302. //
  303. // GetComponentData
  304. //
  305. // Input - pBufferSize - pointer to a long that has the size of the Buffer
  306. //         pBuffer - pointer to buffer to receive the data block
  307. //
  308. // Output - *pBufferSize updated with the actual size of the Component Data
  309. //          pBuffer - if the size that was input was sufficient the buffer
  310. //            will receive the Component Data.
  311. //
  312. // Function - This interface will be invoked by the ScriptExtension when it
  313. //            needs the component's persistent data, i.e. any data that the
  314. //            component needs to save across uses of the part.  This would
  315. //            include the actual scripts, cached descriptive information or
  316. //            other information that the component needs to have saved.
  317. //
  318. //            If the buffer size provided is not sufficient, the pBufferSize
  319. //            value should be updated with the size that is actually required.
  320. //            If the Buffer was large enough, then the component's data
  321. //            should be copied to that buffer and again the BufferSize
  322. //            should be updated to reflect the actual size of the data.
  323. //
  324. //---------------------------------------------------------------------------
  325.  
  326.  void  GetComponentData( inout long  pBufferSize,
  327.                          in void* pBuffer) ;
  328.                                 // interface to get persistent data for Component
  329.  
  330. //---------------------------------------------------------------------------
  331. //
  332. // Rename
  333. //
  334. // Input - pObject pointer to an object that was previously registered for
  335. //              script access
  336. //         pNewName - pointer to a string that is the new name to be assigned
  337. //              to that instance.
  338. //
  339. // Output - ODScrRegRet
  340. //
  341. // Function - This interface is provided to support a user's ability to specify
  342. //            a name for an object, after the object has been exposed for
  343. //            scripting.  The name for the object should be changed by the
  344. //            component.  Any fixup of references to the old object name is
  345. //            the responsibility of the component.
  346. //
  347. //---------------------------------------------------------------------------
  348.  
  349.  ODScrRegRet  Rename( in SOMObject  pObject, in char *pNewName) ;
  350.  
  351. #ifdef __SOMIDL__
  352.         implementation
  353.         {
  354.                 functionprefix = ODScrComp_ ;
  355.   passthru C_xh = \
  356. "#include <ODTypes.h>                                                       " \
  357. "                                                                           " \
  358. "//                                                                         " \
  359. "// Define the 'type' that is used by the component manager                 " \
  360. "#define kODCompTypeDirectScript  \"ODDS\"                                  " \
  361. "                                                                           " \
  362. "// Define the 'flags' used to identify scripting features                  " \
  363. "//    A component will identify what subset of these flags it supports.    " \
  364. "//    (specified as part of the data registered with the Component Manager)" \
  365. "//                                                                         " \
  366. "//    A part must set both a 'requires' mask that is set of these bits     " \
  367. "//    that represents the support required by the part and a 'significant' " \
  368. "//    mask that indicates which bits are to be tested. e.g. requires 0x06  " \
  369. "//    and significant  0x07 indicates that mask 0x01 must be off and mask  " \
  370. "//    0x06 must be on for a component that is to support the part.         " \
  371. "//                                                                         " \
  372. "#define kODDSSupportsRegistration       0x0001                             " \
  373. "#define kODDSSupportsEventSink          0x0002                             " \
  374. "#define kODDSSupportsPersistance        0x0004                             " \
  375. "#define kODDSSupportsSourceEdit         0x0008                             " \
  376. "                                                                           " \
  377. "typedef long ODScrRegRet ;                                                 " \
  378. "#define ODScrRegOK     0        // no error                                " \
  379. "#define ODScrRegDup    1        // Requested name previously used          " \
  380. "#define ODScrRegMem    2        // Memory allocation error.                " \
  381. "#define ODScrRegNone   3        // Registration not done - no script comp. " \
  382. "#define ODScrRegOver   4        // Method not overridden (AddContainedPart)" \
  383. "#define ODScrRegErr    5        // Component failure - call _GetComponentInstanceError" \
  384. "                                // for specific error value                ";
  385.  
  386.  
  387.  
  388.  
  389.  
  390.       majorversion = 1;
  391.       minorversion = 0;
  392.       dllname = "oddsscr.dll";
  393.       releaseorder:
  394.           InitScriptComponent      ,
  395.           ActivateScriptComponent  ,
  396.           ReleaseAll               ,
  397.           AddClass                 ,
  398.           AddInstance              ,
  399.           AddContainer             ,
  400.           DropInstance             ,
  401.           DropContainer            ,
  402.           InitEditor               ,
  403.           CloseScripting           ,
  404.           GetComponentData         ,
  405.           Rename                    ;
  406.  
  407.  
  408.         };
  409. #endif
  410. };
  411.  
  412.  
  413. #endif //# _SCRCOMP_
  414.