Ignore:
Timestamp:
Jan 19, 2002, 11:50:39 AM (24 years ago)
Author:
umoeller
Message:

Misc changes.

File:
1 edited

Legend:

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

    r123 r132  
    234234{
    235235    LONG lPointSize = 0;
    236     const char *pcszFontThis = pControlDef->pcszFont;
     236    PCSZ pcszFontThis = pControlDef->pcszFont;
    237237                    // can be NULL,
    238238                    // or CTL_COMMON_FONT
     
    12401240
    12411241APIRET Dlg1_ParseTables(PDLGPRIVATE pDlgData,
    1242                         PDLGHITEM paDlgItems,      // in: definition array
     1242                        PCDLGHITEM paDlgItems,      // in: definition array
    12431243                        ULONG cDlgItems)           // in: array item count (NOT array size)
    12441244{
     
    12561256         ul++)
    12571257    {
    1258         PDLGHITEM   pItemThis = &paDlgItems[ul];
     1258        PCDLGHITEM   pItemThis = &paDlgItems[ul];
    12591259
    12601260        switch (pItemThis->Type)
     
    15841584 *          it produces a static group control around the table.
    15851585 *          Useful for group boxes. pDef must point to a
    1586  *          _CONTROLDEF describing the control to be used for
     1586 *          CONTROLDEF describing the control to be used for
    15871587 *          the group (usually a WC_STATIC with SS_GROUP style),
    15881588 *          whose size parameter is ignored.
     
    16021602 *          pDef must point to a CONTROLDEF structure.
    16031603 *
    1604  *          Again, there is is NO information in
    1605  *          CONTROLDEF about a control's _position_.
    1606  *          Instead, the structure only contains the _size_
    1607  *          of the control. All positions are computed by
    1608  *          this function, depending on the sizes of the
    1609  *          controls and their nesting within the various tables.
    1610  *
    1611  *          If you specify SZL_AUTOSIZE, the size of the
    1612  *          control is even computed automatically. Presently,
    1613  *          this only works for statics with SS_TEXT, SS_ICON,
    1614  *          and SS_BITMAP.
     1604 *          Again, there is is NO information in CONTROLDEF
     1605 *          about a control's _position_. Instead, the structure
     1606 *          only contains the _size_ of the control. All
     1607 *          positions are computed by this function, depending
     1608 *          on the sizes of the controls and their nesting within
     1609 *          the various tables.
     1610 *
     1611 *          If you specify SZL_AUTOSIZE with either cx or cy
     1612 *          or both, the size of the control is even computed
     1613 *          automatically. Presently, this only works for statics
     1614 *          with SS_TEXT, SS_ICON, and SS_BITMAP, push buttons,
     1615 *          and radio and check boxes.
    16151616 *
    16161617 *          Unless separated with START_ROW items, subsequent
     
    16211622 *      an error:
    16221623 *
    1623  *      -- The entire array must be enclosed in a table
    1624  *         (the "root" table).
    1625  *
    1626  *      -- After START_TABLE or START_GROUP_TABLE, there must
    1627  *         always be a START_ROW first.
     1624 *      --  The entire array must be enclosed in a table
     1625 *          (the "root" table).
     1626 *
     1627 *      --  After START_TABLE or START_GROUP_TABLE, there must
     1628 *          always be a START_ROW first.
    16281629 *
    16291630 *      To create a dialog, set up arrays like the following:
     
    16861687 +          º ³  ³                        ³  ³  º
    16871688 +          º ³  ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ  ³  º
     1689 +          º ³                              ³  º
    16881690 +          º ³  Static below cnr (3)        ³  º
    16891691 +          º ³                              ³  º
    16901692 +          º ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ  º
     1693 +          º                                   º
    16911694 +          º ÚÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿     º
    16921695 +          º ³   OK (4)  ³ ³  Cancel (5) ³     º
     
    17561759                     ULONG flCreateFlags,       // in: standard FCF_* frame flags
    17571760                     PFNWP pfnwpDialogProc,
    1758                      const char *pcszDlgTitle,
    1759                      PDLGHITEM paDlgItems,      // in: definition array
     1761                     PCSZ pcszDlgTitle,
     1762                     PCDLGHITEM paDlgItems,      // in: definition array
    17601763                     ULONG cDlgItems,           // in: array item count (NOT array size)
    17611764                     PVOID pCreateParams,       // in: for mp2 of WM_INITDLG
    1762                      const char *pcszControlsFont) // in: font for ctls with CTL_COMMON_FONT
     1765                     PCSZ pcszControlsFont) // in: font for ctls with CTL_COMMON_FONT
    17631766{
    17641767    APIRET      arc = NO_ERROR;
     
    18401843                 */
    18411844
    1842                 Dlg2_CalcSizes(pDlgData,
    1843                                &szlClient);
    1844 
    1845                 WinSubclassWindow(hwndDlg, pfnwpDialogProc);
    1846 
    1847                 /*
    1848                  *  4) compute size of dialog client from total
    1849                  *     size of all controls
    1850                  */
    1851 
    1852                 // calculate the frame size from the client size
    1853                 rclClient.xLeft = 10;
    1854                 rclClient.yBottom = 10;
    1855                 rclClient.xRight = szlClient.cx + 2 * SPACING;
    1856                 rclClient.yTop = szlClient.cy + 2 * SPACING;
    1857                 WinCalcFrameRect(hwndDlg,
    1858                                  &rclClient,
    1859                                  FALSE);            // frame from client
    1860 
    1861                 WinSetWindowPos(hwndDlg,
    1862                                 0,
    1863                                 10,
    1864                                 10,
    1865                                 rclClient.xRight,
    1866                                 rclClient.yTop,
    1867                                 SWP_MOVE | SWP_SIZE | SWP_NOADJUST);
    1868 
    1869                 arc = Dlg3_PositionAndCreate(pDlgData,
    1870                                              &szlClient,
    1871                                              &hwndFocusItem);
    1872 
    1873                 /*
    1874                  *  7) WM_INITDLG, set focus
    1875                  *
    1876                  */
    1877 
    1878                 if (!WinSendMsg(pDlgData->hwndDlg,
    1879                                 WM_INITDLG,
    1880                                 (MPARAM)hwndFocusItem,
    1881                                 (MPARAM)pCreateParams))
     1845                if (!(arc = Dlg2_CalcSizes(pDlgData,
     1846                                           &szlClient)))
    18821847                {
    1883                     // if WM_INITDLG returns FALSE, this means
    1884                     // the dlg proc has not changed the focus;
    1885                     // we must then set the focus here
    1886                     WinSetFocus(HWND_DESKTOP, hwndFocusItem);
     1848                    WinSubclassWindow(hwndDlg, pfnwpDialogProc);
     1849
     1850                    /*
     1851                     *  4) compute size of dialog client from total
     1852                     *     size of all controls
     1853                     */
     1854
     1855                    // calculate the frame size from the client size
     1856                    rclClient.xLeft = 10;
     1857                    rclClient.yBottom = 10;
     1858                    rclClient.xRight = szlClient.cx + 2 * SPACING;
     1859                    rclClient.yTop = szlClient.cy + 2 * SPACING;
     1860                    WinCalcFrameRect(hwndDlg,
     1861                                     &rclClient,
     1862                                     FALSE);            // frame from client
     1863
     1864                    WinSetWindowPos(hwndDlg,
     1865                                    0,
     1866                                    10,
     1867                                    10,
     1868                                    rclClient.xRight,
     1869                                    rclClient.yTop,
     1870                                    SWP_MOVE | SWP_SIZE | SWP_NOADJUST);
     1871
     1872                    arc = Dlg3_PositionAndCreate(pDlgData,
     1873                                                 &szlClient,
     1874                                                 &hwndFocusItem);
     1875
     1876                    /*
     1877                     *  7) WM_INITDLG, set focus
     1878                     *
     1879                     */
     1880
     1881                    if (!WinSendMsg(pDlgData->hwndDlg,
     1882                                    WM_INITDLG,
     1883                                    (MPARAM)hwndFocusItem,
     1884                                    (MPARAM)pCreateParams))
     1885                    {
     1886                        // if WM_INITDLG returns FALSE, this means
     1887                        // the dlg proc has not changed the focus;
     1888                        // we must then set the focus here
     1889                        WinSetFocus(HWND_DESKTOP, hwndFocusItem);
     1890                    }
    18871891                }
    18881892            }
     
    19531957
    19541958APIRET dlghFormatDlg(HWND hwndDlg,              // in: dialog frame to work on
    1955                      PDLGHITEM paDlgItems,      // in: definition array
     1959                     PCDLGHITEM paDlgItems,      // in: definition array
    19561960                     ULONG cDlgItems,           // in: array item count (NOT array size)
    1957                      const char *pcszControlsFont, // in: font for ctls with CTL_COMMON_FONT
     1961                     PCSZ pcszControlsFont, // in: font for ctls with CTL_COMMON_FONT
    19581962                     ULONG flFlags)             // in: DFFL_* flags
    19591963{
     
    22092213
    22102214APIRET dlghAppendToArray(PDLGARRAY pArray,      // in: dialog array created by dlghCreateArray
    2211                          DLGHITEM *paItems,     // in: subarray to be appended
     2215                         PCDLGHITEM paItems,     // in: subarray to be appended
    22122216                         ULONG cItems)          // in: subarray item count (NOT array size)
    22132217{
     
    22502254                            HWND hwndOwner,
    22512255                            HPOINTER hptrIcon,
    2252                             const char *pcszTitle,
    2253                             const char *pcszMessage,
     2256                            PCSZ pcszTitle,
     2257                            PCSZ pcszMessage,
    22542258                            ULONG flFlags,
    2255                             const char *pcszFont,
     2259                            PCSZ pcszFont,
    22562260                            const MSGBOXSTRINGS *pStrings,
    22572261                            PULONG pulAlarmFlag)      // out: alarm sound to be played
     
    23342338                *p2 = NULL;
    23352339
    2336     Icon.pcszText = (const char *)hptrIcon;
     2340    Icon.pcszText = (PCSZ)hptrIcon;
    23372341    InfoText.pcszText = pcszMessage;
    23382342
     
    25452549ULONG dlghMessageBox(HWND hwndOwner,            // in: owner for msg box
    25462550                     HPOINTER hptrIcon,         // in: icon to display
    2547                      const char *pcszTitle,     // in: title
    2548                      const char *pcszMessage,   // in: message
     2551                     PCSZ pcszTitle,     // in: title
     2552                     PCSZ pcszMessage,   // in: message
    25492553                     ULONG flFlags,             // in: standard message box flags
    2550                      const char *pcszFont,      // in: font (e.g. "9.WarpSans")
     2554                     PCSZ pcszFont,      // in: font (e.g. "9.WarpSans")
    25512555                     const MSGBOXSTRINGS *pStrings) // in: strings array
    25522556{
     
    26162620
    26172621PSZ dlghTextEntryBox(HWND hwndOwner,
    2618                      const char *pcszTitle,          // in: dlg title
    2619                      const char *pcszDescription,    // in: descriptive text above entry field
    2620                      const char *pcszDefault,        // in: default text for entry field or NULL
    2621                      const char *pcszOK,             // in: "OK" string
    2622                      const char *pcszCancel,         // in: "Cancel" string
     2622                     PCSZ pcszTitle,          // in: dlg title
     2623                     PCSZ pcszDescription,    // in: descriptive text above entry field
     2624                     PCSZ pcszDefault,        // in: default text for entry field or NULL
     2625                     PCSZ pcszOK,             // in: "OK" string
     2626                     PCSZ pcszCancel,         // in: "Cancel" string
    26232627                     ULONG ulMaxLen,                 // in: maximum length for entry
    26242628                     ULONG fl,                       // in: TEBF_* flags
    2625                      const char *pcszFont)           // in: font (e.g. "9.WarpSans")
     2629                     PCSZ pcszFont)           // in: font (e.g. "9.WarpSans")
    26262630{
    26272631    CONTROLDEF
Note: See TracChangeset for help on using the changeset viewer.