Ignore:
Timestamp:
Apr 25, 2002, 7:25:16 PM (23 years ago)
Author:
umoeller
Message:

Lots of dialog rework, plus other fixes.

File:
1 edited

Legend:

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

    r158 r159  
    40314031 *      controls which should be moved such an ID.
    40324032 *
    4033  *      You can also specify how many dialog units
    4034  *      all the other controls will be moved downward in
    4035  *      ulDownUnits; this is useful to fill up the space
    4036  *      which was used by the buttons before moving them.
    4037  *      Returns TRUE if anything was changed.
     4033 *      Note that this function will now automatically
     4034 *      find out the lowest y coordinate that was used
     4035 *      for a non-notebook button and move all controls
     4036 *      down accordingly. As a result, ulDownUnit must
     4037 *      no longer be specified (V0.9.19).
    40384038 *
    40394039 *      This function is useful if you wish to create
     
    40444044 *
    40454045 *@@changed V0.9.16 (2002-02-02) [umoeller]: fixed entry fields
     4046 *@@changed V0.9.19 (2002-04-24) [umoeller]: removed ulDownUnits
    40464047 */
    40474048
    40484049BOOL winhAssertWarp4Notebook(HWND hwndDlg,
    4049                              USHORT usIdThreshold,    // in: ID threshold
    4050                              ULONG ulDownUnits)       // in: dialog units or 0
     4050                             USHORT usIdThreshold)  // in: ID threshold
    40514051{
    40524052    BOOL brc = FALSE;
     
    40544054    if (doshIsWarp4())
    40554055    {
    4056         POINTL ptl;
    4057         HWND hwndItem;
    4058         HENUM henum = 0;
    4059 
    4060         BOOL    fIsVisible = WinIsWindowVisible(hwndDlg);
    4061         if (ulDownUnits)
     4056        LONG    yLowest = 10000;
     4057        HWND    hwndItem;
     4058        HENUM   henum = 0;
     4059        PSWP    paswp,
     4060                pswpThis;
     4061        ULONG   cWindows = 0,
     4062                ul;
     4063
     4064        BOOL    fIsVisible;
     4065
     4066        if (fIsVisible = WinIsWindowVisible(hwndDlg))
     4067            // avoid flicker
     4068            WinEnableWindowUpdate(hwndDlg, FALSE);
     4069
     4070        if (paswp = (PSWP)malloc(sizeof(SWP) * 100))
    40624071        {
    4063             ptl.x = 0;
    4064             ptl.y = ulDownUnits;
    4065             WinMapDlgPoints(hwndDlg, &ptl, 1, TRUE);
    4066         }
    4067 
    4068         if (fIsVisible)
    4069             WinEnableWindowUpdate(hwndDlg, FALSE);
    4070 
    4071         henum = WinBeginEnumWindows(hwndDlg);
    4072         while ((hwndItem = WinGetNextWindow(henum)))
    4073         {
    4074             USHORT usId = WinQueryWindowUShort(hwndItem, QWS_ID);
    4075             // _Pmpf(("hwndItem: 0x%lX, ID: 0x%lX", hwndItem, usId));
    4076             if (usId <= usIdThreshold)
     4072            pswpThis = paswp;
     4073
     4074            // loop 1: set notebook buttons, find lowest y used
     4075            henum = WinBeginEnumWindows(hwndDlg);
     4076            while ((hwndItem = WinGetNextWindow(henum)))
    40774077            {
    4078                 // pushbutton to change:
    4079                 // _Pmpf(("  Setting bit"));
    4080                 WinSetWindowBits(hwndItem,
    4081                                  QWL_STYLE,
    4082                                  BS_NOTEBOOKBUTTON, BS_NOTEBOOKBUTTON);
    4083                 brc = TRUE;
    4084             }
    4085             else
    4086                 // no pushbutton to change: move downwards
    4087                 // if desired
    4088                 if (ulDownUnits)
     4078                USHORT usId = WinQueryWindowUShort(hwndItem, QWS_ID);
     4079                // _Pmpf(("hwndItem: 0x%lX, ID: 0x%lX", hwndItem, usId));
     4080                if (usId <= usIdThreshold)
    40894081                {
     4082                    // pushbutton to change:
     4083                    WinSetWindowBits(hwndItem,
     4084                                     QWL_STYLE,
     4085                                     BS_NOTEBOOKBUTTON, BS_NOTEBOOKBUTTON);
     4086                    brc = TRUE;
     4087                }
     4088                else
     4089                {
     4090                    // no pushbutton to change:
    40904091                    CHAR szClass[10];
    4091                     SWP swp;
    4092                     LONG lDeltaX = 0,
    4093                          lDeltaY = 0;
     4092
     4093                    // check lowest y
     4094                    WinQueryWindowPos(hwndItem, pswpThis);
     4095                    if (pswpThis->y < yLowest)
     4096                        yLowest = pswpThis->y ;
     4097
    40944098                    // special handling for entry fields
    40954099                    // V0.9.16 (2002-02-02) [umoeller]
     
    40974101                    if (!strcmp(szClass, "#6"))
    40984102                    {
    4099                         lDeltaX = 3 * WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER);
    4100                         lDeltaY = 3 * WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);
     4103                        pswpThis->x += 3 * WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER);
     4104                        pswpThis->y += 3 * WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);
    41014105                    }
    41024106
    4103                     WinQueryWindowPos(hwndItem, &swp);
    4104                     WinSetWindowPos(hwndItem, 0,
    4105                                     swp.x + lDeltaX,
    4106                                     swp.y - ptl.y + lDeltaY,
    4107                                     0, 0,
    4108                                     SWP_MOVE);
     4107                    ++pswpThis;
     4108                    if (++cWindows == 100)
     4109                        break;
    41094110                }
     4111            } // end while ((hwndItem = WinGetNextWindow(henum)))
     4112            WinEndEnumWindows(henum);
     4113
     4114            // now adjust window positions
     4115            pswpThis = paswp;
     4116            for (ul = 0;
     4117                 ul < cWindows;
     4118                 ++ul, ++pswpThis)
     4119            {
     4120                pswpThis->y -= (yLowest - 8);
     4121                            // 8 is magic to match the lower border of the
     4122                            // standard WPS notebook pages V0.9.19 (2002-04-24) [umoeller]
     4123                pswpThis->fl = SWP_MOVE;
     4124            }
     4125
     4126            WinSetMultWindowPos(WinQueryAnchorBlock(hwndDlg),
     4127                                paswp,
     4128                                cWindows);
     4129
     4130            free(paswp);
    41104131        }
    4111         WinEndEnumWindows(henum);
    41124132
    41134133        if (fIsVisible)
Note: See TracChangeset for help on using the changeset viewer.