Ignore:
Timestamp:
Mar 6, 2002, 6:34:48 PM (23 years ago)
Author:
umoeller
Message:

misc fixes

File:
1 edited

Legend:

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

    r142 r146  
    109109    POINTL      ptlTotalOfs;
    110110
    111     LINKLIST    llControls;     // linked list of all PCOLUMNDEF structs,
    112                                  // in the order in which windows were
    113                                  // created
     111    PLINKLIST   pllControls;            // linked list of HWNDs in the order
     112                                        // in which controls were created;
     113                                        // ptr can be NULL
    114114
    115115    PCSZ        pcszControlsFont;  // from dlghCreateDlg
     
    910910                                      pcszFont);
    911911
    912             lstAppendItem(&pDlgData->llControls,
    913                           pColumnDef);
     912            // append window that was created
     913            // V0.9.18 (2002-03-03) [umoeller]
     914            if (pDlgData->pllControls)
     915                lstAppendItem(pDlgData->pllControls,
     916                              (PVOID)pColumnDef->hwndControl);
    914917
    915918            // if this is the first control with WS_TABSTOP,
     
    14551458 *
    14561459 *@@added V0.9.15 (2001-08-26) [umoeller]
     1460 *@@changed V0.9.18 (2002-03-03) [umoeller]: aded pllWindows
    14571461 */
    14581462
    14591463static APIRET Dlg0_Init(PDLGPRIVATE *ppDlgData,
    1460                         PCSZ pcszControlsFont)
     1464                        PCSZ pcszControlsFont,
     1465                        PLINKLIST pllControls)
    14611466{
    14621467    PDLGPRIVATE pDlgData;
     
    14651470    ZERO(pDlgData);
    14661471    lstInit(&pDlgData->llTables, FALSE);
    1467     lstInit(&pDlgData->llControls, FALSE);
     1472
     1473    if (pllControls)
     1474        pDlgData->pllControls = pllControls;
    14681475
    14691476    pDlgData->pcszControlsFont = pcszControlsFont;
     
    17561763
    17571764        lstClear(&pDlgData->llTables);
    1758         lstClear(&pDlgData->llControls);
    17591765
    17601766        free(pDlgData);
     
    20402046
    20412047    if (!(arc = Dlg0_Init(&pDlgData,
    2042                           pcszControlsFont)))
     2048                          pcszControlsFont,
     2049                          NULL)))
    20432050    {
    20442051        if (!(arc = Dlg1_ParseTables(pDlgData,
     
    22042211 *          except that the frame is already created.
    22052212 *
    2206  *      --  DFFL_RESIZEFRAME: hwndDlg should be resized so
    2207  *          that it will properly surround the controls.
    2208  *
    2209  *          This can only be used in conjunction with
    2210  *          DFFL_RESIZEFRAME.
     2213 *      If pszlClient is specified, it receives the required
     2214 *      size of the client to surround all controls properly.
     2215 *      You can then use dlghResizeFrame to resize the frame
     2216 *      with a bit of spacing, if desired.
    22112217 *
    22122218 *@@added V0.9.16 (2001-09-29) [umoeller]
     2219 *@@changed V0.9.18 (2002-03-03) [umoeller]: added pszlClient, fixed output
    22132220 */
    22142221
     
    22172224                     ULONG cDlgItems,           // in: array item count (NOT array size)
    22182225                     PCSZ pcszControlsFont, // in: font for ctls with CTL_COMMON_FONT
    2219                      ULONG flFlags)             // in: DFFL_* flags
     2226                     ULONG flFlags,             // in: DFFL_* flags
     2227                     PSIZEL pszlClient,         // out: size of all controls (ptr can be NULL)
     2228                     PVOID *ppllControls)   // out: new LINKLIST receiving HWNDs of created controls (ptr can be NULL)
    22202229{
    22212230    APIRET      arc = NO_ERROR;
     
    22242233
    22252234    PDLGPRIVATE  pDlgData = NULL;
     2235    PLINKLIST   pllControls = NULL;
    22262236
    22272237    /*
     
    22302240     */
    22312241
     2242    if (ppllControls)
     2243        pllControls = *(PLINKLIST*)ppllControls = lstCreate(FALSE);
     2244
    22322245    if (!(arc = Dlg0_Init(&pDlgData,
    2233                           pcszControlsFont)))
     2246                          pcszControlsFont,
     2247                          pllControls)))
    22342248    {
    22352249        if (!(arc = Dlg1_ParseTables(pDlgData,
     
    22372251                                     cDlgItems)))
    22382252        {
     2253            HWND hwndFocusItem;
     2254
    22392255            /*
    22402256             *  2) create empty dialog frame
     
    22422258             */
    22432259
    2244             HWND    hwndFocusItem = NULLHANDLE;
    2245             SIZEL   szlClient = {0};
    2246             RECTL   rclClient;
    2247 
    22482260            pDlgData->hwndDlg = hwndDlg;
    22492261
     
    22552267            Dlg2_CalcSizes(pDlgData);
    22562268
    2257             // WinSubclassWindow(hwndDlg, pfnwpDialogProc);
    2258 
    2259             /*
    2260              *  4) compute size of dialog client from total
    2261              *     size of all controls
    2262              */
    2263 
    2264             if (flFlags & DFFL_RESIZEFRAME)
     2269            if (pszlClient)
    22652270            {
    2266                 // calculate the frame size from the client size
    2267                 rclClient.xLeft = 10;
    2268                 rclClient.yBottom = 10;
    2269                 rclClient.xRight = szlClient.cx + 2 * SPACING;
    2270                 rclClient.yTop = szlClient.cy + 2 * SPACING;
    2271                 WinCalcFrameRect(hwndDlg,
    2272                                  &rclClient,
    2273                                  FALSE);            // frame from client
    2274 
    2275                 WinSetWindowPos(hwndDlg,
    2276                                 0,
    2277                                 10,
    2278                                 10,
    2279                                 rclClient.xRight,
    2280                                 rclClient.yTop,
    2281                                 SWP_MOVE | SWP_SIZE | SWP_NOADJUST);
     2271                pszlClient->cx = pDlgData->szlClient.cx + 2 * SPACING;
     2272                pszlClient->cy = pDlgData->szlClient.cy + 2 * SPACING;
    22822273            }
    22832274
     
    23032294
    23042295    return (arc);
     2296}
     2297
     2298/*
     2299 *@@ dlghResizeFrame:
     2300 *
     2301 *@@added V0.9.18 (2002-03-03) [umoeller]
     2302 */
     2303
     2304VOID dlghResizeFrame(HWND hwndDlg,
     2305                     PSIZEL pszlClient)
     2306{
     2307    // calculate the frame size from the client size
     2308    RECTL   rclClient;
     2309    rclClient.xLeft = 10;
     2310    rclClient.yBottom = 10;
     2311    rclClient.xRight = pszlClient->cx;
     2312    rclClient.yTop = pszlClient->cy;
     2313    WinCalcFrameRect(hwndDlg,
     2314                     &rclClient,
     2315                     FALSE);            // frame from client
     2316
     2317    WinSetWindowPos(hwndDlg,
     2318                    0,
     2319                    10,
     2320                    10,
     2321                    rclClient.xRight,
     2322                    rclClient.yTop,
     2323                    SWP_MOVE | SWP_SIZE | SWP_NOADJUST);
    23052324}
    23062325
Note: See TracChangeset for help on using the changeset viewer.