Mon Nov 22 13:58:56 1993 David Metcalfe <david@prism.demon.co.uk> * [windows/scroll.c] Preliminary implementations of ScrollWindow, ScrollDC and ScrollWindowEx. Nov 21, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/listbox.c] Optimization of redraw during 'Add' or 'Insert'. * [controls/scroll.c] Optimization of WM_PAINT during 'thumbtracking'. * [controls/button.c] Add of beta implement of 'BS_OWNERDRAW' * [controls/static.c] Style 'SS_ICON' new supported. * [misc/message.c] Begin of implemantation of MB_XXX styles. * [loader/resource.c] Function LoadIcon() : now prepare transparency Bitmap mask. Function LoadCursor() : now prepare a 'X pixmapcursor'. New function SetCursor() : not finished. New function ShowCursor() : not finished. New function AccessResource() : stub. * [obj/dib.c] Function DrawIcon(): deugging phase of icon transparency mask. * [loader/library.c] new file for news functions LoadLibrary() & FreeLibrary(). * [sysres.dll] Resources only 16bits DLL for System Resources, icons, etc... Sun Nov 14 14:39:06 1993 julliard@di.epfl.ch (Alexandre Julliard) * [include/dialog.h] [windows/dialog.c] Simplified dialog template parsing. Implemented DialogBoxIndirect(). * [windows/win.c] Fixed bug in CreateWindow() when aborting window creation. Modified UpdateWindow() to only update visible windows. Implemented IsWindow(). Nov 14, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/listbox.c] Listbox control window : new messages. * [controls/combo.c] Combo box control window : new messages. * [misc/message.c] Moved stub MessageBox() to this new file. Implemented of a callback, now MessageBox show a window. * [loader/resource.c] New function DestroyIcon() New function DestroyCursor() Filled stub LoadIcon() Filled stub LoadCursor() Bug fixed in FindResourceByName() : missing lseek(). * [obj/dib.c] New function DrawIcon() * [windows/win.c] New function CloseWindow() New function OpenIcon() New function IsIconic() New Function FindWindow() Sun Nov 14 08:27:19 1993 Karl Guenter Wuensch (hz225wu@unidui.uni-duisburg.de) * [loader/selector.c] Wrote AllocCStoDSAlias() and AllocDStoCSAlias() Sun Nov 14 08:27:19 1993 Bob Amstadt (bob at amscons) * [loader/selector.c] Wrote AllocSelector() and PrestoChangoSelector(). YUK! Sat Nov 13 13:56:42 1993 Bob Amstadt (bob at amscons) * [loader/resource.c] Wrote FindResource(), LoadResource(), LockResource(), and FreeResource() * [include/segmem.h] [loader/selector.c] [loader/signal.h] Changed selector allocation method. Sun Nov 10 08:27:19 1993 Karl Guenter Wuensch (hz225wu@unidui.uni-duisburg.de) * [if1632/callback.c if1632/call.S if1632/user.spec] added Catch (KERNEL.55) and Throw (KERNEL.56) Nov 7, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/scroll.c] Scroll bar control window Bug resolved : Painting message before scroll visible. * [controls/listbox.c] Listbox control window Destroy cleanup. * [controls/combo.c] Combo box control window Destroy cleanup. * [controls/button.c] GetCheck Message now return is state. * [windows/win.c] New function IsWindowVisible()
171 lines
3.7 KiB
C
171 lines
3.7 KiB
C
/*
|
|
* Scroll windows and DCs
|
|
*
|
|
* Copyright David W. Metcalfe, 1993
|
|
*
|
|
*/
|
|
|
|
static char Copyright[] = "Copyright David W. Metcalfe, 1993";
|
|
|
|
#include <stdlib.h>
|
|
#include "windows.h"
|
|
#include "gdi.h"
|
|
|
|
static int RgnType;
|
|
|
|
|
|
/*************************************************************************
|
|
* ScrollWindow (USER.61)
|
|
*/
|
|
|
|
void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect)
|
|
{
|
|
HDC hdc;
|
|
HRGN hrgnUpdate;
|
|
RECT rc, cliprc;
|
|
|
|
#ifdef DEBUG_SCROLL
|
|
printf("ScrollWindow: dx=%d, dy=%d, rect=%d,%d,%d,%d\n", dx, dy,
|
|
rect->left, rect->top, rect->right, rect->bottom);
|
|
#endif
|
|
|
|
hdc = GetDC(hwnd);
|
|
|
|
if (rect == NULL)
|
|
GetWindowRect(hwnd, &rc);
|
|
else
|
|
CopyRect(&rc, rect);
|
|
if (clipRect == NULL)
|
|
GetWindowRect(hwnd, &cliprc);
|
|
else
|
|
CopyRect(&cliprc, clipRect);
|
|
|
|
hrgnUpdate = CreateRectRgn(0, 0, 0, 0);
|
|
ScrollDC(hdc, dx, dy, &rc, &cliprc, hrgnUpdate, NULL);
|
|
InvalidateRgn(hwnd, hrgnUpdate, TRUE);
|
|
ReleaseDC(hwnd, hdc);
|
|
}
|
|
|
|
|
|
/*************************************************************************
|
|
* ScrollDC (USER.221)
|
|
*/
|
|
|
|
BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT rc, LPRECT cliprc,
|
|
HRGN hrgnUpdate, LPRECT rcUpdate)
|
|
{
|
|
HRGN hrgnClip, hrgn1, hrgn2;
|
|
POINT src, dest;
|
|
short width, height;
|
|
DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC);
|
|
|
|
#ifdef DEBUG_SCROLL
|
|
printf("ScrollDC: dx=%d, dy=%d, rc=%d,%d,%d,%d\n", dx, dy,
|
|
rc->left, rc->top, rc->right, rc->bottom);
|
|
#endif
|
|
|
|
if (rc == NULL)
|
|
return;
|
|
|
|
if (cliprc)
|
|
{
|
|
hrgnClip = CreateRectRgnIndirect(cliprc);
|
|
SelectClipRgn(hdc, hrgnClip);
|
|
}
|
|
|
|
if (dx > 0)
|
|
{
|
|
src.x = XDPTOLP(dc, rc->left);
|
|
dest.x = XDPTOLP(dc, rc->left + abs(dx));
|
|
}
|
|
else
|
|
{
|
|
src.x = XDPTOLP(dc, rc->left + abs(dx));
|
|
dest.x = XDPTOLP(dc, rc->left);
|
|
}
|
|
if (dy > 0)
|
|
{
|
|
src.y = YDPTOLP(dc, rc->top);
|
|
dest.y = YDPTOLP(dc, rc->top + abs(dy));
|
|
}
|
|
else
|
|
{
|
|
src.y = YDPTOLP(dc, rc->top + abs(dy));
|
|
dest.y = YDPTOLP(dc, rc->top);
|
|
}
|
|
|
|
width = rc->right - rc->left - abs(dx);
|
|
height = rc->bottom - rc->top - abs(dy);
|
|
|
|
if (!BitBlt(hdc, dest.x, dest.y, width, height, hdc, src.x, src.y,
|
|
SRCCOPY))
|
|
return;
|
|
|
|
if (hrgnUpdate)
|
|
{
|
|
if (dx > 0)
|
|
hrgn1 = CreateRectRgn(rc->left, rc->top, rc->left+dx, rc->bottom);
|
|
else if (dx < 0)
|
|
hrgn1 = CreateRectRgn(rc->right+dx, rc->top, rc->right,
|
|
rc->bottom);
|
|
else
|
|
hrgn1 = CreateRectRgn(0, 0, 0, 0);
|
|
|
|
if (dy > 0)
|
|
hrgn2 = CreateRectRgn(rc->left, rc->top, rc->right, rc->top+dy);
|
|
else if (dy < 0)
|
|
hrgn2 = CreateRectRgn(rc->left, rc->bottom+dy, rc->right,
|
|
rc->bottom);
|
|
else
|
|
hrgn2 = CreateRectRgn(0, 0, 0, 0);
|
|
|
|
RgnType = CombineRgn(hrgnUpdate, hrgn1, hrgn2, RGN_OR);
|
|
}
|
|
|
|
if (rcUpdate)
|
|
{
|
|
SelectClipRgn(hdc, hrgnUpdate);
|
|
GetClipBox(hdc, rcUpdate);
|
|
}
|
|
}
|
|
|
|
|
|
/*************************************************************************
|
|
* ScrollWindowEx (USER.319)
|
|
*/
|
|
|
|
int ScrollWindowEx(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect,
|
|
HRGN hrgnUpdate, LPRECT rcUpdate, WORD flags)
|
|
{
|
|
HDC hdc;
|
|
RECT rc, cliprc;
|
|
|
|
#ifdef DEBUG_SCROLL
|
|
printf("ScrollWindowEx: dx=%d, dy=%d, rect=%d,%d,%d,%d\n", dx, dy,
|
|
rect->left, rect->top, rect->right, rect->bottom);
|
|
#endif
|
|
|
|
hdc = GetDC(hwnd);
|
|
|
|
if (rect == NULL)
|
|
GetWindowRect(hwnd, &rc);
|
|
else
|
|
CopyRect(&rc, rect);
|
|
if (clipRect == NULL)
|
|
GetWindowRect(hwnd, &cliprc);
|
|
else
|
|
CopyRect(&cliprc, clipRect);
|
|
|
|
ScrollDC(hdc, dx, dy, &rc, &cliprc, hrgnUpdate, rcUpdate);
|
|
|
|
if (flags | SW_INVALIDATE)
|
|
{
|
|
InvalidateRgn(hwnd, hrgnUpdate, FALSE);
|
|
|
|
if (flags | SW_ERASE)
|
|
SendMessage(hwnd, WM_ERASEBKGND, (WORD)hdc, (LONG)NULL);
|
|
}
|
|
|
|
ReleaseDC(hwnd, hdc);
|
|
return RgnType;
|
|
}
|