home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / MMDATA.HPP < prev    next >
C/C++ Source or Header  |  1996-11-25  |  13KB  |  395 lines

  1. #ifndef _MMDATA_HPP
  2. #define _MMDATA_HPP
  3.  
  4. #ifndef _WNO_PRAGMA_PUSH
  5. #pragma pack(push,4);
  6. #pragma enum int;
  7. #endif
  8.  
  9. #include "mmdef.hpp"
  10.  
  11.  
  12. struct MMSize {
  13.     int w;      // width
  14.     int h;      // height
  15. };
  16.  
  17. /************************
  18.  *** Type definitions ***
  19.  ************************/
  20.  
  21. #pragma enum int;
  22.  
  23. enum MMDataFlags {
  24.     MTF_None =                  0x00000000,
  25.  
  26.     MTF_TypeEnum =              0x00000001, // enumeration type
  27.     MTF_TypeDesignTime =        0x00000002, // type is available at DT
  28.  
  29.         // component flags
  30.     MTF_ComponentNonVisual =    0x00000002, // component is not a WWindow
  31.     MTF_ComponentNeedClass =    0x00000004, // need GetRegisteredClass call
  32.     MTF_ComponentIsComponent =  0x00000008, // is a "Component"
  33.     MTF_ComponentInvisible =    0x00000010, // not a visible class
  34.     MTF_ComponentRequireForm =  0x00000020, // don't put it on a visual class
  35.  
  36.         // parameter flags
  37.     MTF_ParmOptional =          0x00000020, // parameter not required
  38.     MTF_MethodCtor =            0x00000001, // method is constructor
  39.     MTF_MethodDtor =            0x00000002, // method is destructor
  40.  
  41.         // property flags
  42.     MTF_PropRunTimeCode =       0x00000040, // code required to set
  43.     MTF_PropRunTimeOnly =       0x00000080, // not available at design time
  44.     MTF_PropStyle =             0x00000100, // a style property
  45.     MTF_PropRedrawRequired =    0x00000200, // changing property needs redraw
  46.     MTF_PropReadOnly =          0x00000400, // property is read-only
  47.     MTF_PropWriteOnly =         0x00000800, // property is write-only
  48.     MTF_PropSaved =             0x00001000, // property is saved to file?
  49.     MTF_PropMapped =            0x00002000, // not live at design time
  50.     MTF_PropExtended =          0x00004000, // extended style
  51.     MTF_PropClone =             0x00008000, // clone on set
  52.  
  53.         // method flags
  54.     MTF_MethodDefaultRet =      0x00010000,
  55.  
  56.         // object flags
  57.     MTF_ObjectPublish =         0x00020000,
  58.  
  59.         // property control flags
  60.     MTF_PropCtrlStyle =         0x00040000, // property control for a style
  61.     MTF_PropCtrlHasPush =       0x00080000, // has associated command button
  62.  
  63.     MTF_PropCtrlCheck =         0x00100000, // checkbox
  64.     MTF_PropCtrlRadio =         0x00200000, // radio button
  65.     MTF_PropCtrlCombo =         0x00300000, // combo box
  66.     MTF_PropCtrlEdit =          0x00400000, // edit box
  67.     MTF_PropCtrlTypeMask =      0x00700000, // mask bits for type
  68.     MTF_PropCtrlFirstOption =   0x00800000, // first option button in a group
  69.     MTF_PropCtrlLastOption =    0x01000000, // last option button in a group
  70.  
  71.         // property sheet thunks
  72.     MTF_PropSheetThunkSnapped = 0x02000000, // reference resolved
  73.  
  74.     MTF_HasNoRuntime =          0x04000000, // has a runtime
  75.  
  76.         // reference item flags
  77.     MTF_RefItemComponent =      0x10000000, // MMComponent *
  78.     MTF_RefItemMethod =         0x20000000, // MMMethod *
  79.     MTF_RefItemStyle =          0x30000000, // MMStyle *
  80.     MTF_RefItemProperty =       0x40000000, // MMProperty *
  81.     MTF_RefItemTypeMask =       0x70000000,
  82.  
  83.         // MMFunction flags
  84.     MTF_FunctionSnapped =       0x10000000, // string was snapped into pointer
  85.  
  86.     MTF_EventOLE =              0x80000000, // event is an OLE event
  87.     MTF_LibraryOLE =            0x80000000, // library is an OLE library
  88. };
  89.  
  90. #pragma enum pop;
  91.  
  92. /********************
  93.  *** MMCommonData ***
  94.  ********************/
  95.  
  96. struct MMCommonData {
  97.     MMIndex                 index;      // index of this object
  98.     MMString                name;       // NULL is invalid
  99.     MMDataFlags             flags;      // bit-field of flags
  100. };
  101.  
  102.  
  103. /**********************
  104.  *** MMFunctionData ***
  105.  **********************/
  106.  
  107. typedef void (*MMFnPtr)();
  108. struct MMFunctionData {
  109.     MMFnPtr                 function;
  110.     MMString                name;       // NULL is invalid
  111.     MMDataFlags             flags;      // bit-field of flags
  112.     MMString                libraryName;// may not be valid if already snapped
  113. };
  114.  
  115. /**********************
  116.  *** MMBaseTypeData ***
  117.  **********************/
  118.  
  119. struct MMBaseTypeData : public MMCommonData {           // 12
  120. };
  121.  
  122. /************************
  123.  *** MMEnumeratorData ***
  124.  ************************/
  125.  
  126. struct MMEnumeratorData : public MMCommonData {         // 16
  127.     WDWord                  value;
  128. };
  129.  
  130. /******************
  131.  *** MMTypeData ***
  132.  ******************/
  133.  
  134. struct MMTypeData : public MMBaseTypeData {             // 28
  135.     unsigned                numValues;      // number of enumerators
  136.     MMIndex                 firstValue;     // index of the first one
  137.     MMString                browseName;     // name for browse button
  138.     MMDTTypeFnIndex         makeFn;         // function to make type
  139.     MMString                typeName;       // the friendly name of the DT-Type class
  140. };
  141.  
  142. /*******************
  143.  *** MMEventData ***
  144.  *******************/
  145.  
  146. struct MMEventData : public MMCommonData {
  147.     MMString                eventIdentifier;
  148.     MMString                eventStruct;
  149.     MMString                description;
  150.     unsigned                numParameterSets;
  151.     MMIndex                 parameterSets; // (MMParameterSetData *)
  152. };
  153.  
  154. /***********************
  155.  *** MMParameterData ***
  156.  ***********************/
  157.  
  158. struct MMParameterData : public MMCommonData {
  159.     MMIndex                 type;       // (MMTypeData *)required -- not NULL
  160.     MMString                defVal;     // default value as text
  161. };
  162.  
  163. /**************************
  164.  *** MMParameterSetData ***
  165.  **************************/
  166.  
  167. struct MMParameterSetData : public MMCommonData {
  168.     MMIndex     returnType;             // (MMTypeData *)
  169.     unsigned    numParameters;
  170.     MMIndex     parameters;             // (MMParameterData *)
  171. };
  172.  
  173. /****************
  174.  *** MMHelpID ***
  175.  ****************/
  176.  
  177. struct MMHelpID {
  178.     MMString    file;
  179.     WHelpType   command;
  180.     WDWord      data;
  181. };
  182.  
  183. /**************************
  184.  *** MMBasePropertyData ***
  185.  **************************/
  186.  
  187. struct MMBasePropertyData : public MMCommonData {
  188.     MMIndex             type;   // (MMTypeData *) pointer to type resolved later
  189.     MMSetFnIndex        setFn;  // (MMSetPropFn)
  190.     MMGetFnIndex        getFn;  // (MMGetPropFn)
  191.     MMPropDefFnIndex    defFn;  // (MMPropDefault)
  192.     WLong               defCookie;  // default cookie
  193.     WLong               priority;
  194. };
  195.  
  196. /*******************
  197.  *** MMStyleData ***
  198.  *******************/
  199.  
  200. struct MMStyleData : public MMBasePropertyData {
  201.     WStyle          style;
  202.     WStyle          mask;
  203.     MMString        resString;
  204. };
  205.  
  206.  
  207. /**********************
  208.  *** MMPropertyData ***
  209.  **********************/
  210.  
  211. struct MMPropertyData : public MMBasePropertyData {
  212.     unsigned            numParameterSets;
  213.     MMIndex             parameterSets;  //(MMParameterSetData *)
  214.     MMHelpID            helpID;
  215.     MMString            defaultMapped;  // initial value if deferred
  216.     MMPropMakeEditorFnIndex     makeEditorFn;   // (MMPropMakeEditor)
  217. };
  218.  
  219. /********************
  220.  *** MMMethodData ***
  221.  ********************/
  222.  
  223. struct MMMethodData : public MMCommonData {
  224.     unsigned        numParameterSets;
  225.     MMIndex         parameterSets; // (MMParameterSetData *)
  226.     MMHelpID        helpID;
  227. };
  228.  
  229. /*****************************
  230.  *** MMPropertyControlData ***
  231.  *****************************/
  232.  
  233. struct MMPropertyControlData : public MMCommonData {
  234.     WDWord                      resourceID;
  235.     MMIndex                     property;       // (const MMBasePropertyData *)
  236.     MMPropCtrlFnIndex           makeControl;    // (MMMakePropControl)
  237.     WLong                       priority;
  238. };
  239.  
  240. /***************************
  241.  *** MMPropertyGroupData ***
  242.  ***************************/
  243.  
  244. struct MMPropertyGroupData : public MMCommonData {
  245.     MMString                    description;
  246.     MMIndex                     firstControl;
  247.     WUInt                       numControl;
  248. };
  249.  
  250. /****************************
  251.  *** MMPropertySheetThunk ***
  252.  ****************************/
  253.  
  254. struct MMPropertySheetThunk : public MMCommonData {
  255.     MMString                component;
  256.     MMString                sheet;
  257.     MMIndex                 snapped;
  258. };
  259.  
  260. /***************************
  261.  *** MMPropertySheetData ***
  262.  ***************************/
  263.  
  264. struct MMPropertySheetData : public MMCommonData {
  265.     MMPropSheetFnIndex      makeSheet;  // (MMMakePropSheet)
  266.     MMString                desc;
  267.     WDWord                  resourceID;
  268.     WUInt                   numCtrls;
  269.     MMIndex                 ctrls;      // (const MMPropertyControlData *)
  270.     WUInt                   numGroups;
  271.     MMIndex                 firstGroup;
  272. };
  273.  
  274. /***************************
  275.  *** MMReferenceNodeData ***
  276.  ***************************/
  277.  
  278. struct MMReferenceNodeData : public MMCommonData {
  279.     MMIndex                 item;       // (const MMCommonData *)
  280.     MMIndex                 sibling;    // (const MMReferenceNodeData *)
  281.     MMIndex                 child;      // (const MMReferenceNodeData *)
  282. };
  283.  
  284.  
  285. /***********************
  286.  *** MMComponentData ***
  287.  ***********************/
  288.  
  289. enum MMComponentDataSets {
  290.     MMCDS_Events,               //(const MMEventData *)
  291.     MMCDS_HotEvents,            //(const MMEventData *)
  292.     MMCDS_Styles,               //(const MMStyleData *)
  293.     MMCDS_Properties,           //(const MMPropertyData *)
  294.     MMCDS_Methods,              //(const MMMethodData *)
  295.     MMCDS_PropertySheets,       //(const MMPropertySheetData *)
  296.     MMCDS_Includes,             // MMIndex *
  297.     MMCDS_DDXTypes,             // MMIndex *
  298.     MMCDS_Last
  299. };
  300.  
  301. struct MMComponentDataSet {
  302.     WUInt       numElements;
  303.     MMIndex     elements;
  304. };
  305.  
  306. struct MMComponentData : public MMCommonData {
  307.     MMString                    desc;
  308.     MMString                    varname;
  309.     MMString                    toolPage;
  310.     MMString                    toolPalette;
  311.     WInt                        toolPriority;
  312.     MMString                    refTag;
  313.     MMString                    baseObject;
  314.     WDWord                      toolBitmaps[ 3 ];
  315.  
  316.     MMComponentDataSet          dataSets[ MMCDS_Last ];
  317.  
  318.     MMIndex                     ddxProperty;//(const MMPropertyData *)
  319.     MMIndex                     refNodes;   // full hierarchy
  320.  
  321.     MMHelpID                    helpID;
  322.     WDWord                      nonVisualResID;
  323.  
  324.     MMSize                      defSize;    // default component size
  325.     MMDTInstFnIndex             makeDT;     // function index to make DTObj
  326.  
  327.     MMString                    reserved;
  328. };
  329.  
  330. /*********************
  331.  *** MMLibraryData ***
  332.  *********************/
  333.  
  334. enum MMLibraryDataSets {
  335.     MMDS_Enumerators,
  336.     MMDS_Types,
  337.     MMDS_Events,
  338.     MMDS_Styles,
  339.     MMDS_Properties,
  340.     MMDS_Methods,
  341.     MMDS_Parameters,
  342.     MMDS_ParameterSets,
  343.     MMDS_PropertyControls,
  344.     MMDS_PropertyGroups,
  345.     MMDS_PropertySheetThunks,
  346.     MMDS_PropertySheets,
  347.     MMDS_Components,
  348.     MMDS_ReferenceNodes,
  349.     MMDS_StringTables,
  350.     MMDS_Indices,
  351.     MMDS_Library,
  352.     MMDS_Last,
  353. };
  354.  
  355. struct MMLibraryDataSet {
  356.     WUInt       numElements;
  357.     MMOffset    elements;
  358. };
  359.  
  360. struct MMLibraryData : public MMCommonData {
  361.     MMLibraryDataSet            dataSets[ MMDS_Last ];
  362.  
  363. //
  364.     WUInt                       numGblMethods;
  365.     MMIndex                     gblMethods;
  366.  
  367.     MMIndex                     refRoot;        // root of hierarchy
  368.     MMString                    refTag;
  369.     MMString                    description;    // describe the library
  370.  
  371.     WUInt                       numIncludes;
  372.     MMIndex                     includes;       // (MMString *)
  373.  
  374.     MMLanguage                  language;       // Cpp or Java or ...
  375. };
  376.  
  377.  
  378. /***************************
  379.  *** Function Prototypes ***
  380.  ***************************/
  381.  
  382. extern DTType *  METAEXPORTDEF MMStyleGet( const DTObject *, const MMBaseProperty * );
  383. extern WBool     METAEXPORTDEF MMStyleSet( DTObject *, const DTType *,
  384.                                    const MMBaseProperty * );
  385. extern MTPropertySheetBase * METAEXPORTDEF MakePropertySheet( const MMPropertySheet * );
  386. extern MTPropertyControl *   METAEXPORTDEF MakePropertyControl( const MMPropertyControl * );
  387.  
  388. #ifndef _WNO_PRAGMA_PUSH
  389. #pragma enum pop;
  390. #pragma pack(pop);
  391. #endif
  392.  
  393.  
  394. #endif // _MMDATA_HPP
  395.