home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / wpnewf.zip / wpnewf.ih < prev    next >
Text File  |  1993-10-14  |  6KB  |  224 lines

  1.  
  2. /*
  3.  * This file was generated by the SOM Compiler.
  4.  * FileName: wpnewf.ih.
  5.  * Generated using:
  6.  *     SOM Precompiler spc: 1.22
  7.  *     SOM Emitter emitih: 1.60
  8.  */
  9.  
  10. /*
  11.  * 
  12.  *      New Program object: It closes the parent folder upon launching it
  13.  *      Written by : Ghassan Salem
  14.  */
  15.  
  16.  
  17. #ifndef WPNewF_ih
  18. #define WPNewF_ih
  19.  
  20.  
  21. /*
  22.  * Passthru lines: File: "C.ih", "before"
  23.  */
  24. #define INCL_WINWINDOWMGR
  25.    #define INCL_WININPUT
  26.    #define INCL_DOSPROCESS
  27.    #define INCL_WINMESSAGEMGR
  28.    #define INCL_WINPROGRAMLIST
  29.    #include <os2.h>
  30.  /* internal definitions */
  31.    #define ID_CLOSEANDR        (WPMENUID_USER+1) /* menus added to popup menu */
  32.    #define IDM_CLOSEANDR       (WPMENUID_USER+2)
  33.  
  34.    #define MYSTR_CLASSNAME      "WPNewF"
  35.  
  36. #include "WPNewF.h"
  37.  
  38. /*
  39.  * Set the scope of methods functions
  40.  */
  41. #ifndef SOM_Scope
  42. #ifdef __cplusplus
  43. #define SOM_Scope extern "C"
  44. #else
  45. #define SOM_Scope extern
  46. #endif
  47. #endif
  48.  
  49. #ifndef SOM_CurrentClass
  50. #define SOM_CurrentClass WPNewFCClassData.parentMtab
  51. #endif
  52.  
  53. #define WPNewF_MaxNoMethods 0
  54.  
  55. /*
  56.  * Instance data
  57.  */
  58. typedef struct {
  59.     PSZ pszMyHeader;
  60. } WPNewFData;
  61.  
  62. /*
  63.  * Instance variable access macros
  64.  */
  65. #define _pszMyHeader (somThis->pszMyHeader)
  66.  
  67. /*
  68.  * Getdata macro
  69.  */
  70. #define WPNewFGetData(somSelf) \
  71.     ((WPNewFData *) \
  72.         SOM_DataResolve(somSelf, WPNewFCClassData.instanceDataToken))
  73.  
  74. /*
  75.  * Trace/Debug macro
  76.  */
  77. #ifndef WPNewFMethodDebug
  78. #define WPNewFMethodDebug(c,m) SOMMethodDebug(c,m)
  79. #endif
  80.  
  81. /*
  82.  * Begin stuff that only goes in the primary file
  83.  */
  84. #ifdef WPNewF_Class_Source
  85.  
  86. /*
  87.  * Current class macros for Instance and Meta classes.
  88.  */
  89. #undef SOMMeta
  90. #define SOMMeta M_WPNewFCClassData.parentMtab
  91. #undef SOMInstance
  92. #define SOMInstance WPNewFCClassData.parentMtab
  93.  
  94. #ifndef M_WPNewF_Class_Source
  95. #define M_WPNewF_Class_Source
  96. #endif    /* M_WPNewF_Class_Source */
  97.  
  98. /*
  99.  * Generate the Apply Stubs.
  100.  */
  101.  
  102. /*
  103.  * Overridden method: wpOpen
  104.  */
  105. #pragma linkage(WPNewFX_wpOpen, system)
  106. SOM_Scope HWND   SOMLINK WPNewFX_wpOpen(WPNewF *somSelf,
  107.         HWND hwndCnr,
  108.         ULONG ulView,
  109.         ULONG param);
  110. #ifndef parent_wpOpen
  111. static char *somMN_wpOpen = "wpOpen";
  112. static somId somId_wpOpen = &somMN_wpOpen;
  113. #define parent_wpOpen(somSelf,hwndCnr,ulView,param) \
  114.     ((SOM_ParentResolveE(WPObject, SOM_CurrentClass, wpOpen)) \
  115.      (somSelf,hwndCnr,ulView,param))
  116. #endif
  117. #define WPNewFParent_wpOpen parent_wpOpen
  118.  
  119. /*
  120.  * Temporary class data structure used only in class creation
  121.  */
  122. static somClassDataStructure WPNewFtempClassData;
  123.  
  124. /*
  125.  * Initialize the class data structure
  126.  */
  127. struct WPNewFClassDataStructure WPNewFClassData = {(SOMAny *) NULL};
  128.  
  129. /*
  130.  * Define the C class data structure
  131.  */
  132. struct WPNewFCClassDataStructure WPNewFCClassData = {(somMethodTab *) NULL};
  133.  
  134. /*
  135.  * Routines to create the class object
  136.  */
  137.  
  138. /*
  139.  * Declare the Override Methods table.
  140.  */
  141. static somOverrideMethod_t WPNewFOM[] = {
  142.     {    &somId_wpOpen,
  143.          (somMethodProc *) WPNewFX_wpOpen    },
  144. };
  145.  
  146. static void WPNewFsomInitializeClass (void)
  147. {
  148.     int i;
  149.     somOverrideMethod_t *omp;
  150.  
  151. /*
  152.  * Override methods.
  153.  */
  154.     for (omp = WPNewFOM, i = 0; i < 1; omp++, i++)
  155.         _somOverrideSMethod (WPNewFtempClassData.classObject,
  156.             *(omp->methodId), omp->method);
  157.  
  158. }
  159.  
  160. #pragma linkage(WPNewFsomCreateClass, system)
  161. static void SOMLINK WPNewFsomCreateClass(SOMClass *pClsObj,
  162.                            SOMClass *mClsObj)
  163. {
  164.     WPNewFtempClassData.classObject = _somNew (mClsObj);
  165.     _somInitClass (WPNewFtempClassData.classObject,
  166.         "WPNewF",
  167.         pClsObj,
  168.         sizeof(WPNewFData),
  169.         WPNewF_MaxNoMethods,
  170.         WPNewF_MajorVersion,
  171.         WPNewF_MinorVersion);
  172.     WPNewFCClassData.instanceDataToken = 
  173.     _somGetInstanceToken(WPNewFtempClassData.classObject);
  174.     WPNewFsomInitializeClass();
  175.     WPNewFCClassData.parentMtab =
  176.     _somGetPClsMtab(WPNewFtempClassData.classObject);
  177.     _somSetClassData(WPNewFtempClassData.classObject, (somClassDataStructure *)&WPNewFClassData);
  178.     _somClassReady(WPNewFtempClassData.classObject);
  179.     /* make newly created class object visible */
  180.     WPNewFClassData.classObject = WPNewFtempClassData.classObject;
  181. }
  182.  
  183. WPNewF * SOMLINK WPNewFNewClass (integer4 scemajorVersion,
  184.         integer4 sceminorVersion)
  185. {
  186.     SOMClass *pClsObj;
  187.     SOMClass *mClsObj;
  188.  
  189.     /* Check the version numbers */
  190.     if (((scemajorVersion != 0) && 
  191.          (scemajorVersion != WPNewF_MajorVersion)) ||
  192.         ((sceminorVersion != 0) && 
  193.          (sceminorVersion > WPNewF_MinorVersion))) {
  194.     somPrintf("WPNewFNewClass: Error, bad version numbers.\n");
  195.     SOM_Error(SOMERROR_BadVersion);
  196.     }
  197.     /* Don't do anything if class object is already created. */
  198.     if (WPNewFClassData.classObject != (SOMAny *) NULL)
  199.     return(WPNewFClassData.classObject);
  200.  
  201.     /* Make sure the environment is initialized. */
  202.     if (SOMClassMgrObject == (SOMAny *) NULL) somEnvironmentNew();
  203.     if (SOMClassMgrObject == (SOMAny *) NULL)
  204.     SOM_Error(SOMERROR_CouldNotStartup);
  205.  
  206.     /* Get the parent class object. */
  207.     WPFolderNewClass(1,1);    /* static reference */
  208.     pClsObj = _somFindClass(SOMClassMgrObject,
  209.         SOM_IdFromString("WPFolder"), 1, 1);
  210.     if (pClsObj == (SOMClass *) NULL)
  211.     SOM_Error(SOMERROR_NoParentClass);
  212.  
  213.     /* Use parent's metaclass */ 
  214.     mClsObj = SOM_GetClass(pClsObj);
  215.  
  216.     somConstructClass(WPNewFsomCreateClass, pClsObj, mClsObj,
  217.              &WPNewFtempClassData);
  218.     return (WPNewFClassData.classObject);
  219. }
  220.  
  221. #endif                   /* WPNewF_Class_Source */
  222.  
  223. #endif       /* WPNewF_ih */
  224.