home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osp1.exe / src / shpin / iodshpin.cpp < prev    next >
C/C++ Source or Header  |  1997-04-02  |  4KB  |  172 lines

  1.  
  2. /* @(#)Z 1.2 com/src/samples/shpin/iodshpin.cpp, odplugin, od96os2, odos29712d 97/03/21 17:51:30 (97/02/27 16:11:55) */
  3.  
  4. //====START_GENERATED_PROLOG======================================
  5. //
  6. //
  7. //   COMPONENT_NAME: odplugin
  8. //
  9. //   CLASSES: none
  10. //
  11. //   ORIGINS: 27
  12. //
  13. //
  14. //   (C) COPYRIGHT International Business Machines Corp. 1997
  15. //   All Rights Reserved
  16. //   Licensed Materials - Property of IBM
  17. //   US Government Users Restricted Rights - Use, duplication or
  18. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  19. //
  20. //   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  21. //   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  22. //   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  23. //   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  24. //   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  25. //   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  26. //   OR PERFORMANCE OF THIS SOFTWARE.
  27. //
  28. //====END_GENERATED_PROLOG========================================
  29.  
  30. #ifdef _PLATFORM_OS2_
  31. #include <ODos2.h>
  32. #endif
  33. #include <ODTypes.h>
  34.  
  35. #ifndef _SHPLUGIN_
  36. #include <shplugin.h>
  37. #endif
  38.  
  39. #include "ioddspm.xh"
  40. #include "ODStor.xh"
  41. #include "ODCtr.xh"
  42. #include "Document.xh"
  43. #include "Draft.xh"
  44. #include "ODSessn.xh"
  45. #include "disptch.xh"
  46. #include "dispmod.xh"
  47.  
  48. /* Define event types handled by Standard Dispatch Module */
  49. static const ODEventType StdEventTypes[] = {
  50. #ifdef _PLATFORM_OS2_
  51.     WM_BUTTON1DOWN,
  52.     WM_BUTTON2DOWN,
  53.     WM_BUTTON3DOWN,
  54.     WM_BUTTON1UP,
  55.     WM_BUTTON2UP,
  56.     WM_BUTTON3UP,
  57.     WM_MOUSEMOVE,
  58.     WM_CHORD,
  59.     WM_BUTTON1MOTIONSTART,
  60.     WM_BUTTON1MOTIONEND,
  61.     WM_BUTTON2MOTIONSTART,
  62.     WM_BUTTON2MOTIONEND,
  63.     WM_BUTTON3MOTIONSTART,
  64.     WM_BUTTON3MOTIONEND,
  65.     WM_CONTEXTHELP,
  66.     WM_BUTTON1CLICK,
  67.     WM_BUTTON2CLICK,
  68.     WM_BUTTON3CLICK,
  69.     WM_BUTTON1DBLCLK,
  70.     WM_BUTTON2DBLCLK,
  71.     WM_BUTTON3DBLCLK,
  72.     WM_BEGINDRAG,
  73.     WM_ENDDRAG,
  74.     WM_SINGLESELECT,
  75.     WM_CONTEXTMENU,
  76.     WM_BEGINSELECT,
  77.     WM_ENDSELECT,
  78.     WM_OPEN,
  79.     WM_TEXTEDIT,
  80.     WM_CHAR,
  81.     kODEvtKeyUp,
  82.     kODEvtKeyDown,
  83.     WM_PAINT,
  84.     WM_ACTIVATE,
  85.     WM_COMMAND,
  86.     WM_INITMENU,
  87.     WM_TIMER,
  88.     WM_SIZE,
  89.     WM_RENDERFMT,
  90.     DM_DRAGOVER,
  91.     DM_DRAGLEAVE,
  92.     DM_DROP,
  93.     DM_RENDER,
  94.     DM_RENDERCOMPLETE,
  95.     DM_ENDCONVERSATION,
  96.     WM_MENUSELECT,
  97.     WM_DRAWITEM,
  98.     WM_MEASUREITEM,
  99.     OD_HELP,
  100.     WM_QUERYCONVERTPOS,
  101.     WM_REALIZEPALETTE,
  102.     WM_PRESPARAMCHANGED,
  103.     WM_HSCROLL,
  104.     WM_VSCROLL,          
  105.     WM_MOVE
  106. #else
  107.         WM_RBUTTONDOWN,
  108.         WM_MBUTTONDOWN,
  109.         WM_LBUTTONDOWN,
  110.         WM_RBUTTONUP,
  111.         WM_MBUTTONUP,
  112.         WM_LBUTTONUP,
  113.         WM_RBUTTONDBLCLK,
  114.         WM_MBUTTONDBLCLK,
  115.         WM_LBUTTONDBLCLK,
  116.         WM_KEYDOWN,
  117.         WM_KEYUP,
  118.         WM_MOUSEMOVE,
  119.         WM_VSCROLL,
  120.         WM_HSCROLL,
  121.         WM_PAINT,
  122.         WM_ACTIVATE,
  123.         WM_COMMAND,
  124.         WM_ERASEBKGND,
  125.         WM_NCCREATE,
  126.         WM_SETFOCUS,
  127.         WM_SIZE,
  128.         WM_MOVE,
  129.         kODEvtMouseDownEmbedded,
  130.         kODEvtMouseDownBorder,
  131.         kODEvtMouseUpEmbedded
  132. #endif
  133. };
  134.  
  135. const ODULong NumStdEventTypes = sizeof(StdEventTypes) / sizeof(ODEventType);
  136.  
  137. extern "C" {
  138. OSErr ODShellPlugInInstall( Environment*, ODDraft*, ODShellPlugInActionCodes*);
  139. }
  140.  
  141. // Shell plug-in entry point
  142. OSErr ODShellPlugInInstall( Environment* ev1,
  143.     ODDraft* draft, ODShellPlugInActionCodes* action)
  144. {
  145.     // Somehow the environment passed in is incorrect. Need to get the correct
  146.     // environment.
  147.     Environment *ev = somGetGlobalEnvironment();
  148.  
  149.     // Get the dispatcher
  150.     ODSession* session = draft->GetDocument(ev)->GetContainer(ev)->
  151.                 GetStorageSystem(ev)->GetSession(ev);
  152.     ODDispatcher* dispatcher = session->GetDispatcher(ev);
  153.  
  154.     // Create a new dispatch module
  155.     SampleDispatchMonitor* dspmod = new SampleDispatchMonitor;
  156.  
  157.     // Initialize the dispatch module object
  158.     dspmod->InitDispatchModule(ev, session);
  159.  
  160.     // Save window state data to be used by the new dispatch module
  161.     dspmod->SetWindowState(ev, session->GetWindowState(ev));
  162.  
  163.     // Add the new dispatch module to the dispatch module dictionary
  164.     // to handler specified events
  165.     for (int i = 0; i < NumStdEventTypes; i++)
  166.     {
  167.        dispatcher->AddMonitor(ev, StdEventTypes[i], dspmod);
  168.     }
  169.     return noErr;
  170. }
  171.  
  172.