Ignore:
Timestamp:
Apr 25, 2002, 7:25:16 PM (23 years ago)
Author:
umoeller
Message:

Lots of dialog rework, plus other fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/dialog.h

    r157 r159  
    106106                // @@todo not implemented yet
    107107
    108         SIZEL       szlControlProposed;
    109                 // proposed size; a number of special flags are
    110                 // available (per cx, cy field):
     108        SIZEL       szlDlgUnits;
     109                // proposed size for the control. Note that starting
     110                // with V0.9.19, these are now dialog units to
     111                // finally fix the bad alignment problems with
     112                // lower resolutions. The dialog formatter applies
     113                // an internal factor to these things based on
     114                // what WinMapDlgPoints gives us.
     115                // A number of special flags are available per
     116                // cx and cy field:
    111117                // -- SZL_AUTOSIZE (-1): determine size automatically.
    112118                //    Works only for statics with SS_TEXT and
     
    122128                // size of the inner table of the group (to override
    123129                // the automatic formatting). Note that the dialog
    124                 // formatter adds COMMON_SPACING to both the left and
    125                 // the right of the table to center the table in the
    126                 // PM group control, so the actual group size will
    127                 // be the specified size + (2 * COMMON_SPACING).
    128 
    129         ULONG       ulSpacing;          // spacing around control
     130                // adds extra spacing to this size:
     131                // -- the group control's cx will be
     132                //      2 * szlControlProposed.cx
     133                //    + 2 * ulSpacing
     134                //    + 2 * GROUP_INNER_SPACING_X
     135                // -- the group control's cy will be
     136                //      2 * szlControlProposed.cy
     137                //    + 2 * ulSpacing
     138                //    + GROUP_INNER_SPACING_Y
     139                //    + GROUP_INNER_SPACING_TOP
     140
     141        ULONG       duSpacing;
     142                // spacing around control; this is now in dialog
     143                // units too V0.9.19 (2002-04-24) [umoeller]
    130144
    131145        PVOID       pvCtlData;          // for WinCreateWindow
     
    205219    #define LOAD_STRING     ((PCSZ)-1)
    206220
    207     #define COMMON_SPACING              3
    208 
    209     #define PM_GROUP_SPACING_X          16
    210     #define PM_GROUP_SPACING_TOP        16
     221    // if the following is defined, we ignore the Y factor
     222    // when scaling dialog units to pixels but use the X
     223    // factor twice. This will result in something specified
     224    // to be 10x10 units to be square, but will result in
     225    // problems because dialog units are based on the
     226    // system default fonts and x is different from y then.
     227    // #define USE_SQUARE_CORRELATION
     228
     229    // if you still want something to be vaguely square,
     230    // try the following macro to calculate the CY from a CX
     231    #ifdef USE_SQUARE_CORRELATION
     232        #define MAKE_SQUARE_CY(cx) (cx)
     233    #else
     234        #define MAKE_SQUARE_CY(cx) (cx * 200 / 250)
     235    #endif
     236
     237    #define DLG_OUTER_SPACING_X             4
     238                // outer spacing applied around entire dialog;
     239                // we now use 4 to match the spacing in Warp 4
     240                // notebook pages V0.9.19 (2002-04-24) [umoeller]
     241    #define DLG_OUTER_SPACING_Y             3
     242
     243    #define COMMON_SPACING                  1
     244
     245    #define GROUP_INNER_SPACING_X           3
     246    #define GROUP_OUTER_SPACING_BOTTOM      1
     247    #define GROUP_INNER_SPACING_BOTTOM      3
     248    #define GROUP_INNER_SPACING_TOP         8
     249    #define GROUP_OUTER_SPACING_TOP         0
     250
     251    #define STD_BUTTON_WIDTH                50
     252
     253    #ifdef USE_SQUARE_CORRELATION
     254        #define STD_BUTTON_HEIGHT               15
     255        #define STD_SPIN_HEIGHT                 10
     256    #else
     257        #define STD_BUTTON_HEIGHT               12
     258        #define STD_SPIN_HEIGHT                  8
     259    #endif
     260
     261    #define DEFAULT_TABLE_WIDTH             150
    211262
    212263    // the following require INCL_WINSTATICS
     
    214265    #define CONTROLDEF_GROUP(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
    215266            WS_VISIBLE | SS_GROUPBOX | DT_MNEMONIC, \
    216             id, CTL_COMMON_FONT, 0, { cx, cy }, 0 }
    217 
    218     #define CDEF_GROUP_AUTO(id) CONTROLDEF_GROUP(LOAD_STRING, id, -1, -1)
     267            id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
     268
     269    #define LOADDEF_GROUP(id, cx) CONTROLDEF_GROUP(LOAD_STRING, id, cx, SZL_AUTOSIZE)
    219270
    220271    #define CONTROLDEF_TEXT(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
     
    222273            id, CTL_COMMON_FONT,  0, {cx, cy}, COMMON_SPACING }
    223274
     275    #define LOADDEF_TEXT(id) CONTROLDEF_TEXT(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
     276
    224277    #define CONTROLDEF_TEXT_CENTER(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
    225278            WS_VISIBLE | SS_TEXT | DT_CENTER | DT_VCENTER | DT_MNEMONIC, \
     
    228281    #define CONTROLDEF_TEXT_WORDBREAK(pcsz, id, cx) { WC_STATIC, pcsz, \
    229282            WS_VISIBLE | SS_TEXT | DT_LEFT | DT_TOP | DT_WORDBREAK, \
    230             id, CTL_COMMON_FONT,  0, {cx, -1}, COMMON_SPACING }
     283            id, CTL_COMMON_FONT,  0, {cx, SZL_AUTOSIZE}, COMMON_SPACING }
    231284
    232285    #define CONTROLDEF_ICON(hptr, id) { WC_STATIC, (PCSZ)(hptr), \
    233286            WS_VISIBLE | SS_ICON | DT_LEFT | DT_VCENTER, \
    234             id, CTL_COMMON_FONT, 0, {-1, -1}, COMMON_SPACING }
     287            id, CTL_COMMON_FONT, 0, {SZL_AUTOSIZE, SZL_AUTOSIZE}, COMMON_SPACING }
    235288
    236289    #define CONTROLDEF_BITMAP(hbm, id) { WC_STATIC, (PCSZ)(hbm), \
    237290            WS_VISIBLE | SS_BITMAP | DT_LEFT | DT_VCENTER, \
    238             id, CTL_COMMON_FONT, 0, {-1, -1}, COMMON_SPACING }
     291            id, CTL_COMMON_FONT, 0, {SZL_AUTOSIZE, SZL_AUTOSIZE}, COMMON_SPACING }
    239292
    240293    // the following require INCL_WINBUTTONS
     
    244297            id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
    245298
     299    #define LOADDEF_DEFPUSHBUTTON(id) CONTROLDEF_DEFPUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
     300
    246301    #define CONTROLDEF_PUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
    247302            WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, \
    248303            id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
    249304
     305    #define LOADDEF_PUSHBUTTON(id) CONTROLDEF_PUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
     306
    250307    #define CONTROLDEF_DEFNOFOCUSBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
    251308            WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_DEFAULT | BS_NOPOINTERFOCUS, \
     
    257314
    258315    #define CONTROLDEF_HELPPUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
    259             WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_HELP, \
    260             id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
     316            WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_HELP | BS_NOPOINTERFOCUS, \
     317            id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
     318
     319    #define LOADDEF_HELPPUSHBUTTON(id) CONTROLDEF_HELPPUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
    261320
    262321    #define CONTROLDEF_AUTOCHECKBOX(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
     
    264323            id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
    265324
    266     #define CDEF_AUTOCB_AUTO(id) CONTROLDEF_AUTOCHECKBOX(LOAD_STRING, id, -1, -1)
     325    #define LOADDEF_AUTOCHECKBOX(id) CONTROLDEF_AUTOCHECKBOX(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
    267326
    268327    #define CONTROLDEF_FIRST_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
     
    270329            id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
    271330
     331    #define LOADDEF_FIRST_AUTORADIO(id) CONTROLDEF_FIRST_AUTORADIO(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
     332
    272333    #define CONTROLDEF_NEXT_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
    273334            WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON, \
    274335            id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
     336
     337    #define LOADDEF_NEXT_AUTORADIO(id) CONTROLDEF_NEXT_AUTORADIO(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
    275338
    276339    // the following require INCL_WINENTRYFIELDS
     
    425488                        *pcszRetry,         // "~Retry"
    426489                        *pcszIgnore,        // "~Ignore"
    427                         *pcszEnter,
    428                         *pcszYesToAll;      // "Yes to ~all"
     490                        *pcszEnter,         // "~Help"
     491                        *pcszYesToAll,      // "Yes to ~all"
     492                        *pcszHelp;          // "~Help"
    429493    } MSGBOXSTRINGS, *PMSGBOXSTRINGS;
    430494
     
    455519    #define MBID_YES2ALL               10
    456520
     521    typedef VOID APIENTRY FNHELP(HWND hwndDlg);
     522    typedef FNHELP *PFNHELP;
     523
    457524    APIRET dlghCreateMessageBox(HWND *phwndDlg,
    458525                                HWND hwndOwner,
     
    460527                                PCSZ pcszTitle,
    461528                                PCSZ pcszMessage,
     529                                PFNHELP pfnHelp,
    462530                                ULONG flFlags,
    463531                                PCSZ pcszFont,
     
    469537                         PCSZ pcszTitle,
    470538                         PCSZ pcszMessage,
     539                         PFNHELP pfnHelp,
    471540                         ULONG flFlags,
    472541                         PCSZ pcszFont,
Note: See TracChangeset for help on using the changeset viewer.