Ignore:
Timestamp:
May 8, 2002, 1:26:30 PM (23 years ago)
Author:
sandervl
Message:

merge with latest Wine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/pager.c

    r6705 r8382  
    33 *
    44 * Copyright 1998, 1999 Eric Kohl
     5 *
     6 * This library is free software; you can redistribute it and/or
     7 * modify it under the terms of the GNU Lesser General Public
     8 * License as published by the Free Software Foundation; either
     9 * version 2.1 of the License, or (at your option) any later version.
     10 *
     11 * This library is distributed in the hope that it will be useful,
     12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14 * Lesser General Public License for more details.
     15 *
     16 * You should have received a copy of the GNU Lesser General Public
     17 * License along with this library; if not, write to the Free Software
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    519 *
    620 * NOTES
     
    1832#include "winbase.h"
    1933#include "commctrl.h"
    20 #include "debugtools.h"
    21 
    22 DEFAULT_DEBUG_CHANNEL(pager);
    23 
    24 #ifdef __WIN32OS2__
    25 #include "ccbase.h"
    26 #undef inline
    27 #define inline
    28 #endif
     34#include "wine/debug.h"
     35
     36WINE_DEFAULT_DEBUG_CHANNEL(pager);
    2937
    3038typedef struct
    3139{
    32 #ifdef __WIN32OS2__
    33     COMCTL32_HEADER header;
    34 #endif
    3540    HWND   hwndChild;  /* handle of the contained wnd */
    3641    BOOL   bNoResize;  /* set when created with CCS_NORESIZE */
     
    594599}
    595600
     601/******************************************************************
     602 * For the PGM_RECALCSIZE message (but not the other uses in      *
     603 * this module), the native control does only the following:      *
     604 *                                                                *
     605 *    if (some condition)                                         *
     606 *          PostMessageA(hwnd, EM_FMTLINES, 0, 0);                *
     607 *    return DefWindowProcA(hwnd, PGM_RECALCSIZE, 0, 0);          *
     608 *                                                                *
     609 * When we figure out what the "some condition" is we will        *
     610 * implement that for the message processing.                     *
     611 ******************************************************************/
     612
    596613static LRESULT
    597614PAGER_RecalcSize(HWND hwnd)
     
    630647    TRACE("[%04x] %06lx\n", hwnd, infoPtr->clrBk);
    631648
    632     PAGER_RecalcSize(hwnd);
    633     SendMessageA(hwnd, WM_NCPAINT, (WPARAM)0, (LPARAM)0);
     649    /* the native control seems to do things this way */
     650    SetWindowPos(hwnd, 0,0,0,0,0,
     651                 SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE |
     652                 SWP_NOZORDER | SWP_NOACTIVATE);
     653
     654    RedrawWindow(hwnd, 0, 0, RDW_ERASE | RDW_INVALIDATE);
    634655
    635656    return (LRESULT)clrTemp;
     
    757778
    758779static LRESULT
     780PAGER_FmtLines(HWND hwnd)
     781{
     782    PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
     783
     784    /* initiate NCCalcSize to resize client wnd and get size */
     785    SetWindowPos(hwnd, 0, 0,0,0,0,
     786                 SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE |
     787                 SWP_NOZORDER | SWP_NOACTIVATE);
     788
     789    SetWindowPos(infoPtr->hwndChild, 0,
     790                 0,0,infoPtr->nWidth,infoPtr->nHeight,
     791                 0);
     792
     793    return DefWindowProcA (hwnd, EM_FMTLINES, 0, 0);
     794}
     795
     796static LRESULT
    759797PAGER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
    760798{
     
    763801
    764802    /* allocate memory for info structure */
    765 #ifdef __WIN32OS2__
    766     infoPtr =(PAGER_INFO*)initControl(hwnd,sizeof(PAGER_INFO));
    767 #else
    768803    infoPtr = (PAGER_INFO *)COMCTL32_Alloc (sizeof(PAGER_INFO));
    769 #endif
    770804    SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
    771805
     
    820854    RECT rcChildw, rcmyw, wnrc, lbrc, rbrc;
    821855    POINT cursor;
     856    BOOL resizeClient = FALSE;
     857    BOOL repaintBtns = FALSE;
     858    INT scrollRange;
    822859
    823860    /*
     
    830867    DefWindowProcA (hwnd, WM_NCCALCSIZE, wParam, lParam);
    831868
     869    TRACE("orig rect=(%d,%d)-(%d,%d)\n",
     870          lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
     871
    832872    if (PAGER_IsHorizontal(hwnd))
    833873    {
     
    838878        GetCursorPos (&cursor);
    839879        GetWindowRect (hwnd, &rcmyw);
     880
     881        /* Reset buttons and hide any grey ones */
     882        scrollRange = infoPtr->nWidth - (rcmyw.right - rcmyw.left);
     883
     884        TRACE("nPos=%d, scrollrange=%d, nWidth=%d, myw=(%d,%d)-(%d,%d)\n",
     885              infoPtr->nPos, scrollRange, infoPtr->nWidth,
     886              rcmyw.left, rcmyw.top, rcmyw.right, rcmyw.bottom);
     887        PAGER_GrayAndRestoreBtns(infoPtr, scrollRange, &resizeClient, &repaintBtns);
     888        PAGER_HideGrayBtns(infoPtr, &resizeClient);
     889
    840890        if (PtInRect (&rcmyw, cursor)) {
    841891            GetWindowRect (hwnd, &wnrc);
     
    852902                RedrawWindow (hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE);
    853903        }
    854         if (infoPtr->TLbtnState) /* != PGF_INVISIBLE */
     904        if (infoPtr->TLbtnState && (lpRect->left + infoPtr->nButtonSize < lpRect->right))
    855905            lpRect->left += infoPtr->nButtonSize;
    856         if (infoPtr->BRbtnState)
     906        if (infoPtr->BRbtnState && (lpRect->right - infoPtr->nButtonSize > lpRect->left))
    857907            lpRect->right -= infoPtr->nButtonSize;
    858908    }
     
    875925        GetCursorPos (&cursor);
    876926        GetWindowRect (hwnd, &rcmyw);
     927
     928        /* Reset buttons and hide any grey ones */
     929        scrollRange = infoPtr->nHeight - (rcmyw.bottom - rcmyw.top);
     930
     931        TRACE("nPos=%d, scrollrange=%d, nHeigth=%d, myw=(%d,%d)-(%d,%d)\n",
     932              infoPtr->nPos, scrollRange, infoPtr->nHeight,
     933              rcmyw.left, rcmyw.top,
     934              rcmyw.right, rcmyw.bottom);
     935        PAGER_GrayAndRestoreBtns(infoPtr, scrollRange, &resizeClient, &repaintBtns);
     936        PAGER_HideGrayBtns(infoPtr, &resizeClient);
     937
    877938        if (PtInRect (&rcmyw, cursor)) {
    878939
     
    900961                RedrawWindow (hwnd, 0, 0, RDW_INVALIDATE | RDW_ERASE);
    901962        }
    902         if (infoPtr->TLbtnState)
     963        if (infoPtr->TLbtnState && (lpRect->top + infoPtr->nButtonSize < lpRect->bottom))
    903964            lpRect->top += infoPtr->nButtonSize;
    904         if (infoPtr->BRbtnState)
     965        if (infoPtr->BRbtnState && (lpRect->bottom - infoPtr->nButtonSize > lpRect->top))
    905966            lpRect->bottom -= infoPtr->nButtonSize;
    906967        /* ???? */
     
    909970    }
    910971
    911     TRACE("[%04x] client rect set to %dx%d at (%d,%d)\n", hwnd,
    912                 lpRect->right-lpRect->left,
    913                 lpRect->bottom-lpRect->top,
    914                 lpRect->left, lpRect->top);
     972    TRACE("[%04x] client rect set to %dx%d at (%d,%d) BtnState[%d,%d]\n",
     973          hwnd, lpRect->right-lpRect->left, lpRect->bottom-lpRect->top,
     974          lpRect->left, lpRect->top,
     975          infoPtr->TLbtnState, infoPtr->BRbtnState);
    915976
    916977    return 0;
     
    12481309    switch (uMsg)
    12491310    {
     1311        case EM_FMTLINES:
     1312            return PAGER_FmtLines(hwnd);
     1313
    12501314        case PGM_FORWARDMOUSE:
    12511315            return PAGER_ForwardMouse (hwnd, wParam);
     
    13561420
    13571421        default:
    1358 #ifdef __WIN32OS2__
    1359             return defComCtl32ProcA(hwnd, uMsg, wParam, lParam);
    1360 #else
    13611422            return DefWindowProcA (hwnd, uMsg, wParam, lParam);
    1362 #endif
    13631423    }
    13641424
Note: See TracChangeset for help on using the changeset viewer.