Ignore:
Timestamp:
Aug 7, 2001, 11:34:30 PM (24 years ago)
Author:
umoeller
Message:

Lafaix and Ratcliffe updates.

File:
1 edited

Legend:

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

    r91 r95  
    218218#define PM_GROUP_SPACING_TOP        20
    219219
    220 VOID ProcessTable(PTABLEDEF pTableDef,
    221                   const CONTROLPOS *pcpTable,
    222                   PROCESSMODE ProcessMode,
    223                   PDLGPRIVATE pDlgData);
     220APIRET ProcessTable(PTABLEDEF pTableDef,
     221                    const CONTROLPOS *pcpTable,
     222                    PROCESSMODE ProcessMode,
     223                    PDLGPRIVATE pDlgData);
    224224
    225225/*
     
    436436 */
    437437
    438 VOID ProcessColumn(PCOLUMNDEF pColumnDef,
    439                    PROWDEF pOwningRow,          // in: current row from ProcessRow
    440                    PROCESSMODE ProcessMode,     // in: processing mode (see ProcessAll)
    441                    PLONG plX,                   // in/out: PROCESS_CALC_POSITIONS only
    442                    PDLGPRIVATE pDlgData)
    443 {
     438APIRET ProcessColumn(PCOLUMNDEF pColumnDef,
     439                     PROWDEF pOwningRow,          // in: current row from ProcessRow
     440                     PROCESSMODE ProcessMode,     // in: processing mode (see ProcessAll)
     441                     PLONG plX,                   // in/out: PROCESS_CALC_POSITIONS only
     442                     PDLGPRIVATE pDlgData)
     443{
     444    APIRET arc = NO_ERROR;
     445
    444446    pColumnDef->pOwningRow = pOwningRow;
    445447
     
    604606
    605607                // recurse!!
    606                 ProcessTable(pTableDef,
    607                              NULL,
    608                              ProcessMode,
    609                              pDlgData);
    610 
    611                 // should we create a PM control around the table?
    612                 // (do this AFTER the other controls from recursing,
    613                 // otherwise the stupid container doesn't show up)
    614                 if (pTableDef->pCtlDef)
     608                if (!(arc = ProcessTable(pTableDef,
     609                                         NULL,
     610                                         ProcessMode,
     611                                         pDlgData)))
    615612                {
    616                     // yes:
    617                     pcp  = &pColumnDef->cpColumn;  // !! not control
    618                     pControlDef = pTableDef->pCtlDef;
    619                     pcszTitle = pControlDef->pcszText;
    620                     flStyle = pControlDef->flStyle;
     613                    // should we create a PM control around the table?
     614                    // (do this AFTER the other controls from recursing,
     615                    // otherwise the stupid container doesn't show up)
     616                    if (pTableDef->pCtlDef)
     617                    {
     618                        // yes:
     619                        pcp  = &pColumnDef->cpColumn;  // !! not control
     620                        pControlDef = pTableDef->pCtlDef;
     621                        pcszTitle = pControlDef->pcszText;
     622                        flStyle = pControlDef->flStyle;
     623                    }
    621624                }
     625                else
     626                    break;
    622627            }
    623628            else
     
    662667                                       (PVOID)pcszFont); */
    663668
    664                 pColumnDef->hwndControl
     669                if (pColumnDef->hwndControl
    665670                    = WinCreateWindow(pDlgData->hwndDlg,   // parent
    666671                                      (PSZ)pControlDef->pcszClass,
     
    677682                                      pControlDef->usID,
    678683                                      pControlDef->pvCtlData,
    679                                       NULL); // ppp);
    680 
    681                 if ((pColumnDef->hwndControl) && (lHandleSet))
     684                                      NULL))
    682685                {
    683                     // subclass the damn static
    684                     if ((flOld & 0x0F) == SS_ICON)
    685                         // this was a static:
    686                         ctlPrepareStaticIcon(pColumnDef->hwndControl,
    687                                              1);
     686                    if (lHandleSet)
     687                    {
     688                        // subclass the damn static
     689                        if ((flOld & 0x0F) == SS_ICON)
     690                            // this was a static:
     691                            ctlPrepareStaticIcon(pColumnDef->hwndControl,
     692                                                 1);
     693                        else
     694                            // this was a bitmap:
     695                            ctlPrepareStretchedBitmap(pColumnDef->hwndControl,
     696                                                      TRUE);
     697
     698                        WinSendMsg(pColumnDef->hwndControl,
     699                                   SM_SETHANDLE,
     700                                   (MPARAM)lHandleSet,
     701                                   0);
     702                    }
    688703                    else
    689                         // this was a bitmap:
    690                         ctlPrepareStretchedBitmap(pColumnDef->hwndControl,
    691                                                   TRUE);
    692 
    693                     WinSendMsg(pColumnDef->hwndControl,
    694                                SM_SETHANDLE,
    695                                (MPARAM)lHandleSet,
    696                                0);
    697                 }
    698                 else
    699                     if (pcszFont)
    700                         // we must set the font explicitly here...
    701                         // doesn't always work with WinCreateWindow
    702                         // presparams parameter, for some reason
    703                         // V0.9.12 (2001-05-31) [umoeller]
    704                         winhSetWindowFont(pColumnDef->hwndControl,
    705                                           pcszFont);
    706 
    707                 if (pColumnDef->hwndControl)
    708                 {
     704                        if (pcszFont)
     705                            // we must set the font explicitly here...
     706                            // doesn't always work with WinCreateWindow
     707                            // presparams parameter, for some reason
     708                            // V0.9.12 (2001-05-31) [umoeller]
     709                            winhSetWindowFont(pColumnDef->hwndControl,
     710                                              pcszFont);
     711
    709712                    lstAppendItem(&pDlgData->llControls,
    710713                                  pColumnDef);
     
    717720                        pDlgData->hwndFirstFocus = pColumnDef->hwndControl;
    718721                }
     722                else
     723                    // V0.9.14 (2001-08-03) [umoeller]
     724                    arc = DLGERR_CANNOT_CREATE_CONTROL;
    719725            }
    720726        break; }
    721727    }
    722728
     729    return (arc);
    723730}
    724731
     
    732739 */
    733740
    734 VOID ProcessRow(PROWDEF pRowDef,
    735                 PTABLEDEF pOwningTable,     // in: current table from ProcessTable
    736                 PROCESSMODE ProcessMode,    // in: processing mode (see ProcessAll)
    737                 PLONG plY,                  // in/out: current y position (decremented)
    738                 PDLGPRIVATE pDlgData)
    739 {
    740     // ULONG   ul;
     741APIRET ProcessRow(PROWDEF pRowDef,
     742                  PTABLEDEF pOwningTable,     // in: current table from ProcessTable
     743                  PROCESSMODE ProcessMode,    // in: processing mode (see ProcessAll)
     744                  PLONG plY,                  // in/out: current y position (decremented)
     745                  PDLGPRIVATE pDlgData)
     746{
     747    APIRET  arc = NO_ERROR;
    741748    LONG    lX;
    742749    PLISTNODE pNode;
     
    767774        PCOLUMNDEF  pColumnDefThis = (PCOLUMNDEF)pNode->pItemData;
    768775
    769         ProcessColumn(pColumnDefThis, pRowDef, ProcessMode, &lX, pDlgData);
    770 
    771         if (ProcessMode == PROCESS_CALC_SIZES)
    772         {
    773             // row width = sum of all columns
    774             pRowDef->cpRow.cx += pColumnDefThis->cpColumn.cx;
    775 
    776             // row height = maximum height of a column
    777             if (pRowDef->cpRow.cy < pColumnDefThis->cpColumn.cy)
    778                 pRowDef->cpRow.cy = pColumnDefThis->cpColumn.cy;
    779         }
    780     }
     776        if (!(arc = ProcessColumn(pColumnDefThis, pRowDef, ProcessMode, &lX, pDlgData)))
     777        {
     778            if (ProcessMode == PROCESS_CALC_SIZES)
     779            {
     780                // row width = sum of all columns
     781                pRowDef->cpRow.cx += pColumnDefThis->cpColumn.cx;
     782
     783                // row height = maximum height of a column
     784                if (pRowDef->cpRow.cy < pColumnDefThis->cpColumn.cy)
     785                    pRowDef->cpRow.cy = pColumnDefThis->cpColumn.cy;
     786            }
     787        }
     788    }
     789
     790    return (arc);
    781791}
    782792
     
    802812 */
    803813
    804 VOID ProcessTable(PTABLEDEF pTableDef,
    805                   const CONTROLPOS *pcpTable,       // in: table position with PROCESS_CALC_POSITIONS
    806                   PROCESSMODE ProcessMode,          // in: processing mode (see ProcessAll)
    807                   PDLGPRIVATE pDlgData)
    808 {
    809     // ULONG   ul;
     814APIRET ProcessTable(PTABLEDEF pTableDef,
     815                    const CONTROLPOS *pcpTable,       // in: table position with PROCESS_CALC_POSITIONS
     816                    PROCESSMODE ProcessMode,          // in: processing mode (see ProcessAll)
     817                    PDLGPRIVATE pDlgData)
     818{
     819    APIRET  arc = NO_ERROR;
    810820    LONG    lY;
    811821    PLISTNODE pNode;
     
    829839        PROWDEF pRowDefThis = (PROWDEF)pNode->pItemData;
    830840
    831         ProcessRow(pRowDefThis, pTableDef, ProcessMode, &lY, pDlgData);
    832 
    833         if (ProcessMode == PROCESS_CALC_SIZES)
    834         {
    835             // table width = maximum width of a row
    836             if (pTableDef->cpTable.cx < pRowDefThis->cpRow.cx)
    837                 pTableDef->cpTable.cx = pRowDefThis->cpRow.cx;
    838 
    839             // table height = sum of all rows
    840             pTableDef->cpTable.cy += pRowDefThis->cpRow.cy;
    841         }
    842     }
     841        if (!(arc = ProcessRow(pRowDefThis, pTableDef, ProcessMode, &lY, pDlgData)))
     842        {
     843            if (ProcessMode == PROCESS_CALC_SIZES)
     844            {
     845                // table width = maximum width of a row
     846                if (pTableDef->cpTable.cx < pRowDefThis->cpRow.cx)
     847                    pTableDef->cpTable.cx = pRowDefThis->cpRow.cx;
     848
     849                // table height = sum of all rows
     850                pTableDef->cpTable.cy += pRowDefThis->cpRow.cy;
     851            }
     852        }
     853        else
     854            break;
     855    }
     856
     857    return (arc);
    843858}
    844859
     
    876891 */
    877892
    878 VOID ProcessAll(PDLGPRIVATE pDlgData,
    879                 PSIZEL pszlClient,
    880                 PROCESSMODE ProcessMode)
    881 {
    882     // ULONG ul;
     893APIRET ProcessAll(PDLGPRIVATE pDlgData,
     894                  PSIZEL pszlClient,
     895                  PROCESSMODE ProcessMode)
     896{
     897    APIRET arc = NO_ERROR;
    883898    PLISTNODE pNode;
    884899    CONTROLPOS cpTable;
     
    908923        }
    909924
    910         ProcessTable(pTableDefThis,
    911                      &cpTable,      // start pos
    912                      ProcessMode,
    913                      pDlgData);
    914 
    915         if (ProcessMode == PROCESS_CALC_SIZES)
    916         {
    917             pszlClient->cx += pTableDefThis->cpTable.cx;
    918             pszlClient->cy += pTableDefThis->cpTable.cy;
    919         }
    920     }
     925        if (!(arc = ProcessTable(pTableDefThis,
     926                                 &cpTable,      // start pos
     927                                 ProcessMode,
     928                                 pDlgData)))
     929        {
     930            if (ProcessMode == PROCESS_CALC_SIZES)
     931            {
     932                pszlClient->cx += pTableDefThis->cpTable.cx;
     933                pszlClient->cy += pTableDefThis->cpTable.cy;
     934            }
     935        }
     936    }
     937
     938    return (arc);
    921939}
    922940
Note: See TracChangeset for help on using the changeset viewer.