home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / SOMINF.ZIP / INTEGRAT.INF (.txt) < prev    next >
OS/2 Help File  |  1992-07-15  |  11KB  |  333 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. Levels of Integration ΓòÉΓòÉΓòÉ
  3.  
  4. This is a review of the levels of integration. 
  5.  
  6.  
  7. ΓòÉΓòÉΓòÉ 1.1. Level 1 ΓòÉΓòÉΓòÉ
  8.  
  9. o Provide OO File capabilities 
  10.  
  11. o Drag/Drop to open applications 
  12.  
  13. o Exploit Drag/Drop rendering 
  14.  
  15. o CUA 91 controls (notebooks, containers) 
  16.  
  17. o Shutdown notification 
  18.  
  19. o Online Documentation 
  20.  
  21. o OO Install 
  22.  
  23. Code Necessary:  Presentation Manager additions to existing code. 
  24.  
  25.  
  26. ΓòÉΓòÉΓòÉ 1.2. Level 2 ΓòÉΓòÉΓòÉ
  27.  
  28. o Intelligent Printing (drag and drop data files) 
  29.  
  30. o Special Folder Behavior 
  31.  
  32. o Multiple Views 
  33.  
  34. Code Necessary:  Presentation Manager additions to existing code, subclass 
  35.                  WPDataFile to add WPS functions without redesigning existing 
  36.                  code. 
  37.  
  38.  
  39. ΓòÉΓòÉΓòÉ 1.3. Level 3 ΓòÉΓòÉΓòÉ
  40.  
  41. o Object View replaces Application View 
  42.  
  43. o Application consists of objects on the desktop 
  44.  
  45. Code Necessary:  Presentation Manager additions to existing code, subclass 
  46.                  WPDataFile to add WPS functions, restructure application as 
  47.                  objects. 
  48.  
  49.  
  50. ΓòÉΓòÉΓòÉ 2. Methodologies ΓòÉΓòÉΓòÉ
  51.  
  52. These are the different methods of integration with the Workplace Shell. 
  53.  
  54.  
  55. ΓòÉΓòÉΓòÉ 2.1. Ignore It ΓòÉΓòÉΓòÉ
  56.  
  57. Level 0. This is not recommended! 
  58.  
  59. If you do nothing else, make sure your program will accept a filename as a 
  60. parameter from the command line. Since the default drag and drop behavior is to 
  61. invoke the program named and pass the physical name of the file being dropped, 
  62. then if your customer creates a program object that points at your executable, 
  63. the drag and drop will work. 
  64.  
  65. You can save your customer some time by installing the executable as a program 
  66. object to allow drag and drop initiation, and to register any supported file 
  67. types. This simple install procedure will save the customer having to create 
  68. the object from a program template. 
  69.  
  70.  
  71. ΓòÉΓòÉΓòÉ 2.2. Emulate It ΓòÉΓòÉΓòÉ
  72.  
  73. Level 1. 
  74.  
  75. You can obtain many benefits of the Workplace Shell interface by using 
  76. Presentation Manager APIs, for example, Drag and Drop support. 
  77.  
  78. This method requires adding more PM code to your existing application, but 
  79. could avoid any SOM or Workplace programming. 
  80.  
  81. Level 2. 
  82.  
  83. To take advantage of even more of the Workplace functionality, while still 
  84. avoiding writing a complete Workplace Shell application, implement an object 
  85. descended from WPDataFile which has the following methods overridden. 
  86.  
  87. o Instance Methods 
  88.  
  89. o Class Methods 
  90.  
  91. o Other Updates 
  92.  
  93.  
  94. ΓòÉΓòÉΓòÉ 2.3. Use It ΓòÉΓòÉΓòÉ
  95.  
  96. Level 3. This is not recommended! 
  97.  
  98. Create a Workplace object, and add any additional processing the application 
  99. needs. 
  100.  
  101. This application will run in the Workplace Shell process, and can be 
  102. interrupted if any other WPS application fails. 
  103.  
  104.  
  105. ΓòÉΓòÉΓòÉ 2.4. Integrate With It ΓòÉΓòÉΓòÉ
  106.  
  107. Level 3. 
  108.  
  109. A Workplace object can be created which allows full use of the OO User 
  110. Interface, but which also protects application-specific processing from the 
  111. concerns with running in the Shell process. 
  112.  
  113. Create a Workplace object which provides the user interface, and have it spawn 
  114. background processes which do the real work of the application. 
  115.  
  116. Note:  Whenever possible, work should be accomplished in its own process, to 
  117. minimize the amount of processing in the shell itself. 
  118.  
  119. Some Critical Workplace Methods: 
  120.  
  121. Method    Notes 
  122. wpOpen    Make sure you process any different views (i.e. Settings) 
  123. wpPrint   Override the Print methods which your object supports 
  124. wpDrop    Override the other drag and drop methods as well 
  125.  
  126. For example, this is a demo which reports what object is dropped on it. 
  127.  
  128.  
  129. ΓòÉΓòÉΓòÉ 3. The Ten Steps ΓòÉΓòÉΓòÉ
  130.  
  131.  1. Design Your Object 
  132.  
  133.  2. Design Its Views 
  134.  
  135.  3. Choose a Parent Class for subclassing 
  136.  
  137.  4. Create the Class Definition for Your Object 
  138.  
  139.  5. Compile the Class Definition 
  140.  
  141.  6. Add Your Object-specific code 
  142.  
  143.  7. Compile & Link Your Object 
  144.  
  145.  8. Register Your Object with the WPS 
  146.  
  147.  9. Instantiate Your Object 
  148.  
  149. 10. Test and Iterate 
  150.  
  151.  
  152. ΓòÉΓòÉΓòÉ <hidden> Installing a Program into the Shell ΓòÉΓòÉΓòÉ
  153.  
  154. #define INCL_WINWORKPLACE
  155. #include <os2.h>
  156. #include <stdio.h>
  157. #include <string.h>
  158.  
  159. int main(int argc, char **argv)
  160. {
  161.  CHAR  szTitle[80];
  162.  CHAR  szSetup[120];
  163.  
  164.  strcpy(szTitle, argv[1]);
  165.  strcpy(szSetup, "EXENAME=");
  166.  strcat(szSetup, argv[1]);
  167.  
  168.  printf("[%ld]", WinCreateObject("WPProgram",
  169.                                  szTitle,
  170.                                  szSetup,
  171.                                  "<WP_DESKTOP>",
  172.                                  CO_FAILIFEXISTS));
  173. }
  174.  
  175.  
  176. ΓòÉΓòÉΓòÉ <hidden> Who Am I? - An Example Application ΓòÉΓòÉΓòÉ
  177.  
  178. This is the Whoami application. It reports the actual name of an object 
  179. whenever an object is dropped on it. It also explains its usage when opened. 
  180.  
  181. o CSC file 
  182.  
  183. o C source 
  184.  
  185.  
  186. ΓòÉΓòÉΓòÉ <hidden> CSC (SOM Source) ΓòÉΓòÉΓòÉ
  187.  
  188. #include <wpabs.sc>
  189.  
  190. class: Whoami,
  191.        external stem   = WAI,
  192.        local,
  193.        major version = 1,
  194.        minor version = 1;
  195.  
  196. parent: WPAbstract;
  197.  
  198. passthru: C.ih;
  199. #define INCL_WINWORKPLACE
  200. #include <os2.h>
  201. endpassthru;
  202.  
  203. methods:
  204.   override wpOpen;
  205.   override wpDrop;
  206.  
  207.  
  208. ΓòÉΓòÉΓòÉ <hidden> C (User-Modified) Source ΓòÉΓòÉΓòÉ
  209.  
  210.  
  211. /*
  212.  * This file was generated by the SOM Compiler.
  213.  * FileName: whoami.c.
  214.  * Generated using:
  215.  *     SOM Precompiler spc: 1.22
  216.  *     SOM Emitter emitc: 1.24
  217.  */
  218.  
  219. #define Whoami_Class_Source
  220. #include "whoami.ih"
  221.  
  222. SOM_Scope MRESULT   SOMLINK wpDrop(Whoami *somSelf,
  223.                 HWND hwndCnr,
  224.                 PDRAGINFO pdrgInfo,
  225.                 PDRAGITEM pdrgItem)
  226. {
  227.     char szDataType[80];
  228.  
  229.     /* WhoamiData *somThis = WhoamiGetData(somSelf); */
  230.     WhoamiMethodDebug("Whoami","wpDrop");
  231.  
  232.     DrgQueryStrName(pdrgItem->hstrSourceName, 80, szDataType);
  233.     WinMessageBox(HWND_DESKTOP,
  234.                   HWND_DESKTOP,
  235.                   szDataType,
  236.                   "Who Am I?",
  237.                   0,
  238.                   MB_NOICON | MB_OK | MB_MOVEABLE);
  239.     return 0;
  240. }
  241.  
  242. SOM_Scope HWND   SOMLINK wpOpen(Whoami *somSelf,
  243.                 HWND hwndCnr,
  244.                 ULONG ulView,
  245.                 ULONG param)
  246. {
  247.     /* WhoamiData *somThis = WhoamiGetData(somSelf); */
  248.     WhoamiMethodDebug("Whoami","wpOpen");
  249.     if (ulView != OPEN_SETTINGS)
  250.       WinMessageBox(HWND_DESKTOP,
  251.                     HWND_DESKTOP,
  252.                     "This program identifies objects dropped on it.",
  253.                     "Who Am I?",
  254.                     0,
  255.                     MB_MOVEABLE | MB_OK);
  256.     else
  257.       return (parent_wpOpen(somSelf,hwndCnr,ulView,param));
  258. }
  259.  
  260.  
  261. ΓòÉΓòÉΓòÉ <hidden> Instance Methods ΓòÉΓòÉΓòÉ
  262.  
  263. Method                        Processing 
  264.  
  265. wpSetup                       Start an instance of the application to process 
  266.                               the file. 
  267.  
  268.    o Call parent_wpSetup() 
  269.    o Query the realname of the data file (wpQueryFileName) 
  270.    o DosOpen() the file 
  271.    o Write intial valid data so that your application understands the file as 
  272.      empty. 
  273.    o DosClose() the file 
  274.    o Query the class type list (wpclsQueryInstanceType) 
  275.    o If a type list is returned set the type on the file (wpSetType) 
  276.  
  277. wpPrintObject                 Start an instance of the application and tell 
  278.                               that instance to print the file 
  279.                               (wpQueryFilename). 
  280.  
  281. wpQueryAssociationFilter      Return the file extension for this class.  Only 
  282.                               return one. 
  283.  
  284.                               Example:  return "*.XYZ" 
  285.  
  286. wpQueryAssociationType        Return the file type for this class.  Only return 
  287.                               one. 
  288.  
  289.                               Example:  return "XYZ Type" 
  290.  
  291.  
  292. ΓòÉΓòÉΓòÉ <hidden> Class Methods ΓòÉΓòÉΓòÉ
  293.  
  294. Method                        Processing 
  295.  
  296. wpclsQueryDefaultHelp 
  297.  
  298.    o Set the value of *pHelpPanelId to the help panel id to be displayed 
  299.    o strcpy the name of your help panel library (XYZ.HLP) into HelpLibrary 
  300.    o return TRUE. 
  301.  
  302.                               Note:  This is the help displayed when the user 
  303.                               presses F1 over this object. 
  304.  
  305. wpclsQueryIconData            Return the default icon data for this class of 
  306.                               object. 
  307.  
  308.  
  309. ΓòÉΓòÉΓòÉ <hidden> Other Updates ΓòÉΓòÉΓòÉ
  310.  
  311. The application should have an ASSOCTABLE entry in its executable which matches 
  312. the values for the extension and type returned above. 
  313.  
  314. ASSOCTABLE ID_TABLE
  315. BEGIN
  316.    "XYZ Type", "*.XYZ", EAF_DEFAULTOWNER, xyz.ico
  317. END
  318.  
  319. Note that xyz.ico must exist at the time you do your resource compile since it 
  320. is added to the .ASSOCTABLE extended attributes of the program. 
  321.  
  322. Reminder:  When you deliver the application, you must use a vehicle that 
  323. preserves these extended attributes. 
  324.  
  325. If the application handles multiple types with a unique extension for each type 
  326. then do the following: 
  327.  
  328. o Subclass WPDataFile and handle all of the methods except 
  329.   wpclsQueryInstanceType and wpclsQueryInstanceFilter. 
  330. o Introduce a subclass for each type that returns a corresponding Type and 
  331.   Filter and insure that there is a corresponding entry for it in the 
  332.   ASSOCTABLE in the .RC file. 
  333.