home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / odtlktv4.zip / ODTLKT / TOOLKIT / SAMPLES / OPENDOC / PARTS / PUSHBTN / PUSHBTN.IDL < prev    next >
Text File  |  1995-12-15  |  7KB  |  190 lines

  1. //#**************************************************************************
  2. //#
  3. //# File Name   : PUSHBTN.IDL
  4. //#
  5. //# Description : SOM Interface Definition for the OpenDoc class PushButtonPart.
  6. //#               The purpose of this sample part handler is to show
  7. //#               embedding of PM control and scripting in a part in OpenDoc
  8. //#               document.  The DisplayMsgBox statement in HandleEvent method
  9. //#               can be replaced by any user define method.
  10. //#
  11. //# Notes       : CLASS: PushButtonPart
  12. //#
  13. //#               CLASS HIERARCHY:
  14. //#
  15. //#                 SOMObject
  16. //#                   └── ODObject
  17. //#                         └── ODRefCntObject
  18. //#                               └── ODPersistentObject
  19. //#                                     └── ODPart
  20. //#                                           └── ContainerPart
  21. //#                                                 └── PushButtonPart
  22. //#
  23. //# Entry Points: N/A
  24. //#
  25. //#      (C) COPYRIGHT International Business Machines Corp. 1995
  26. //#      All Rights Reserved
  27. //#      Licensed Materials - Property of IBM
  28. //#
  29. //#      US Government Users Restricted Rights - Use, duplication or
  30. //#      disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  31. //#
  32. //#      DISCLAIMER OF WARRANTIES.  The following [enclosed] code is
  33. //#      sample code created by IBM Corporation. This sample code is not
  34. //#      part of any standard or IBM product and is provided to you solely
  35. //#      for the purpose of assisting you in the development of your
  36. //#      applications.  The code is provided "AS IS", without
  37. //#      warranty of any kind.  IBM shall not be liable for any damages
  38. //#      arising out of your use of the sample code, even if they have been
  39. //#      advised of the possibility of such damages.
  40. //#
  41. //#*************************************************************************/
  42.  
  43. #ifndef _PUSHBTN_
  44. #define _PUSHBTN_
  45.  
  46. #ifndef _CNTNRPRT_
  47. #include "cntnrprt.idl"
  48. #endif
  49.  
  50. interface M_PushButtonPart;
  51.  
  52. // Components interface definition, parent derivation
  53. interface PushButtonPart : ContainerPart
  54. {
  55.    typedef unsigned long HMODULE;       // Define type for module handle.
  56.  
  57.    // Private methods
  58.    void CheckAndAddProperties(in ODStorageUnit storageUnit);
  59.    void ExternalizeContent(in ODStorageUnit storageUnit);
  60.    void DrawIconView(in ODFacet facet, in ODULong size);
  61.    void DrawThumbnailView(in ODFacet facet);
  62.    void CommonInitPart();
  63.    void DisplayMsgBox(in ODFacet facet);
  64.  
  65.    #ifdef __SOMIDL__
  66.  
  67.    implementation
  68.    {
  69.       //#
  70.       //#  Standard SOM identifiers
  71.       //#
  72.       functionprefix = PushButton;
  73.       metaclass      = M_PushButtonPart;
  74.       majorversion = 1;
  75.       minorversion = 1;
  76.  
  77.       //#
  78.       //# Release Order statements -- This section is used to specify the
  79.       //# order in which the SOM compiler will place the class' methods in
  80.       //# the data structures it builds to represent the class.
  81.       //#
  82.       releaseorder:
  83.  
  84.          CheckAndAddProperties,
  85.          ExternalizeContent,
  86.          DrawIconView,
  87.          DrawThumbnailView,
  88.          CommonInitPart,
  89.          DisplayMsgBox;
  90.  
  91.       //#
  92.       //# Override statments -- Identify the SOM and OpenDoc methods that
  93.       //# this class will re-implement.
  94.       //#
  95.       override:
  96.          somInit,
  97.          somUninit,
  98.          InitPart,
  99.          InitPartFromStorage,
  100.          Externalize,
  101.          CloneInto,
  102.          HandleEvent,
  103.          FacetAdded,
  104.          FacetRemoved,
  105.          GeometryChanged,
  106.          Draw,
  107.          ViewTypeChanged;
  108.  
  109.       //#
  110.       //#  The following information will be stored in the public XH file
  111.       //#  fot the class.
  112.       //#
  113.       passthru C_xh = ""
  114.          "#define VARIABLE_MACROS     // To access instance variables in"
  115.          "                            //   _variableName form instead of"
  116.          "                            //   somThis->variableName form of natation"
  117.          "#define METHOD_MACROS       // To access class methods in"
  118.          "                            //   _methodName form instead of"
  119.          "                            //   somSelf->methodName form of natation"
  120.          ""
  121.          "#define INCL_WIN            // Include all Presentation Manager info"
  122.          "#define INCL_WINERRORS"
  123.          "#define INCL_GPI            // Include all Graphics Pres. Interface info"
  124.          "#define INCL_GPIERRORS"
  125.          "#define INCL_DOSMODULEMGR   // Include Module manager"
  126.          "#define INCL_ODAPI          // Include OpenDoc for OS/2"
  127.          "#define INCL_ODCANVAS       // Include ODCanvas class definition"
  128.          "#define INCL_ODFACET        // Include ODFacet, ODFacetIterator,"
  129.          "                            //   ODFrameFacetIterator class definitions"
  130.          "#define INCL_ODFRAME        // Include ODFrame class definition"
  131.          "#define INCL_ODSESSION      // Include ODSESSION class definition"
  132.          "#define INCL_ODSHAPE        // Include ODShape class definition"
  133.          "#define INCL_ODSTORAGEUNIT  // Include ODStorageUnit, ODStorageUnitCursor,"
  134.          "                            //   ODStorageUnitRefIterator class defs"
  135.          "#define INCL_ODTRANSFORM    // Include ODTransform class definition"
  136.          "#define INCL_ODWINDOW       // Include ODWindow class definition"
  137.          ""
  138.          "#include <os2.h>"
  139.          "#include <stdio.h>"
  140.          "#include <string.h>"
  141.          "";
  142.  
  143.          //#
  144.          //# Define the instance data for this class.
  145.          //#
  146.          ODBoolean   fIsInitFromStorage;     // This flag ensures that the frame
  147.                                              // shape displayed is the one
  148.                                              // obtained from document storage.
  149.          ODBoolean   fShowDefaultFrameSize;  // Flag of showing default frame size.
  150.          ISOString   fBuffer;                // A ASCII string contains the text
  151.                                              // which display on the Push Button.
  152.          HMODULE     ModuleHandle;           // The handle to the module which
  153.                                              // contains the Push Button Part
  154.                                              // Handler's resources.
  155.          ODTypeToken FrameView;              // Token representing the frame view.
  156.          ODTypeToken LargeIconView;          // Token representing large icon view.
  157.          ODTypeToken SmallIconView;          // Token representing small icon view.
  158.          ODTypeToken ThumbnailView;          // Token representing thumbnail view.
  159.          ODSession   Session;                // The part's storage unit running
  160.                                              // session.
  161.          ULONG       hwndPushButton;         // PM Push Button window handle.
  162.          ULONG       habDeskTop;             // Anchor-block handle of Desktop.
  163.  
  164.    };
  165.    #endif  // End of __SOMIDL__
  166.  
  167. };
  168.  
  169. // Added for Part Registration
  170. interface M_PushButtonPart : M_ODPart
  171. {
  172.  
  173.    #ifdef __SOMIDL__
  174.  
  175.    implementation
  176.    {
  177.       functionprefix = M_PushButtonPart;
  178.       override:
  179.          clsGetODPartHandlerName,
  180.          clsGetODPartHandlerDisplayName,
  181.          clsGetODPartKinds,
  182.          clsGetOLE2ClassId,
  183.          clsGetWindowsIconFileName;
  184.    };
  185.    #endif
  186.  
  187. };
  188. #endif  // End of _PUSHBTN_
  189.  
  190.