home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xwphescr.zip / XWPH0208.ZIP / include / helpers / dialog.h < prev    next >
C/C++ Source or Header  |  2002-08-11  |  27KB  |  638 lines

  1.  
  2. /*
  3.  *@@sourcefile dialog.h:
  4.  *      header file for dialog.c. See remarks there.
  5.  *
  6.  *      Note: Version numbering in this file relates to XWorkplace version
  7.  *            numbering.
  8.  *
  9.  *@@added V0.9.9 (2001-04-01) [umoeller]
  10.  *@@include <os2.h>
  11.  *@@include #include "helpers\linklist.h"           // for mnemonic helpers
  12.  *@@include #include "helpers\dialog.h"
  13.  */
  14.  
  15. /*      Copyright (C) 2001 Ulrich Möller.
  16.  *      This file is part of the "XWorkplace helpers" source package.
  17.  *      This is free software; you can redistribute it and/or modify
  18.  *      it under the terms of the GNU General Public License as published
  19.  *      by the Free Software Foundation, in version 2 as it comes in the
  20.  *      "COPYING" file of the XWorkplace main distribution.
  21.  *      This program is distributed in the hope that it will be useful,
  22.  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
  23.  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  24.  *      GNU General Public License for more details.
  25.  */
  26.  
  27. #if __cplusplus
  28. extern "C" {
  29. #endif
  30.  
  31. #ifndef DIALOG_HEADER_INCLUDED
  32.     #define DIALOG_HEADER_INCLUDED
  33.  
  34.     #ifndef NULL_POINT
  35.         #define NULL_POINT {0, 0}
  36.     #endif
  37.  
  38.     /* ******************************************************************
  39.      *
  40.      *   Error codes
  41.      *
  42.      ********************************************************************/
  43.  
  44.     #define ERROR_DLG_FIRST                     43000
  45.  
  46.     #define DLGERR_ROW_BEFORE_TABLE             (ERROR_DLG_FIRST)
  47.     #define DLGERR_CONTROL_BEFORE_ROW           (ERROR_DLG_FIRST + 1)
  48.     #define DLGERR_NULL_CTL_DEF                 (ERROR_DLG_FIRST + 2)
  49.     #define DLGERR_CANNOT_CREATE_FRAME          (ERROR_DLG_FIRST + 3)
  50.     #define DLGERR_INVALID_CODE                 (ERROR_DLG_FIRST + 4)
  51.     #define DLGERR_TABLE_NOT_CLOSED             (ERROR_DLG_FIRST + 5)
  52.     #define DLGERR_TOO_MANY_TABLES_CLOSED       (ERROR_DLG_FIRST + 6)
  53.     #define DLGERR_CANNOT_CREATE_CONTROL        (ERROR_DLG_FIRST + 7)
  54.     #define DLGERR_ARRAY_TOO_SMALL              (ERROR_DLG_FIRST + 8)
  55.     #define DLGERR_INVALID_CONTROL_TITLE        (ERROR_DLG_FIRST + 9)
  56.     #define DLGERR_INVALID_STATIC_BITMAP        (ERROR_DLG_FIRST + 10)
  57.     #define DLGERR_INTEGRITY_BAD_COLUMN_INDEX   (ERROR_DLG_FIRST + 11)
  58.  
  59.     #define ERROR_DLG_LAST                      (ERROR_DLG_FIRST + 11)
  60.  
  61.     /* ******************************************************************
  62.      *
  63.      *   Structures
  64.      *
  65.      ********************************************************************/
  66.  
  67.     #define SZL_AUTOSIZE                (-1)
  68.  
  69.     #define CTL_COMMON_FONT             ((PCSZ)-1)
  70.  
  71.     /*
  72.      *@@ CONTROLDEF:
  73.      *      defines a single control. Used
  74.      *      with the TYPE_CONTROL_DEF type in
  75.      *      DLGHITEM.
  76.      *
  77.      *@@changed V0.9.12 (2001-05-31) [umoeller]: added control data
  78.      */
  79.  
  80.     typedef struct _CONTROLDEF
  81.     {
  82.         const char  *pcszClass;         // registered PM window class
  83.         const char  *pcszText;
  84.                 // window text (class-specific)
  85.                 // special hacks:
  86.                 // -- For WS_STATIC with SS_BITMAP or SS_ICON set,
  87.                 //    you may specify the exact HPOINTER here.
  88.                 //    The dlg routine will then subclass the static
  89.                 //
  90.  
  91.         ULONG       flStyle;            // standard window styles
  92.  
  93.         USHORT      usID;               // dlg item ID
  94.  
  95.         const char  *pcszFont;          // font presparam, or NULL for no presparam,
  96.                                         // or CTL_COMMON_FONT for standard dialog
  97.                                         // font specified on input to dlghCreateDlg
  98.  
  99.         USHORT      usAdjustPosition;
  100.                 // flags for winhAdjustControls; any combination of
  101.                 // XAC_MOVEX, XAC_MOVEY, XAC_SIZEX, XAC_SIZEY
  102.                 // @@todo not implemented yet
  103.  
  104.         SIZEL       szlDlgUnits;
  105.                 // proposed size for the control. Note that starting
  106.                 // with V0.9.19, these are now dialog units to
  107.                 // finally fix the bad alignment problems with
  108.                 // lower resolutions. The dialog formatter applies
  109.                 // an internal factor to these things based on
  110.                 // what WinMapDlgPoints gives us.
  111.                 // A number of special flags are available per
  112.                 // cx and cy field:
  113.                 // -- SZL_AUTOSIZE (-1): determine size automatically.
  114.                 //    Works only for statics with SS_TEXT and
  115.                 //    SS_BITMAP.
  116.                 // -- Any other _negative_ value is considered a
  117.                 //    percentage of the largest row width in the
  118.                 //    table. For example, -50 would mean 50% of
  119.                 //    the largest row in the table. This is valid
  120.                 //    for the CX field only.
  121.                 // If the CONTROLDEF appears with a START_NEW_TABLE
  122.                 // type in _DLGHITEM (to specify a group table)
  123.                 // and they are not SZL_AUTOSIZE, they specify the
  124.                 // size of the inner table of the group (to override
  125.                 // the automatic formatting). Note that the dialog
  126.                 // adds extra spacing to this size:
  127.                 // -- the group control's cx will be
  128.                 //      szlControlProposed.cx
  129.                 //    + 2 * ulSpacing
  130.                 //    + 2 * GROUP_INNER_SPACING_X
  131.                 // -- the group control's cy will be
  132.                 //      szlControlProposed.cy
  133.                 //    + 2 * ulSpacing
  134.                 //    + GROUP_INNER_SPACING_Y
  135.                 //    + GROUP_INNER_SPACING_TOP
  136.  
  137.         ULONG       duSpacing;
  138.                 // spacing around control; this is now in dialog
  139.                 // units too V0.9.19 (2002-04-24) [umoeller]
  140.  
  141.         PVOID       pvCtlData;          // for WinCreateWindow
  142.  
  143.     } CONTROLDEF, *PCONTROLDEF;
  144.  
  145.     typedef const struct _CONTROLDEF *PCCONTROLDEF;
  146.  
  147.     /*
  148.      *@@ DLGHITEMTYPE:
  149.      *
  150.      */
  151.  
  152.     typedef enum _DLGHITEMTYPE
  153.     {
  154.         TYPE_START_NEW_TABLE,       // beginning of a new table; may nest
  155.         TYPE_START_NEW_ROW,         // beginning of a new row in a table
  156.         TYPE_CONTROL_DEF,           // control definition
  157.         TYPE_END_TABLE              // end of a table
  158.     } DLGHITEMTYPE;
  159.  
  160.     /*
  161.      *@@ DLGHITEM:
  162.      *      dialog format array item.
  163.      *
  164.      *      An array of these must be passed to dlghCreateDlg
  165.      *      to tell it what controls the dialog contains.
  166.      *      See dlghCreateDlg for details.
  167.      *
  168.      */
  169.  
  170.     typedef struct _DLGHITEM
  171.     {
  172.         DLGHITEMTYPE    Type;
  173.                 // one of:
  174.                 // TYPE_START_NEW_TABLE,        // beginning of a new table
  175.                 // TYPE_START_NEW_ROW,          // beginning of a new row in a table
  176.                 // TYPE_CONTROL_DEF             // control definition
  177.                 // TYPE_END_TABLE               // end of table
  178.  
  179.         const CONTROLDEF *pCtlDef;
  180.                 // -- with TYPE_START_NEW_TABLE: if NULL, this starts
  181.                 //          an invisible table (for formatting only).
  182.                 //          Otherwise a _CONTROLDEF pointer to specify
  183.                 //          a control to be produced around the table.
  184.                 //          For example, you can specify a WC_STATIC
  185.                 //          with SS_GROUPBOX to create a group around
  186.                 //          the table.
  187.  
  188.         ULONG           fl;
  189.                 // -- with TYPE_START_NEW_TABLE. TABLE_* formatting flags.
  190.                         #define TABLE_ALIGN_COLUMNS         0x0100
  191.  
  192.                 // -- with TYPE_START_NEW_ROW: ROW_* formatting flags.
  193.                         #define ROW_VALIGN_MASK             0x0003
  194.                         #define ROW_VALIGN_BOTTOM           0x0000
  195.                         #define ROW_VALIGN_CENTER           0x0001
  196.                         #define ROW_VALIGN_TOP              0x0002
  197.  
  198.     } DLGHITEM, *PDLGHITEM;
  199.  
  200.     typedef const struct _DLGHITEM *PCDLGHITEM;
  201.  
  202.     // a few handy macros for defining templates
  203.  
  204.     #define START_TABLE                     { TYPE_START_NEW_TABLE, NULL, 0 }
  205.  
  206.     #define START_TABLE_ALIGN               { TYPE_START_NEW_TABLE, NULL, TABLE_ALIGN_COLUMNS }
  207.                 // added V0.9.20 (2002-08-08) [umoeller]
  208.  
  209.     #define START_GROUP_TABLE(pDef)         { TYPE_START_NEW_TABLE, pDef, 0 }
  210.  
  211.     #define START_GROUP_TABLE_ALIGN(pDef)   { TYPE_START_NEW_TABLE, pDef, TABLE_ALIGN_COLUMNS }
  212.                 // added V0.9.20 (2002-08-08) [umoeller]
  213.  
  214.     #define END_TABLE                       { TYPE_END_TABLE, NULL, 0 }
  215.  
  216.     #define START_ROW(fl)                   { TYPE_START_NEW_ROW, NULL, fl }
  217.  
  218.     #define CONTROL_DEF(pDef)               { TYPE_CONTROL_DEF, pDef, 0 }
  219.  
  220.     /* ******************************************************************
  221.      *
  222.      *   Macros
  223.      *
  224.      ********************************************************************/
  225.  
  226.     #define LOAD_STRING     ((PCSZ)-1)
  227.  
  228.     // if the following is defined, we ignore the Y factor
  229.     // when scaling dialog units to pixels but use the X
  230.     // factor twice. This will result in something specified
  231.     // to be 10x10 units to be square, but will result in
  232.     // problems because dialog units are based on the
  233.     // system default fonts and x is different from y then.
  234.     // #define USE_SQUARE_CORRELATION
  235.  
  236.     // if you still want something to be vaguely square,
  237.     // try the following macro to calculate the CY from a CX
  238.     #ifdef USE_SQUARE_CORRELATION
  239.         #define MAKE_SQUARE_CY(cx) (cx)
  240.     #else
  241.         #define MAKE_SQUARE_CY(cx) (cx * 200 / 250)
  242.     #endif
  243.  
  244.     #define DLG_OUTER_SPACING_X             4
  245.                 // outer spacing applied around entire dialog;
  246.                 // we now use 4 to match the spacing in Warp 4
  247.                 // notebook pages V0.9.19 (2002-04-24) [umoeller]
  248.     #define DLG_OUTER_SPACING_Y             3
  249.  
  250.     #define COMMON_SPACING                  1
  251.  
  252.     #define GROUP_INNER_SPACING_X           3
  253.     #define GROUP_OUTER_SPACING_BOTTOM      1
  254.     #define GROUP_INNER_SPACING_BOTTOM      3
  255.     #define GROUP_INNER_SPACING_TOP         8
  256.     #define GROUP_OUTER_SPACING_TOP         0
  257.  
  258.     #define STD_BUTTON_WIDTH                50
  259.  
  260.     #ifdef USE_SQUARE_CORRELATION
  261.         #define STD_BUTTON_HEIGHT               15
  262.         #define STD_SPIN_HEIGHT                 10
  263.     #else
  264.         #define STD_BUTTON_HEIGHT               12
  265.         #define STD_SPIN_HEIGHT                  8
  266.     #endif
  267.  
  268.     #define DEFAULT_TABLE_WIDTH             150
  269.  
  270.     #define MSGBOX_TEXTWIDTH                200
  271.  
  272.     // the following require INCL_WINSTATICS
  273.  
  274.     #define CONTROLDEF_GROUP(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
  275.             WS_VISIBLE | SS_GROUPBOX | DT_MNEMONIC, \
  276.             id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
  277.  
  278.     #define LOADDEF_GROUP(id, cx) CONTROLDEF_GROUP(LOAD_STRING, id, cx, SZL_AUTOSIZE)
  279.  
  280.     #define CONTROLDEF_TEXT(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
  281.             WS_VISIBLE | SS_TEXT | DT_LEFT | DT_VCENTER | DT_MNEMONIC, \
  282.             id, CTL_COMMON_FONT,  0, {cx, cy}, COMMON_SPACING }
  283.  
  284.     #define LOADDEF_TEXT(id) CONTROLDEF_TEXT(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
  285.  
  286.     #define CONTROLDEF_TEXT_CENTER(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
  287.             WS_VISIBLE | SS_TEXT | DT_CENTER | DT_VCENTER | DT_MNEMONIC, \
  288.             id, CTL_COMMON_FONT,  0, {cx, cy}, COMMON_SPACING }
  289.  
  290.     #define CONTROLDEF_TEXT_RIGHT(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
  291.             WS_VISIBLE | SS_TEXT | DT_RIGHT | DT_VCENTER | DT_MNEMONIC, \
  292.             id, CTL_COMMON_FONT,  0, {cx, cy}, COMMON_SPACING }
  293.  
  294.     #define LOADDEF_TEXT_RIGHT(id) CONTROLDEF_TEXT_RIGHT(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
  295.  
  296.     #define CONTROLDEF_TEXT_WORDBREAK(pcsz, id, cx) { WC_STATIC, pcsz, \
  297.             WS_VISIBLE | SS_TEXT | DT_LEFT | DT_TOP | DT_WORDBREAK, \
  298.             id, CTL_COMMON_FONT,  0, {cx, SZL_AUTOSIZE}, COMMON_SPACING }
  299.  
  300.     #define CONTROLDEF_TEXT_WORDBREAK_CY(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
  301.             WS_VISIBLE | SS_TEXT | DT_LEFT | DT_TOP | DT_WORDBREAK, \
  302.             id, CTL_COMMON_FONT,  0, {cx, cy}, COMMON_SPACING }
  303.  
  304.     #define LOADDEF_TEXT_WORDBREAK(id, cx) CONTROLDEF_TEXT_WORDBREAK(LOAD_STRING, id, cx)
  305.  
  306.     #define CONTROLDEF_TEXT_WORDBREAK_MNEMONIC(pcsz, id, cx) { WC_STATIC, pcsz, \
  307.             WS_VISIBLE | SS_TEXT | DT_LEFT | DT_TOP | DT_WORDBREAK | DT_MNEMONIC, \
  308.             id, CTL_COMMON_FONT,  0, {cx, SZL_AUTOSIZE}, COMMON_SPACING }
  309.  
  310.     #define LOADDEF_TEXT_WORDBREAK_MNEMONIC(id, cx) CONTROLDEF_TEXT_WORDBREAK_MNEMONIC(LOAD_STRING, id, cx)
  311.  
  312.     #define CONTROLDEF_ICON(hptr, id) { WC_STATIC, (PCSZ)(hptr), \
  313.             WS_VISIBLE | SS_ICON | DT_LEFT | DT_VCENTER, \
  314.             id, CTL_COMMON_FONT, 0, {SZL_AUTOSIZE, SZL_AUTOSIZE}, COMMON_SPACING }
  315.  
  316.     #define CONTROLDEF_ICON_WIDER(hptr, id) { WC_STATIC, (PCSZ)(hptr), \
  317.             WS_VISIBLE | SS_ICON | DT_LEFT | DT_VCENTER, \
  318.             id, CTL_COMMON_FONT, 0, {SZL_AUTOSIZE, SZL_AUTOSIZE}, 2 * COMMON_SPACING }
  319.  
  320.     #define CONTROLDEF_BITMAP(hbm, id) { WC_STATIC, (PCSZ)(hbm), \
  321.             WS_VISIBLE | SS_BITMAP | DT_LEFT | DT_VCENTER, \
  322.             id, CTL_COMMON_FONT, 0, {SZL_AUTOSIZE, SZL_AUTOSIZE}, COMMON_SPACING }
  323.  
  324.     // the following require INCL_WINBUTTONS
  325.  
  326.     #define CONTROLDEF_DEFPUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
  327.             WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_DEFAULT, \
  328.             id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
  329.  
  330.     #define LOADDEF_DEFPUSHBUTTON(id) CONTROLDEF_DEFPUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
  331.  
  332.     #define CONTROLDEF_PUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
  333.             WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, \
  334.             id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
  335.  
  336.     #define LOADDEF_PUSHBUTTON(id) CONTROLDEF_PUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
  337.  
  338.     #define CONTROLDEF_DEFNOFOCUSBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
  339.             WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_DEFAULT | BS_NOPOINTERFOCUS, \
  340.             id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
  341.  
  342.     #define CONTROLDEF_NOFOCUSBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
  343.             WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, \
  344.             id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
  345.  
  346.     #define LOADDEF_NOFOCUSBUTTON(id) CONTROLDEF_NOFOCUSBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
  347.  
  348.     #define CONTROLDEF_HELPPUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
  349.             WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_HELP | BS_NOPOINTERFOCUS, \
  350.             id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
  351.  
  352.     #define LOADDEF_HELPPUSHBUTTON(id) CONTROLDEF_HELPPUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
  353.  
  354.     #define CONTROLDEF_AUTOCHECKBOX(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
  355.             WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX, \
  356.             id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
  357.  
  358.     #define LOADDEF_AUTOCHECKBOX(id) CONTROLDEF_AUTOCHECKBOX(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
  359.  
  360.     #define CONTROLDEF_FIRST_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
  361.             WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON | WS_GROUP, \
  362.             id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
  363.  
  364.     #define LOADDEF_FIRST_AUTORADIO(id) CONTROLDEF_FIRST_AUTORADIO(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
  365.  
  366.     #define CONTROLDEF_NEXT_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
  367.             WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON, \
  368.             id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
  369.  
  370.     #define LOADDEF_NEXT_AUTORADIO(id) CONTROLDEF_NEXT_AUTORADIO(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
  371.  
  372.     // the following require INCL_WINENTRYFIELDS
  373.  
  374.     #define CONTROLDEF_ENTRYFIELD(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \
  375.             WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_AUTOSCROLL, \
  376.             id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
  377.  
  378.     #define CONTROLDEF_ENTRYFIELD_RO(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \
  379.             WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_READONLY | ES_AUTOSCROLL, \
  380.             id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
  381.  
  382.     // the following require INCL_WINMLE
  383.  
  384.     #define CONTROLDEF_MLE(pcsz, id, cx, cy) { WC_MLE, pcsz, \
  385.             WS_VISIBLE | WS_TABSTOP | MLS_BORDER | MLS_IGNORETAB | MLS_WORDWRAP, \
  386.             id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
  387.  
  388.     // the following require INCL_WINLISTBOXES
  389.  
  390.     #define CONTROLDEF_LISTBOX(id, cx, cy) { WC_LISTBOX, NULL, \
  391.             WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | LS_NOADJUSTPOS, \
  392.             id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
  393.  
  394.     // the following require INCL_WINLISTBOXES and INCL_WINENTRYFIELDS
  395.  
  396.     #define CONTROLDEF_DROPDOWN(id, cx, cy) { WC_COMBOBOX, NULL, \
  397.             WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | CBS_DROPDOWN, \
  398.             id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
  399.  
  400.     #define CONTROLDEF_DROPDOWNLIST(id, cx, cy) { WC_COMBOBOX, NULL, \
  401.             WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | CBS_DROPDOWNLIST, \
  402.             id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
  403.  
  404.     // the following require INCL_WINSTDSPIN
  405.  
  406.     #define CONTROLDEF_SPINBUTTON(id, cx, cy) { WC_SPINBUTTON, NULL, \
  407.             WS_VISIBLE | WS_TABSTOP | SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | SPBS_FASTSPIN, \
  408.             id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
  409.  
  410.     // the following require INCL_WINSTDCNR
  411.  
  412.     #define CONTROLDEF_CONTAINER(id, cx, cy) { WC_CONTAINER, NULL, \
  413.             WS_VISIBLE | WS_TABSTOP | 0, \
  414.             id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
  415.  
  416.     #define CONTROLDEF_CONTAINER_EXTSEL(id, cx, cy) { WC_CONTAINER, NULL, \
  417.             WS_VISIBLE | WS_TABSTOP | CCS_EXTENDSEL, \
  418.             id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
  419.  
  420.     // the following require INCL_WINSTDSLIDER
  421.  
  422.     #define CONTROLDEF_SLIDER(id, cx, cy, pctldata) { WC_SLIDER, NULL, \
  423.             WS_VISIBLE | WS_TABSTOP | WS_GROUP | SLS_HORIZONTAL | SLS_PRIMARYSCALE1 \
  424.             | SLS_BUTTONSRIGHT | SLS_SNAPTOINCREMENT, \
  425.             id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING, pctldata }
  426.  
  427.     #define CONTROLDEF_VSLIDER(id, cx, cy, pctldata) { WC_SLIDER, NULL, \
  428.             WS_VISIBLE | WS_TABSTOP | WS_GROUP | SLS_VERTICAL | SLS_PRIMARYSCALE1 \
  429.             | SLS_BUTTONSRIGHT | SLS_SNAPTOINCREMENT, \
  430.             id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING, pctldata }
  431.  
  432.     // the following require #include helpers\textview.h
  433.  
  434.     #define CONTROLDEF_XTEXTVIEW(text, id, cx, pctldata) { WC_XTEXTVIEW, text, \
  435.             WS_VISIBLE | XS_STATIC | XS_WORDWRAP, \
  436.             id, CTL_COMMON_FONT, 0, {cx, SZL_AUTOSIZE}, COMMON_SPACING, pctldata }
  437.  
  438.     #define CONTROLDEF_XTEXTVIEW_HTML(text, id, cx, pctldata) { WC_XTEXTVIEW, text, \
  439.             WS_VISIBLE | XS_STATIC | XS_WORDWRAP | XS_HTML, \
  440.             id, CTL_COMMON_FONT, 0, {cx, SZL_AUTOSIZE}, COMMON_SPACING, pctldata }
  441.  
  442.     /* ******************************************************************
  443.      *
  444.      *   Dialog formatter entry points
  445.      *
  446.      ********************************************************************/
  447.  
  448.     #ifndef FCF_CLOSEBUTTON
  449.         #define FCF_CLOSEBUTTON            0x04000000L // toolkit 4 only
  450.     #endif
  451.  
  452.     #define FCF_FIXED_DLG       FCF_TITLEBAR | FCF_SYSMENU | FCF_DLGBORDER | FCF_NOBYTEALIGN | FCF_CLOSEBUTTON
  453.     #define FCF_SIZEABLE_DLG    FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_NOBYTEALIGN | FCF_CLOSEBUTTON
  454.  
  455.     APIRET XWPENTRY dlghCreateDlg(HWND *phwndDlg,
  456.                                   HWND hwndOwner,
  457.                                   ULONG flCreateFlags,
  458.                                   PFNWP pfnwpDialogProc,
  459.                                   PCSZ pcszDlgTitle,
  460.                                   PCDLGHITEM paDlgItems,
  461.                                   ULONG cDlgItems,
  462.                                   PVOID pCreateParams,
  463.                                   PCSZ pcszControlsFont);
  464.     typedef APIRET XWPENTRY DLGHCREATEDLG(HWND *phwndDlg,
  465.                                           HWND hwndOwner,
  466.                                           ULONG flCreateFlags,
  467.                                           PFNWP pfnwpDialogProc,
  468.                                           PCSZ pcszDlgTitle,
  469.                                           PCDLGHITEM paDlgItems,
  470.                                           ULONG cDlgItems,
  471.                                           PVOID pCreateParams,
  472.                                           PCSZ pcszControlsFont);
  473.     typedef DLGHCREATEDLG *PDLGHCREATEDLG;
  474.  
  475.     #define DFFL_CREATECONTROLS     0x0002
  476.  
  477.     APIRET dlghFormatDlg(HWND hwndDlg,
  478.                          PCDLGHITEM paDlgItems,
  479.                          ULONG cDlgItems,
  480.                          PCSZ pcszControlsFont,
  481.                          ULONG flFlags,
  482.                          PSIZEL pszlClient,
  483.                          PVOID *ppllControls);
  484.  
  485.     VOID dlghResizeFrame(HWND hwndDlg,
  486.                          PSIZEL pszlClient);
  487.  
  488.     /* ******************************************************************
  489.      *
  490.      *   Dialog arrays
  491.      *
  492.      ********************************************************************/
  493.  
  494.     /*
  495.      *@@ DLGARRAY:
  496.      *      dialog array structure used with dlghCreateArray.
  497.      *      See remarks there.
  498.      *
  499.      *@@added V0.9.16 (2001-10-15) [umoeller]
  500.      */
  501.  
  502.     typedef struct _DLGARRAY
  503.     {
  504.         DLGHITEM    *paDlgItems;        // array of DLGHITEM's, allocated once
  505.                                         // by dlghCreateArray
  506.         ULONG       cDlgItemsMax,       // copied from dlghCreateArray
  507.                     cDlgItemsNow;       // initially 0, raised after each
  508.                                         // dlghAppendToArray; pass this to the
  509.                                         // dialog formatter
  510.     } DLGARRAY, *PDLGARRAY;
  511.  
  512.     APIRET dlghCreateArray(ULONG cMaxItems, PDLGARRAY *ppArray);
  513.     typedef APIRET DLGHCREATEARRAY(ULONG cMaxItems, PDLGARRAY *ppArray);
  514.     typedef DLGHCREATEARRAY *PDLGHCREATEARRAY;
  515.  
  516.     APIRET dlghFreeArray(PDLGARRAY *ppArray);
  517.     typedef APIRET DLGHFREEARRAY(PDLGARRAY *ppArray);
  518.     typedef DLGHFREEARRAY *PDLGHFREEARRAY;
  519.  
  520.     APIRET dlghAppendToArray(PDLGARRAY pArray,
  521.                              PCDLGHITEM paItems,
  522.                              ULONG cItems);
  523.     typedef APIRET DLGHAPPENDTOARRAY(PDLGARRAY pArray,
  524.                                      PCDLGHITEM paItems,
  525.                                      ULONG cItems);
  526.     typedef DLGHAPPENDTOARRAY *PDLGHAPPENDTOARRAY;
  527.  
  528.     /* ******************************************************************
  529.      *
  530.      *   Standard dialogs
  531.      *
  532.      ********************************************************************/
  533.  
  534.     /*
  535.      *@@ MSGBOXSTRINGS:
  536.      *
  537.      *@@added V0.9.13 (2001-06-21) [umoeller]
  538.      */
  539.  
  540.     typedef struct _MSGBOXSTRINGS
  541.     {
  542.         const char      *pcszYes,           // "~Yes"
  543.                         *pcszNo,            // "~No"
  544.                         *pcszOK,            // "~OK"
  545.                         *pcszCancel,        // "~Cancel"
  546.                         *pcszAbort,         // "~Abort"
  547.                         *pcszRetry,         // "~Retry"
  548.                         *pcszIgnore,        // "~Ignore"
  549.                         *pcszEnter,         // "~Help"
  550.                         *pcszYesToAll,      // "Yes to ~all"
  551.                         *pcszHelp;          // "~Help"
  552.     } MSGBOXSTRINGS, *PMSGBOXSTRINGS;
  553.  
  554.     /* the following are in os2.h somewhere:
  555.     #define MB_OK                      0x0000
  556.     #define MB_OKCANCEL                0x0001
  557.     #define MB_RETRYCANCEL             0x0002
  558.     #define MB_ABORTRETRYIGNORE        0x0003
  559.     #define MB_YESNO                   0x0004
  560.     #define MB_YESNOCANCEL             0x0005
  561.     #define MB_CANCEL                  0x0006
  562.     #define MB_ENTER                   0x0007
  563.     #define MB_ENTERCANCEL             0x0008 */
  564.     // we add:
  565.     #define MB_YES_YES2ALL_NO          0x0009
  566.  
  567.     /* the following are in os2.h somewhere:
  568.     #define MBID_OK                    1
  569.     #define MBID_CANCEL                2
  570.     #define MBID_ABORT                 3
  571.     #define MBID_RETRY                 4
  572.     #define MBID_IGNORE                5
  573.     #define MBID_YES                   6
  574.     #define MBID_NO                    7
  575.     #define MBID_HELP                  8
  576.     #define MBID_ENTER                 9 */
  577.     // we add:
  578.     #define MBID_YES2ALL               10
  579.  
  580.     typedef VOID APIENTRY FNHELP(HWND hwndDlg);
  581.     typedef FNHELP *PFNHELP;
  582.  
  583.     APIRET dlghCreateMessageBox(HWND *phwndDlg,
  584.                                 HWND hwndOwner,
  585.                                 HPOINTER hptrIcon,
  586.                                 PCSZ pcszTitle,
  587.                                 PCSZ pcszMessage,
  588.                                 PFNHELP pfnHelp,
  589.                                 ULONG flFlags,
  590.                                 PCSZ pcszFont,
  591.                                 const MSGBOXSTRINGS *pStrings,
  592.                                 PULONG pulAlarmFlag);
  593.  
  594.     ULONG dlghMessageBox(HWND hwndOwner,
  595.                          HPOINTER hptrIcon,
  596.                          PCSZ pcszTitle,
  597.                          PCSZ pcszMessage,
  598.                          PFNHELP pfnHelp,
  599.                          ULONG flFlags,
  600.                          PCSZ pcszFont,
  601.                          const MSGBOXSTRINGS *pStrings);
  602.  
  603.     #define TEBF_REMOVETILDE            0x0001
  604.     #define TEBF_REMOVEELLIPSE          0x0002
  605.     #define TEBF_SELECTALL              0x0004
  606.  
  607.     PSZ dlghTextEntryBox(HWND hwndOwner,
  608.                          PCSZ pcszTitle,
  609.                          PCSZ pcszDescription,
  610.                          PCSZ pcszDefault,
  611.                          PCSZ pcszOK,
  612.                          PCSZ pcszCancel,
  613.                          ULONG ulMaxLen,
  614.                          ULONG fl,
  615.                          PCSZ pcszFont);
  616.  
  617.     /* ******************************************************************
  618.      *
  619.      *   Dialog input handlers
  620.      *
  621.      ********************************************************************/
  622.  
  623.     VOID dlghSetPrevFocus(PVOID pvllWindows);
  624.  
  625.     VOID dlghSetNextFocus(PVOID pvllWindows);
  626.  
  627.     HWND dlghProcessMnemonic(PVOID pvllWindows,
  628.                              USHORT usch);
  629.  
  630.     BOOL dlghEnter(PVOID pvllWindows);
  631.  
  632. #endif
  633.  
  634. #if __cplusplus
  635. }
  636. #endif
  637.  
  638.