home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osp1.exe / src / grafpart / iodgraph.cpp < prev    next >
Text File  |  1997-04-02  |  9KB  |  233 lines

  1. // @(#) 1.48 com/src/samples/grafpart/iodgraph.cpp, odgrafpart, od96os2, odos29712d 1/23/97 17:34:17 [3/21/97 17:45:35]
  2. /*====START_GENERATED_PROLOG======================================
  3. */
  4. /*
  5.  *   COMPONENT_NAME: odgrafpart
  6.  *
  7.  *   CLASSES: GrafPart
  8.  *
  9.  *   ORIGINS: 27
  10.  *
  11.  *
  12.  *   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  13.  *   All Rights Reserved
  14.  *   Licensed Materials - Property of IBM
  15.  *   US Government Users Restricted Rights - Use, duplication or
  16.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17.  *
  18.  *   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  19.  *   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  20.  *   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  21.  *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  22.  *   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  23.  *   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  24.  *   OR PERFORMANCE OF THIS SOFTWARE.
  25.  */
  26. /*====END_GENERATED_PROLOG========================================
  27.  */
  28.  
  29. // ************************************************************************
  30. //  Contains:  Class implementation for a 2D-Drawing Container Part
  31. // ************************************************************************
  32.  
  33. // this file gets its source from graph_cm.cpp which contains the implementation
  34. // for the class in a form that can either be included here to generate the
  35. // implementation for class GraphPart, or included under scrgraph to produce
  36. // implementaion for ScriptableGraphPart.
  37.  
  38. #undef _Scriptable_GP_
  39.  
  40. // note we bring in the GrafPart implementation header (xih) here rather than
  41. // in the common code file so that there is no conflict (parent methods) for
  42. // the other class including that common source
  43.  
  44. #define GrafPart_Class_Source
  45. #ifndef SOM_GrafPart_xih
  46.     #include "iodgraph.xih"
  47. #endif // SOM_GrafPart_xih
  48.  
  49.  
  50. #include <graph_cm.cpp>
  51.  
  52. #define M_GrafPart_Class_Source
  53.  
  54.  
  55. // =========================================================================
  56. //
  57. //     Metaclass overrides: GrafPart
  58. //
  59. // =========================================================================
  60.  
  61. // -------------------------------------------------------------------------
  62. // SOMInitModule
  63. //
  64. //     Used at registration time
  65. // -------------------------------------------------------------------------
  66. SOMEXTERN   void    SOMLINK SOMInitModule ( long    majorversion,
  67.                                             long    minorversion,
  68.                                             string  className )
  69. {
  70.     SQUAWK("> Invoked GrafPart::SOMInitModule()\n");
  71.  
  72.     SOM_IgnoreWarning (majorversion);
  73.     SOM_IgnoreWarning (minorversion);
  74.     SOM_IgnoreWarning (className);
  75.     GrafPartNewClass(majorversion,minorversion);
  76.  
  77.     SQUAWK("< Leaving GrafPart::SOMInitModule()\n");
  78. }   // SOMInitModule()
  79.  
  80.  
  81. // -------------------------------------------------------------------------
  82. // GrafPart --> clsGetODPartHandlerName
  83. //
  84. //     Define and report the part handler name.
  85. //
  86. //     -> public metaclass override method
  87. //     -> does not call parent
  88. // -------------------------------------------------------------------------
  89. SOM_Scope   ISOString   SOMLINK M_GrafPartclsGetODPartHandlerName(  M_GrafPart  *somSelf,
  90.                                                                     Environment *ev )
  91. {
  92.     SQUAWK("> Invoked M_GrafPart::clsGetODPartHandlerName()\n");
  93.  
  94.     /* M_GrafPartData *somThis = M_GrafPartGetData(somSelf); */
  95.     M_GrafPartMethodDebug("M_GrafPart","M_GrafPartclsGetODPartHandlerName");
  96.  
  97.     string handlerName = (string)SOMMalloc(strlen(kGrafPartHandlerName)+1);
  98.     strcpy(handlerName,kGrafPartHandlerName);
  99.  
  100.     SQUAWK("< Leaving M_GrafPart::clsGetODPartHandlerName()\n");
  101.     return (ISOString) handlerName;
  102.  
  103. }   // clsGetODPartHandlerName()
  104.  
  105.  
  106. // -------------------------------------------------------------------------
  107. // GrafPart --> clsGetODPartHandlerDisplayName
  108. //
  109. //     Define and report the part handler human-readable name.
  110. //
  111. //     -> public metaclass override method
  112. //     -> does not call parent
  113. // -------------------------------------------------------------------------
  114. SOM_Scope   string  SOMLINK M_GrafPartclsGetODPartHandlerDisplayName(   M_GrafPart  *somSelf,
  115.                                                                         Environment *ev )
  116. {
  117.     SQUAWK("> Invoked M_GrafPart::clsGetODPartHandlerDisplayName()\n");
  118.  
  119.     /* M_GrafPartData *somThis = M_GrafPartGetData(somSelf); */
  120.     M_GrafPartMethodDebug("M_GrafPart","M_GrafPartclsGetODPartHandlerDisplayName");
  121.  
  122.     string displayName = (string)SOMMalloc(strlen(kGrafPartHandlerDisplayName)+1);
  123.     strcpy(displayName,kGrafPartHandlerDisplayName);
  124.  
  125.     SQUAWK("< Leaving M_GrafPart::clsGetODPartHandlerDisplayName()\n");
  126.     return displayName;
  127.  
  128. } // clsGetODPartHandlerDisplayName()
  129.  
  130.  
  131. // -------------------------------------------------------------------------
  132. // GrafPart --> clsGetODPartKinds
  133. //
  134. //     Define and report the part kinds for this handler.
  135. //
  136. //     -> public metaclass override method
  137. //     -> does not call parent
  138. // -------------------------------------------------------------------------
  139. SOM_Scope   _IDL_SEQUENCE_PartKindInfo  SOMLINK M_GrafPartclsGetODPartKinds(M_GrafPart  *somSelf,
  140.                                                                             Environment *ev )
  141. {
  142.     SQUAWK("> Invoked M_GrafPart::clsGetODPartKinds()\n");
  143.  
  144.     /* M_GrafPartData *somThis = M_GrafPartGetData(somSelf); */
  145.     M_GrafPartMethodDebug("M_GrafPart","M_GrafPartclsGetODPartKinds");
  146.     _IDL_SEQUENCE_PartKindInfo GrafPartInfo;
  147.  
  148.     // Create structure PartKindInfo  and allocate memory for variable
  149.     PartKindInfo * info = (PartKindInfo *)SOMMalloc(sizeof(PartKindInfo));
  150.  
  151.     info->partKindName     = (ISOString)SOMMalloc(strlen(kGrafPartPartKind) + 1);
  152.     info->partKindDisplayName = (string)SOMMalloc(strlen(kGrafPartPartKindDisplayName) + 1);
  153.     info->filenameFilters     = (string)SOMMalloc(strlen(kGrafPartfilenameFilters) + 1);
  154.     info->filenameTypes       = (string)SOMMalloc(strlen(kGrafPartfilenameTypes) + 1);
  155.     info->categories          = (string)SOMMalloc(strlen(kGrafPartCategory) + 1);
  156.     info->categoryDisplayName = (string)SOMMalloc(strlen(kGrafPartCategoryDisplayName) + 1);
  157.     info->objectID            = (string)SOMMalloc(strlen(kGrafPartobjectID) + 1);
  158.  
  159.     // Copy the information into the structure
  160.     strcpy(info->partKindName,        kGrafPartPartKind);
  161.     strcpy(info->partKindDisplayName, kGrafPartPartKindDisplayName);
  162.     strcpy(info->filenameFilters,     kGrafPartfilenameFilters);
  163.     strcpy(info->filenameTypes,       kGrafPartfilenameTypes);
  164.     strcpy(info->categories,          kGrafPartCategory);
  165.     strcpy(info->categoryDisplayName, kGrafPartCategoryDisplayName);
  166.     strcpy(info->objectID,            kGrafPartobjectID);
  167.  
  168.     GrafPartInfo._maximum = 1;
  169.     GrafPartInfo._length = 1;
  170.     GrafPartInfo._buffer = info;
  171.  
  172.     SQUAWK("< Leaving M_GrafPart::clsGetODPartKinds()\n");
  173.     return GrafPartInfo;
  174.  
  175. }   // clsGetODPartKinds()
  176.  
  177.  
  178. // -------------------------------------------------------------------------
  179. // GrafPart --> clsGetOLE2ClassId
  180. //
  181. //     Define and report the OLE2 class ID for this handler.
  182. //
  183. //     -> public metaclass override method
  184. //     -> does not call parent
  185. // -------------------------------------------------------------------------
  186. SOM_Scope   string  SOMLINK M_GrafPartclsGetOLE2ClassId(M_GrafPart  *somSelf,
  187.                                                         Environment *ev )
  188. {
  189.     SQUAWK("> Invoked M_GrafPart::clsGetOLE2ClassId()\n");
  190.  
  191.     /* M_GrafPartData *somThis = M_GrafPartGetData(somSelf); */
  192.     M_GrafPartMethodDebug("M_GrafPart","M_GrafPartclsGetOLE2ClassId");
  193.  
  194.     string classID = (string)SOMMalloc(strlen(kGrafPartOLE2ClassId)+1);
  195.     strcpy(classID,kGrafPartOLE2ClassId);
  196.  
  197.     SQUAWK("< Leaving M_GrafPart::clsGetOLE2ClassId()\n");
  198.     return classID;
  199. }   // clsGetOLE2ClassId()
  200.  
  201.  
  202. // -------------------------------------------------------------------------
  203. // GrafPart --> clsGetWindowsIconFileName
  204. //
  205. //     Define and report the icon file name for this handler.
  206. //
  207. //     -> public metaclass override method
  208. //     -> does not call parent
  209. // -------------------------------------------------------------------------
  210. SOM_Scope   string  SOMLINK M_GrafPartclsGetWindowsIconFileName(M_GrafPart  *somSelf,
  211.                                                                 Environment *ev )
  212. {
  213.     SQUAWK("> Invoked M_GrafPart::clsGetWindowsIconFileName()\n");
  214.  
  215.     /* M_GrafPartData *somThis = M_GrafPartGetData(somSelf); */
  216.     M_GrafPartMethodDebug("M_GrafPart","M_GrafPartclsGetWindowsIconFileName");
  217.  
  218.     string fileName = (string)SOMMalloc(strlen(kGrafPartWindowsIconFileName)+1);
  219.     strcpy(fileName,kGrafPartWindowsIconFileName);
  220.  
  221.     SQUAWK("< Leaving M_GrafPart::clsGetWindowsIconFileName()\n");
  222.     return fileName;
  223.  
  224. }   // clsGetWindowsIconFileName()
  225.  
  226.  
  227.  
  228.  
  229.  
  230. // =========================================================================
  231. // End of file: iodgraph.cpp
  232. // =========================================================================
  233.