Changeset 132 for trunk/src/helpers/dialog.c
- Timestamp:
- Jan 19, 2002, 11:50:39 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dialog.c
r123 r132 234 234 { 235 235 LONG lPointSize = 0; 236 const char *pcszFontThis = pControlDef->pcszFont;236 PCSZ pcszFontThis = pControlDef->pcszFont; 237 237 // can be NULL, 238 238 // or CTL_COMMON_FONT … … 1240 1240 1241 1241 APIRET Dlg1_ParseTables(PDLGPRIVATE pDlgData, 1242 P DLGHITEM paDlgItems, // in: definition array1242 PCDLGHITEM paDlgItems, // in: definition array 1243 1243 ULONG cDlgItems) // in: array item count (NOT array size) 1244 1244 { … … 1256 1256 ul++) 1257 1257 { 1258 P DLGHITEM pItemThis = &paDlgItems[ul];1258 PCDLGHITEM pItemThis = &paDlgItems[ul]; 1259 1259 1260 1260 switch (pItemThis->Type) … … 1584 1584 * it produces a static group control around the table. 1585 1585 * Useful for group boxes. pDef must point to a 1586 * _CONTROLDEF describing the control to be used for1586 * CONTROLDEF describing the control to be used for 1587 1587 * the group (usually a WC_STATIC with SS_GROUP style), 1588 1588 * whose size parameter is ignored. … … 1602 1602 * pDef must point to a CONTROLDEF structure. 1603 1603 * 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. 1615 1616 * 1616 1617 * Unless separated with START_ROW items, subsequent … … 1621 1622 * an error: 1622 1623 * 1623 * -- The entire array must be enclosed in a table1624 * (the "root" table).1625 * 1626 * -- After START_TABLE or START_GROUP_TABLE, there must1627 * 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. 1628 1629 * 1629 1630 * To create a dialog, set up arrays like the following: … … 1686 1687 + º ³ ³ ³ ³ º 1687 1688 + º ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ º 1689 + º ³ ³ º 1688 1690 + º ³ Static below cnr (3) ³ º 1689 1691 + º ³ ³ º 1690 1692 + º ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ º 1693 + º º 1691 1694 + º ÚÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ º 1692 1695 + º ³ OK (4) ³ ³ Cancel (5) ³ º … … 1756 1759 ULONG flCreateFlags, // in: standard FCF_* frame flags 1757 1760 PFNWP pfnwpDialogProc, 1758 const char *pcszDlgTitle,1759 P DLGHITEM paDlgItems, // in: definition array1761 PCSZ pcszDlgTitle, 1762 PCDLGHITEM paDlgItems, // in: definition array 1760 1763 ULONG cDlgItems, // in: array item count (NOT array size) 1761 1764 PVOID pCreateParams, // in: for mp2 of WM_INITDLG 1762 const char *pcszControlsFont) // in: font for ctls with CTL_COMMON_FONT1765 PCSZ pcszControlsFont) // in: font for ctls with CTL_COMMON_FONT 1763 1766 { 1764 1767 APIRET arc = NO_ERROR; … … 1840 1843 */ 1841 1844 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))) 1882 1847 { 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 } 1887 1891 } 1888 1892 } … … 1953 1957 1954 1958 APIRET dlghFormatDlg(HWND hwndDlg, // in: dialog frame to work on 1955 P DLGHITEM paDlgItems, // in: definition array1959 PCDLGHITEM paDlgItems, // in: definition array 1956 1960 ULONG cDlgItems, // in: array item count (NOT array size) 1957 const char *pcszControlsFont, // in: font for ctls with CTL_COMMON_FONT1961 PCSZ pcszControlsFont, // in: font for ctls with CTL_COMMON_FONT 1958 1962 ULONG flFlags) // in: DFFL_* flags 1959 1963 { … … 2209 2213 2210 2214 APIRET dlghAppendToArray(PDLGARRAY pArray, // in: dialog array created by dlghCreateArray 2211 DLGHITEM *paItems, // in: subarray to be appended2215 PCDLGHITEM paItems, // in: subarray to be appended 2212 2216 ULONG cItems) // in: subarray item count (NOT array size) 2213 2217 { … … 2250 2254 HWND hwndOwner, 2251 2255 HPOINTER hptrIcon, 2252 const char *pcszTitle,2253 const char *pcszMessage,2256 PCSZ pcszTitle, 2257 PCSZ pcszMessage, 2254 2258 ULONG flFlags, 2255 const char *pcszFont,2259 PCSZ pcszFont, 2256 2260 const MSGBOXSTRINGS *pStrings, 2257 2261 PULONG pulAlarmFlag) // out: alarm sound to be played … … 2334 2338 *p2 = NULL; 2335 2339 2336 Icon.pcszText = ( const char *)hptrIcon;2340 Icon.pcszText = (PCSZ)hptrIcon; 2337 2341 InfoText.pcszText = pcszMessage; 2338 2342 … … 2545 2549 ULONG dlghMessageBox(HWND hwndOwner, // in: owner for msg box 2546 2550 HPOINTER hptrIcon, // in: icon to display 2547 const char *pcszTitle, // in: title2548 const char *pcszMessage, // in: message2551 PCSZ pcszTitle, // in: title 2552 PCSZ pcszMessage, // in: message 2549 2553 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") 2551 2555 const MSGBOXSTRINGS *pStrings) // in: strings array 2552 2556 { … … 2616 2620 2617 2621 PSZ dlghTextEntryBox(HWND hwndOwner, 2618 const char *pcszTitle, // in: dlg title2619 const char *pcszDescription, // in: descriptive text above entry field2620 const char *pcszDefault, // in: default text for entry field or NULL2621 const char *pcszOK, // in: "OK" string2622 const char *pcszCancel, // in: "Cancel" string2622 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 2623 2627 ULONG ulMaxLen, // in: maximum length for entry 2624 2628 ULONG fl, // in: TEBF_* flags 2625 const char *pcszFont) // in: font (e.g. "9.WarpSans")2629 PCSZ pcszFont) // in: font (e.g. "9.WarpSans") 2626 2630 { 2627 2631 CONTROLDEF
Note:
See TracChangeset
for help on using the changeset viewer.