blob: 976e4aac0419187ec1222b22f85d8b487dc9dc6d [file] [log] [blame]
Alexandre Julliarde399fc31993-11-24 17:08:56 +00001/*
2 * Scroll windows and DCs
3 *
4 * Copyright David W. Metcalfe, 1993
Alexandre Julliard8cc3a5e1996-08-11 15:49:51 +00005 * Alex Korobka 1995,1996
Alexandre Julliardd4719651995-12-12 18:49:11 +00006 *
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00007 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
Alexandre Julliarde399fc31993-11-24 17:08:56 +000011 *
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000012 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Alexandre Julliarde399fc31993-11-24 17:08:56 +000020 */
21
Alexandre Julliarde399fc31993-11-24 17:08:56 +000022#include <stdlib.h>
Patrik Stridvallb87fe2e1999-04-01 08:16:08 +000023
Jeremy Whited3e22d92000-02-10 19:03:02 +000024#include "windef.h"
25#include "wingdi.h"
Patrik Stridvall1ed4ecf1999-06-26 14:58:24 +000026#include "wine/winuser16.h"
Marcus Meissner61afa331999-02-22 10:16:00 +000027#include "winuser.h"
Alexandre Julliarde3fe9f22001-05-10 03:23:59 +000028#include "user.h"
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000029#include "wine/debug.h"
Alexandre Julliardd4719651995-12-12 18:49:11 +000030
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000031WINE_DEFAULT_DEBUG_CHANNEL(scroll);
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000032
Alexandre Julliarde399fc31993-11-24 17:08:56 +000033/*************************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +000034 * ScrollWindow (USER32.@)
Alexandre Julliard670cdc41997-08-24 16:00:30 +000035 *
Alexandre Julliard75d86e11996-11-17 18:59:11 +000036 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000037BOOL WINAPI ScrollWindow( HWND hwnd, INT dx, INT dy,
38 const RECT *rect, const RECT *clipRect )
Alexandre Julliarde399fc31993-11-24 17:08:56 +000039{
Jerome Vouillon1da6dba1999-02-14 13:32:13 +000040 return
Alexandre Julliarda3960291999-02-26 11:11:13 +000041 (ERROR != ScrollWindowEx( hwnd, dx, dy, rect, clipRect, 0, NULL,
Jerome Vouillon1da6dba1999-02-14 13:32:13 +000042 (rect ? 0 : SW_SCROLLCHILDREN) |
43 SW_INVALIDATE ));
Alexandre Julliarde399fc31993-11-24 17:08:56 +000044}
45
Alexandre Julliarde399fc31993-11-24 17:08:56 +000046/*************************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +000047 * ScrollDC (USER.221)
Alexandre Julliarde399fc31993-11-24 17:08:56 +000048 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +000049BOOL16 WINAPI ScrollDC16( HDC16 hdc, INT16 dx, INT16 dy, const RECT16 *rect,
50 const RECT16 *cliprc, HRGN16 hrgnUpdate,
51 LPRECT16 rcUpdate )
Alexandre Julliard75d86e11996-11-17 18:59:11 +000052{
Alexandre Julliarda3960291999-02-26 11:11:13 +000053 RECT rect32, clipRect32, rcUpdate32;
Alexandre Julliard75d86e11996-11-17 18:59:11 +000054 BOOL16 ret;
55
56 if (rect) CONV_RECT16TO32( rect, &rect32 );
57 if (cliprc) CONV_RECT16TO32( cliprc, &clipRect32 );
Alexandre Julliarda3960291999-02-26 11:11:13 +000058 ret = ScrollDC( hdc, dx, dy, rect ? &rect32 : NULL,
Alexandre Julliard75d86e11996-11-17 18:59:11 +000059 cliprc ? &clipRect32 : NULL, hrgnUpdate, &rcUpdate32 );
60 if (rcUpdate) CONV_RECT32TO16( &rcUpdate32, rcUpdate );
61 return ret;
62}
63
64
65/*************************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +000066 * ScrollDC (USER32.@)
Vincent BĂ©ron9a624912002-05-31 23:06:46 +000067 *
Pascal Lessard83f39cf1999-02-25 16:35:22 +000068 * Only the hrgnUpdate is return in device coordinate.
69 * rcUpdate must be returned in logical coordinate to comply with win API.
70 *
Alexandre Julliard75d86e11996-11-17 18:59:11 +000071 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000072BOOL WINAPI ScrollDC( HDC hdc, INT dx, INT dy, const RECT *rc,
73 const RECT *prLClip, HRGN hrgnUpdate,
74 LPRECT rcUpdate )
Alexandre Julliarde399fc31993-11-24 17:08:56 +000075{
Alexandre Julliarddc4fe772001-06-04 21:55:17 +000076 if (USER_Driver.pScrollDC)
77 return USER_Driver.pScrollDC( hdc, dx, dy, rc, prLClip, hrgnUpdate, rcUpdate );
78 return FALSE;
Alexandre Julliarde399fc31993-11-24 17:08:56 +000079}
80
81
82/*************************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +000083 * ScrollWindowEx (USER32.@)
Alexandre Julliard670cdc41997-08-24 16:00:30 +000084 *
85 * NOTE: Use this function instead of ScrollWindow32
Alexandre Julliarde399fc31993-11-24 17:08:56 +000086 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000087INT WINAPI ScrollWindowEx( HWND hwnd, INT dx, INT dy,
88 const RECT *rect, const RECT *clipRect,
89 HRGN hrgnUpdate, LPRECT rcUpdate,
90 UINT flags )
Alexandre Julliarde399fc31993-11-24 17:08:56 +000091{
Alexandre Julliarde3fe9f22001-05-10 03:23:59 +000092 if (USER_Driver.pScrollWindowEx)
93 return USER_Driver.pScrollWindowEx( hwnd, dx, dy, rect, clipRect,
94 hrgnUpdate, rcUpdate, flags );
95 return ERROR;
Alexandre Julliarde399fc31993-11-24 17:08:56 +000096}