Changeset 80


Ignore:
Timestamp:
Jun 4, 2001, 9:13:58 AM (24 years ago)
Author:
umoeller
Message:

Final sources for 0.9.12 release.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/dialog.c

    r79 r80  
    957957/*
    958958 *@@ dlghCreateDlg:
    959  *      replacement for WinCreateDlg for creating a dialog
    960  *      from a settings array in memory, which is formatted
    961  *      automatically.
     959 *      replacement for WinCreateDlg/WinLoadDlg for creating a
     960 *      dialog from a settings array in memory, which is
     961 *      formatted automatically.
    962962 *
    963963 *      This does NOT use regular dialog templates from
     
    977977 *      Like WinLoadDlg, this creates a standard WC_FRAME and
    978978 *      subclasses it with fnwpMyDlgProc. It then sends WM_INITDLG
    979  *      to the dialog with pCreateParams in mp2. You can use
    980  *      WinProcessDlg as usual. In your dlg proc, use WinDefDlgProc
    981  *      as usual.
     979 *      to the dialog with pCreateParams in mp2.
     980 *
     981 *      If this func returns no error, you can then use
     982 *      WinProcessDlg with the newly created dialog as usual. In
     983 *      your dlg proc, use WinDefDlgProc as usual.
    982984 *
    983985 *      There is NO run-time overhead after creation; after this
     
    994996 *      at compile time.
    995997 *
     998 *      Essentially, such a dialog item operates similarly to
     999 *      HTML tables. There are rows and columns in the table,
     1000 *      and each control which is specified must be a column
     1001 *      in some table. Tables may also nest (see below).
     1002 *
    9961003 *      The macros are:
    9971004 *
     
    9991006 *          but must each be properly terminated with END_TABLE.
    10001007 *
    1001  *      --  START_ROW(fl) starts a new row in a table.
     1008 *      --  START_GROUP_TABLE(pDef) starts a group. This
     1009 *          behaves exacly like START_TABLE, but in addition,
     1010 *          it produces a static group control around the table.
     1011 *          Useful for group boxes. pDef must point to a
     1012 *          _CONTROLDEF describing the control to be used for
     1013 *          the group (usually a WC_STATIC with SS_GROUP style),
     1014 *          whose size parameter is ignored.
     1015 *
     1016 *          As with START_TABLE, START_GROUP_TABLE must be
     1017 *          terminated with END_TABLE.
     1018 *
     1019 *      --  START_ROW(fl) starts a new row in a table (regular
     1020 *          or group). This must also be the first item after
     1021 *          the (group) table tag.
    10021022 *
    10031023 *          fl specifies formatting flags for the row. This
    10041024 *          can be one of ROW_VALIGN_BOTTOM, ROW_VALIGN_CENTER,
    10051025 *          ROW_VALIGN_TOP and affects all items in the control.
    1006  *
    1007  *      --  START_GROUP_TABLE(pDef) starts a group. This
    1008  *          behaves exacly like START_TABLE, but in addition,
    1009  *          it produces a control around the table. Useful
    1010  *          for group boxes. pDef must point to a _CONTROLDEF,
    1011  *          whose size parameter is ignored.
    1012  *
    1013  *          This must also be terminated with END_TABLE.
    10141026 *
    10151027 *      --  CONTROL_DEF(pDef) defines a control in a table row.
     
    10211033 *          Instead, the structure only contains the _size_
    10221034 *          of the control. All positions are computed by
    1023  *          this function, depending on the position of the
    1024  *          control and its nesting within the various tables.
     1035 *          this function, depending on the sizes of the
     1036 *          controls and their nesting within the various tables.
    10251037 *
    10261038 *          If you specify SZL_AUTOSIZE, the size of the
    10271039 *          control is even computed automatically. Presently,
    1028  *          this only works for statics with SS_TEXT and
    1029  *          SS_BITMAP.
    1030  *
    1031  *          Unless separated with TYPE_START_NEW_ROW items,
    1032  *          subsequent control items will be considered
    1033  *          to be in the same row (== positioned next to
    1034  *          each other).
     1040 *          this only works for statics with SS_TEXT, SS_ICON,
     1041 *          and SS_BITMAP.
     1042 *
     1043 *          Unless separated with START_ROW items, subsequent
     1044 *          control items will be considered to be in the same
     1045 *          row (== positioned next to each other).
    10351046 *
    10361047 *      There are a few rules, whose violation will produce
     
    10751086 +          DLGHITEM DlgTemplate[] =
    10761087 +              {
    1077  +                  START_TABLE,            // root table, must exist
    1078  +                      START_ROW(0),       // row 1 in the root table
     1088 +                  START_TABLE,            // root table, required
     1089 +                      START_ROW(0),       // row 1 in the root table, required
    10791090 +                          // create group on top
    10801091 +      (1)                 START_GROUP_TABLE(&Group),
     
    11531164 +                                        fnwpMyDlgProc,
    11541165 +                                        "My Dlg Title",
    1155  +                                        G_aMyDialogTemplate,
    1156  +                                        ARRAYITEMSIZE(G_aMyDialogTemplate),
     1166 +                                        DlgTemplate,      // DLGHITEM array
     1167 +                                        ARRAYITEMSIZE(DlgTemplate),
    11571168 +                                        NULL))
    11581169 +          {
    1159  +              ULONG idReturn = WinProcessDlg(pDlgData->hwndDlg);
     1170 +              ULONG idReturn = WinProcessDlg(hwndDlg);
    11601171 +              WinDestroyWindow(hwndDlg);
    11611172 +          }
     
    13781389        else
    13791390        {
     1391            HWND    hwndDlg = pDlgData->hwndDlg;
    13801392            SIZEL   szlClient = {0};
    13811393            RECTL   rclClient;
     
    13831395
    13841396            /*
    1385              *  3) compute size of client after computing all control sizes
     1397             *  3) compute size of all controls
    13861398             *
    13871399             */
     
    13941406                WinReleasePS(pDlgData->hps);
    13951407
    1396             WinSubclassWindow(pDlgData->hwndDlg, pfnwpDialogProc);
     1408            /*
     1409             *  4) compute size of dialog client from total
     1410             *     size of all controls
     1411             */
     1412
     1413            WinSubclassWindow(hwndDlg, pfnwpDialogProc);
    13971414
    13981415            // calculate the frame size from the client size
     
    14011418            rclClient.xRight = szlClient.cx + 2 * SPACING;
    14021419            rclClient.yTop = szlClient.cy + 2 * SPACING;
    1403             WinCalcFrameRect(pDlgData->hwndDlg,
     1420            WinCalcFrameRect(hwndDlg,
    14041421                             &rclClient,
    14051422                             FALSE);            // frame from client
    14061423
    1407             WinSetWindowPos(pDlgData->hwndDlg,
     1424            WinSetWindowPos(hwndDlg,
    14081425                            0,
    14091426                            10,
     
    14141431
    14151432            /*
    1416              *  4) compute positions of all controls
     1433             *  5) compute _positions_ of all controls
    14171434             *
    14181435             */
     
    14231440
    14241441            /*
    1425              *  5) create control windows, finally
     1442             *  6) create control windows, finally
    14261443             *
    14271444             */
     
    14351452
    14361453            /*
    1437              *  6) WM_INITDLG, set focus
     1454             *  7) WM_INITDLG, set focus
    14381455             *
    14391456             */
     
    14411458            hwndFocusItem = (pDlgData->hwndFirstFocus)
    14421459                                    ? pDlgData->hwndFirstFocus
    1443                                     : pDlgData->hwndDlg;
    1444             if (!WinSendMsg(pDlgData->hwndDlg,
     1460                                    : hwndDlg;
     1461            if (!WinSendMsg(hwndDlg,
    14451462                            WM_INITDLG,
    14461463                            (MPARAM)hwndFocusItem,
Note: See TracChangeset for help on using the changeset viewer.