home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / wksinst / rwbcinc.pak / CUSTCNTL.H < prev   
C/C++ Source or Header  |  1991-09-09  |  8KB  |  264 lines

  1. #if !defined( __CUSTCNTL_H )
  2. #define __CUSTCNTL_H
  3.  
  4. /*
  5.  * CUSTOM CONTROL LIBRARY - HEADER FILE
  6.  *
  7.  */
  8.  
  9. #ifndef RC_INVOKED
  10. #pragma option -a-
  11. #endif
  12.  
  13. /* general size definitions */
  14. #define     CTLTYPES        12                /* number of control types */
  15. #define     CTLDESCR        22                /* size of control menu name */
  16. #define        CTLCLASS          20                  /* max size of class name */
  17. #define        CTLTITLE          94                  /* max size of control text */
  18.  
  19. /* */
  20.  
  21. /*
  22.  * CONTROL STYLE DATA STRUCTURE
  23.  *
  24.  * This data structure is used by the class style dialog function
  25.  * to set and/or reset various control attributes.
  26.  *
  27.  */
  28.  
  29. typedef struct {
  30.     WORD            wX;                             /* x origin of control */
  31.     WORD            wY;                             /* y origin of control */
  32.     WORD            wCx;                            /* width of control */
  33.     WORD            wCy;                            /* height of control */
  34.     WORD            wId;                            /* control child id */
  35.     DWORD            dwStyle;                        /* control style */
  36.     char            szClass[CTLCLASS];          /* name of control class */
  37.     char            szTitle[CTLTITLE];          /* control text */
  38. } CTLSTYLE;
  39.  
  40. typedef CTLSTYLE *        PCTLSTYLE;
  41. typedef CTLSTYLE FAR *        LPCTLSTYLE;
  42.  
  43. /* */
  44.  
  45. /*
  46.  * CONTROL DATA STRUCTURE
  47.  *
  48.  * This data structure is returned by the control options function
  49.  * when enquiring about the capabilities of a particular control.
  50.  * Each control may contain various types (with predefined style
  51.  * bits) under one general class.
  52.  *
  53.  * The width and height fields are used to provide the host
  54.  * application with a suggested size.  The values in these fields
  55.  * could be either in pixels or in rc coordinates.  If it is in pixel,
  56.  * the most sigificant bit(MSB) is on.  If the MSB is off, it is in rc
  57.  * coordinates.
  58.  *
  59.  * The cursor and bitmap handles reference objects which can be
  60.  * used by the dialog editor in the placement and definition of
  61.  * new, user-defined control classes.  However, dialog editor in win30
  62.  * does not use these fields.
  63.  *
  64.  */
  65.  
  66. typedef struct {
  67.     WORD            wType;                        /* type style */
  68.     WORD            wWidth;                        /* suggested width */
  69.     WORD            wHeight;                        /* suggested height */
  70.     DWORD            dwStyle;                        /* default style */
  71.     char            szDescr[CTLDESCR];          /* menu name */
  72. } CTLTYPE;
  73.  
  74. typedef struct {
  75.     WORD            wVersion;                    /* control version */
  76.     WORD            wCtlTypes;                    /* control types */
  77.     char            szClass[CTLCLASS];          /* control class name */
  78.     char            szTitle[CTLTITLE];          /* control title */
  79.     char            szReserved[10];            /* reserved for future use */
  80.     CTLTYPE         Type[CTLTYPES];         /* control type list */
  81. } CTLINFO;
  82.  
  83. typedef CTLINFO *        PCTLINFO;
  84. typedef CTLINFO FAR *        LPCTLINFO;
  85.  
  86. /* These two function prototypes are used by dialog editor */
  87. typedef DWORD            (FAR PASCAL *LPFNSTRTOID)( LPSTR );
  88. typedef WORD            (FAR PASCAL *LPFNIDTOSTR)( WORD, LPSTR, WORD );
  89.  
  90.  
  91. // Resource Workshop extensions follow here
  92.  
  93.  
  94. // function  prototypes left out of the original custcntl.h
  95.  
  96.  
  97. typedef HANDLE        (FAR PASCAL *LPFNINFO)( void );
  98. typedef BOOL        (FAR PASCAL *LPFNSTYLE)
  99. (
  100.   HWND hWnd,
  101.   HANDLE hCntlStyle,
  102.   LPFNSTRTOID lpfnSID,
  103.   LPFNIDTOSTR lpfnIDS
  104. );
  105.  
  106. typedef WORD   (FAR PASCAL *LPFNFLAGS)
  107. (
  108.   DWORD   dwStyle,
  109.   LPSTR   lpBuff,
  110.   WORD    wBuffLength
  111. );
  112.  
  113. /*****************************************************************************
  114.  
  115.   Resource Workshop has extended the MS Dialog editor's custom control
  116.   API in three main areas:
  117.  
  118.   1) More than 1 custom control can be placed in a single DLL
  119.  
  120.   2) The "Info" data structure has been extended to allow custom controls
  121.      to be added to the RW toolbox
  122.  
  123.   3) The style data structure has been extended to allo custom controls
  124.      access to the CTLDATA field. This field contains up to 255 bytes
  125.      of binary data. A pointer to this data is passed to the control
  126.      in the WM_CREATE message at runtime.
  127.  
  128.  
  129. *****************************************************************************/
  130.  
  131. /*****************************************************************************
  132.  
  133.   Two new fields have been added to the CTLTYPE data structure to
  134.   make the RWCTLTYPE structure:
  135.  
  136.   hToolBit is a handle to a 24X24 bitmap which is added to the
  137.   RW toolbox. If this field is 0, no button will be added for this style,
  138.   and it will only be selectable via the Custom control dialog. This bitmap
  139.   is "owned" by RW, and will be freed by RW when the dialog editor is
  140.   unloaded.
  141.  
  142.   hDropCurs is a handle to a cursor which is used by RW when a user
  143.   selects the control from the toolbox. If 0, a cross cursor will be used
  144.  
  145.  
  146. *****************************************************************************/
  147.  
  148. #define TOOLBIT_SIZE  24
  149.  
  150. typedef struct
  151. {
  152.    WORD          wType;              /* type style */
  153.    WORD          wWidth;              /* suggested width */
  154.    WORD          wHeight;              /* suggested height */
  155.    DWORD      dwStyle;              /* default style */
  156.    char          szDescr[CTLDESCR];      /* dialog name */
  157.    HBITMAP    hToolBit;               // Toolbox bitmap
  158.    HCURSOR    hDropCurs;              // Drag and drop cursor
  159.  
  160. } RWCTLTYPE, FAR * LPRWCTLTYPE;
  161.  
  162. /*****************************************************************************
  163.  
  164.   This structure refelcts the RWCTLTYPE data structure
  165.  
  166. *****************************************************************************/
  167.  
  168.  
  169. typedef struct
  170. {
  171.    WORD          wVersion;             /* control version */
  172.    WORD          wCtlTypes;         /* control types */
  173.    char          szClass[CTLCLASS];     /* control class name */
  174.    char          szTitle[CTLTITLE];     /* control title */
  175.    char          szReserved[10];         /* reserved for future use */
  176.    RWCTLTYPE  Type[CTLTYPES];          /* Resource Workshop control type list */
  177.  
  178. } RWCTLINFO;
  179.  
  180. typedef RWCTLINFO *        PRWCTLINFO;
  181. typedef RWCTLINFO FAR *        LPRWCTLINFO;
  182.  
  183. /*****************************************************************************
  184.  
  185.   Two new field has been added to the CTLSTYLE data structure to make
  186.   the RWCTLSTYLE data structure:
  187.  
  188.   CtlDataSize is the size of
  189.   CtlData, which is an array bytes passed to the control in the
  190.   WM_CREATE message.
  191.  
  192.  
  193. *****************************************************************************/
  194.  
  195. #define CTLDATALENGTH 255            // 255 bytes + Length Byte
  196.  
  197. typedef struct {
  198.   WORD        wX;                 /* x origin of control */
  199.   WORD        wY;                 /* y origin of control */
  200.   WORD        wCx;             /* width of control */
  201.   WORD        wCy;             /* height of control */
  202.   WORD        wId;             /* control child id */
  203.   DWORD        dwStyle;             /* control style */
  204.   char        szClass[CTLCLASS];       /* name of control class */
  205.   char        szTitle[CTLTITLE];       /* control text */
  206.   BYTE      CtlDataSize;             // Control data Size
  207.   BYTE      CtlData[ CTLDATALENGTH]; // Control data
  208.  
  209. } RWCTLSTYLE;
  210.  
  211. typedef RWCTLSTYLE *          PRWCTLSTYLE;
  212. typedef RWCTLSTYLE FAR *      LPRWCTLSTYLE;
  213.  
  214. /*****************************************************************************
  215.  
  216.   In order to use RW's extensions to the custom controls, a custom
  217.   control DLL *must* implement the ListClasses function. This function
  218.   return a global memory handle to an initialized CTLCLASSLIST data
  219.   structure. All function pointers *must* point to valid functions
  220.  
  221.  
  222. *****************************************************************************/
  223.  
  224. typedef struct
  225. {
  226.   LPFNINFO  fnRWInfo;           // RW Info function
  227.   LPFNSTYLE fnRWStyle;          // RW Style function
  228.   LPFNFLAGS fnFlags;            // Flags function
  229.   char  szClass[ CTLCLASS];
  230.  
  231. } RWCTLCLASS, FAR *LPRWCTLCLASS;
  232.  
  233. typedef struct
  234. {
  235.   short       nClasses;
  236. #if defined (__cplusplus)
  237.   RWCTLCLASS Classes[1];
  238. #else
  239.   RWCTLCLASS Classes[];
  240. #endif
  241.  
  242. } CTLCLASSLIST, FAR *LPCTLCLASSLIST;
  243.  
  244. typedef HANDLE        (FAR PASCAL *LPFNLOADRES)( LPSTR szType, LPSTR szId);
  245. typedef BOOL      (FAR PASCAL *LPFNEDITRES)( LPSTR szType, LPSTR szId);
  246.  
  247. typedef HANDLE        (FAR PASCAL *LPFNLIST)
  248. (
  249.   LPSTR       szAppName,
  250.   WORD        wVersion,
  251.   LPFNLOADRES fnLoad,
  252.   LPFNEDITRES fnEdit
  253. );
  254.  
  255. #define DLGCUSTCLASSNAME   "_BorDlg_DlgEditChild"
  256. #define DLGTESTCLASSNAME   "_BorDlg_DlgEditTest"
  257.  
  258. #ifndef RC_INVOKED
  259. #pragma option -a.
  260. #endif
  261.  
  262. #endif    /* __CUSTCNTL_H */
  263.  
  264.