Ignore:
Timestamp:
Apr 17, 2002, 10:11:38 PM (23 years ago)
Author:
umoeller
Message:

Patches from Martin and Paul, plus regexp support.

File:
1 edited

Legend:

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

    r154 r155  
    25632563
    25642564/*
     2565 *@@ winhPlaceBesides:
     2566 *      attempts to place hwnd somewhere besides
     2567 *      hwndRelative.
     2568 *
     2569 *      fl is presently ignored, but should be
     2570 *      PLF_SMART for future extensions.
     2571 *
     2572 *      Works only if hwnd is a desktop child.
     2573 *
     2574 *@@added V0.9.19 (2002-04-17) [umoeller]
     2575 */
     2576
     2577BOOL winhPlaceBesides(HWND hwnd,
     2578                      HWND hwndRelative,
     2579                      ULONG fl)
     2580{
     2581    BOOL brc = FALSE;
     2582
     2583    SWP     swpRel,
     2584            swpThis;
     2585    LONG    xNew, yNew;
     2586
     2587    if (    (WinQueryWindowPos(hwndRelative, &swpRel))
     2588         && (WinQueryWindowPos(hwnd, &swpThis))
     2589       )
     2590    {
     2591        HWND    hwndRelParent,
     2592                hwndThisParent;
     2593        POINTL  ptlRel = {swpRel.x, swpRel.y};
     2594        if (    (hwndRelParent = WinQueryWindow(hwndRelative, QW_PARENT))
     2595             && (hwndThisParent = WinQueryWindow(hwnd, QW_PARENT))
     2596             && (hwndRelParent != hwndThisParent)
     2597           )
     2598        {
     2599            WinMapWindowPoints(hwndRelParent,
     2600                               hwndThisParent,
     2601                               &ptlRel,
     2602                               1);
     2603        }
     2604
     2605        // place right first
     2606        xNew = ptlRel.x + swpRel.cx;
     2607        // center vertically
     2608        yNew = ptlRel.y  + ((swpRel.cy - swpThis.cy) / 2);
     2609
     2610        if (xNew + swpThis.cy > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
     2611        {
     2612            // place left then
     2613            xNew = ptlRel.x - swpThis.cx;
     2614
     2615            if (xNew < 0)
     2616            {
     2617                // center then
     2618                winhCenterWindow(hwnd);
     2619                brc = TRUE;
     2620            }
     2621        }
     2622
     2623        if (!brc)
     2624            brc = WinSetWindowPos(hwnd,
     2625                                  0,
     2626                                  xNew,
     2627                                  yNew,
     2628                                  0,
     2629                                  0,
     2630                                  SWP_MOVE);
     2631    }
     2632
     2633    return brc;
     2634}
     2635
     2636/*
    25652637 *@@ winhFindWindowBelow:
    25662638 *      finds the window with the same parent
Note: See TracChangeset for help on using the changeset viewer.