Release 960928
Fri Sep 27 14:18:42 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [controls/button.c]
Fixed focus rectangle size and clipping.
* [controls/scroll.c]
Converted to Win32 and added support for scroll page.
Completed SetScrollInfo() and implemented other Win32 functions.
* [files/file.c]
Removed FILE_Read() (use _lread32 instead).
* [objects/dce.c] [include/dce.h]
Allocate DCE on the Win32 heap, and use pointers instead of
handles.
Implemented Win32 version of DC functions.
* [windows/painting.c]
Attempt to make CS_PARENTDC style work again.
Wed Sep 25 23:40:52 1996 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [windows/dce.c] [windows/winpos.c]
Override SaveUnder attribute when painting took place
in a window below. Force X to raise activated window
in seamless mode.
* [misc/clipboard.c] [windows/event.c]
Translation between DOS and Unix text formats and several
other fixes for the sudden selection loss.
* [windows/message.c]
Apply "first" and "last" when checking for WM_QUIT in
MSG_PeekMessage().
* [windows/win.c]
Rearranged DestroyWindow() to fit "Windows Internals"
description.
* [windows/win.c] [windows/winpos.c] [windows/nonclient.c]
Misc. fixes to CBT hook calls.
* [controls/menu.c] [misc/user.c]
Fixup resident popup menu window so that it doesn't get
destroyed by USER_AppExit().
* [loader/module.c] [loader/task.c] [windows/event.c]
Process "unsafe" X events outside the scheduler to prevent
deadlocks.
* [windows/message.c] [windows/queue.c] [windows/winpos.c]
Lots of fixes for better Win16 multitasking.
Wed Sep 25 20:36:30 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [include/windows.h]
Added some missing HOOK defines.
* [misc/shell.c][if1632/shell32.spec][include/shell.h]
SHGetFileInfoA stub added (win95 mplayer.exe /play bla.avi).
* [win32/console.c][include/wincon.h]
GetConsoleScreenBufferInfo, GetLargestConsoleWindowSize added.
* [misc/registry.c]
Some null ptr fixes.
* [loader/pe_image.c]
Fixed exported function lookup. (msvcrt20.dll)
Add debugsyms for entrypoint, exported functions and sections.
* [multimedia/mmsystem.c]
MCIOpen: support for element opens (mplayer.exe /play bla.avi).
* [several]
Added several missing things/stubs/simple thunks from win32
to win16 code.
Sat Sep 21 17:27:44 1996 O.Flebbe <flebbe@science-computing.uni-tuebingen.de>
* [windows/property.c]
Fixed debugging of 16 Bit RemoveProp().
* [debugger/memory.c]
Added DEBUG_checkmap_bad() for linux.
Thu Sep 19 20:48:31 1996 Albrecht Kleine <kleine@ak.sax.de>
* [windows/event.c] [windows/hook.c]
Use EnableHardwareInput() for JournalPlayback hook.
* [controls/listbox.c]
Changed handling of LB_GETITEMRECT in empty listboxes.
Thu Sep 19 13:34:35 1996 Slaven Rezic <eserte@cs.tu-berlin.de>
* [misc/main.c]
Fixes to X resources handling.
Wed Sep 18 00:31:15 1996 Huw D. M. Davies <h.davies1@physics.oxford.ac.uk>
* [objects/metafile.c] [include/gdi.h] [objects/dc.c]
Individual handle table created for each metafile. Fixed
GlobalReAlloc() bug in MF_AddHandleDC() (was MF_AddHandleInternal).
* [windows/graphics.c] [objects/dc.c]
Rectangle() changed to work better with wide pens and PS_NULL.
Use JoinMiter.
* [windows/winpos.c]
Make the whole (non X) window invalid on resize if CS_[VH]REDRAW
is set.
* [windows/nonclient.c]
AdjustWindowRectEx() should perform calculations even if the
window is minimized.
* [windows/mdi.c]
Better handling of system button painting. Maximized windows can
contain scroll bars. Icons now maximize properly.
* [windows/defwnd.c] [windows/nonclient.c] [controls/menu.c]
Improved greying of items in system menu. WM_INITMEMUPOPUP no
longer caught in DefWndProc, DEFWND_InitSysMenuPopup moved to
menu.c.
Mon Sep 16 21:30:00 1996 Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de>
* [several files]
Fix missing includes and wrong printing arguments.
* [controls/listbox.c]
Don't sort drives in ListBoxDirectory().
Sat Sep 14 09:05:47 1996 Petri Tuomola <ptuomola@xs4all.nl>
* [windows/dialog.c]
Fixed handling of Shift-TAB in dialogs.
Thu Sep 12 18:31:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [if1632/gdi32.spec]
Added SelectClipRgn - call win16 version.
* [if1632/user32.spec]
Added GetAsyncKeyState, GetMenuItemID and GetMenuStringA.
* [include/wincon.h]
Added COORD and SMALL_RECT typedefs, moved CONSOLE_SCREEN_BUFFER_INFO
out of #if 0 protected portion of file.
* [loader/pe_image.c]
PE_InitTEB() - Tidy up, bug fix to stack pointer value (Borland
programs now work better)
* [win32/console.c]
Added stub functions for GetConsoleScreenBufferInfo and
GetLargestConsoleWindowSize
* [win32/findfile.c]
FindFirstFile32A() - removed erroneous strcpy
* [windows/keyboard.c]
GetAsyncKeyState() - bug fix - now returns value as per Microsoft
specification. NB - I still have doubts about some other functions
in this file.
diff --git a/controls/button.c b/controls/button.c
index cfe6490..d224256 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -10,12 +10,12 @@
#include "graphics.h"
#include "button.h"
-static void PB_Paint( WND *wndPtr, HDC hDC, WORD action );
-static void PB_PaintGrayOnGray(HDC hDC,HFONT hFont,RECT16 *rc,char *text);
-static void CB_Paint( WND *wndPtr, HDC hDC, WORD action );
-static void GB_Paint( WND *wndPtr, HDC hDC, WORD action );
-static void UB_Paint( WND *wndPtr, HDC hDC, WORD action );
-static void OB_Paint( WND *wndPtr, HDC hDC, WORD action );
+static void PB_Paint( WND *wndPtr, HDC32 hDC, WORD action );
+static void PB_PaintGrayOnGray(HDC32 hDC,HFONT hFont,RECT32 *rc,char *text);
+static void CB_Paint( WND *wndPtr, HDC32 hDC, WORD action );
+static void GB_Paint( WND *wndPtr, HDC32 hDC, WORD action );
+static void UB_Paint( WND *wndPtr, HDC32 hDC, WORD action );
+static void OB_Paint( WND *wndPtr, HDC32 hDC, WORD action );
static void BUTTON_CheckAutoRadioButton( WND *wndPtr );
#define MAX_BTN_TYPE 12
@@ -36,7 +36,7 @@
BUTTON_UNCHECKED /* BS_OWNERDRAW */
};
-typedef void (*pfPaint)( WND *wndPtr, HDC hdc, WORD action );
+typedef void (*pfPaint)( WND *wndPtr, HDC32 hdc, WORD action );
static const pfPaint btnPaintFunc[MAX_BTN_TYPE] =
{
@@ -56,9 +56,9 @@
#define PAINT_BUTTON(wndPtr,style,action) \
if (btnPaintFunc[style]) { \
- HDC hdc = GetDC( (wndPtr)->hwndSelf ); \
+ HDC32 hdc = GetDC32( (wndPtr)->hwndSelf ); \
(btnPaintFunc[style])(wndPtr,hdc,action); \
- ReleaseDC( (wndPtr)->hwndSelf, hdc ); }
+ ReleaseDC32( (wndPtr)->hwndSelf, hdc ); }
#define BUTTON_SEND_CTLCOLOR(wndPtr,hdc) \
SendMessage32A( GetParent32((wndPtr)->hwndSelf), WM_CTLCOLORBTN, \
@@ -124,7 +124,7 @@
case WM_LBUTTONDOWN:
SendMessage32A( hWnd, BM_SETSTATE32, TRUE, 0 );
SetFocus32( hWnd );
- SetCapture( hWnd );
+ SetCapture32( hWnd );
break;
case WM_LBUTTONUP:
@@ -155,7 +155,7 @@
break;
case WM_MOUSEMOVE:
- if (GetCapture() == hWnd)
+ if (GetCapture32() == hWnd)
{
GetClientRect16( hWnd, &rect );
SendMessage32A( hWnd, BM_SETSTATE32,
@@ -249,16 +249,14 @@
* Push Button Functions
*/
-static void PB_Paint( WND *wndPtr, HDC hDC, WORD action )
+static void PB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
{
- RECT16 rc;
+ RECT32 rc;
HPEN16 hOldPen;
HBRUSH hOldBrush;
- DWORD dwTextSize;
- TEXTMETRIC16 tm;
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
- GetClientRect16(wndPtr->hwndSelf, &rc);
+ GetClientRect32( wndPtr->hwndSelf, &rc );
/* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */
if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
@@ -274,12 +272,12 @@
SetPixel( hDC, rc.right-1, rc.top, GetSysColor(COLOR_WINDOW) );
SetPixel( hDC, rc.right-1, rc.bottom-1, GetSysColor(COLOR_WINDOW) );
}
- InflateRect16( &rc, -1, -1 );
+ InflateRect32( &rc, -1, -1 );
if ((wndPtr->dwStyle & 0x000f) == BS_DEFPUSHBUTTON)
{
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
- InflateRect16( &rc, -1, -1 );
+ InflateRect32( &rc, -1, -1 );
}
if (infoPtr->state & BUTTON_HIGHLIGHTED)
@@ -296,32 +294,34 @@
/* draw button label, if any: */
if (wndPtr->text && wndPtr->text[0])
{
- LOGBRUSH16 lb;
- GetObject16( sysColorObjects.hbrushBtnFace, sizeof(lb), &lb );
- if (wndPtr->dwStyle & WS_DISABLED &&
- GetSysColor(COLOR_GRAYTEXT)==lb.lbColor)
- /* don't write gray text on gray bkg */
- PB_PaintGrayOnGray(hDC,infoPtr->hFont,&rc,wndPtr->text);
- else
- {
- SetTextColor( hDC, (wndPtr->dwStyle & WS_DISABLED) ?
- GetSysColor(COLOR_GRAYTEXT) : GetSysColor(COLOR_BTNTEXT));
- DrawText16( hDC, wndPtr->text, -1, &rc,
- DT_SINGLELINE | DT_CENTER | DT_VCENTER );
- /* do we have the focus? */
- if (infoPtr->state & BUTTON_HASFOCUS)
+ LOGBRUSH16 lb;
+ GetObject16( sysColorObjects.hbrushBtnFace, sizeof(lb), &lb );
+ if (wndPtr->dwStyle & WS_DISABLED &&
+ GetSysColor(COLOR_GRAYTEXT)==lb.lbColor)
+ /* don't write gray text on gray bkg */
+ PB_PaintGrayOnGray(hDC,infoPtr->hFont,&rc,wndPtr->text);
+ else
{
- short xdelta, ydelta;
- dwTextSize = GetTextExtent(hDC,wndPtr->text,strlen(wndPtr->text));
- GetTextMetrics16( hDC, &tm );
- xdelta = ((rc.right - rc.left) - LOWORD(dwTextSize) - 1) / 2;
- ydelta = ((rc.bottom - rc.top) - tm.tmHeight - 1) / 2;
- if (xdelta < 0) xdelta = 0;
- if (ydelta < 0) ydelta = 0;
- InflateRect16( &rc, -xdelta, -ydelta );
- DrawFocusRect16( hDC, &rc );
- }
- }
+ SetTextColor( hDC, (wndPtr->dwStyle & WS_DISABLED) ?
+ GetSysColor(COLOR_GRAYTEXT) : GetSysColor(COLOR_BTNTEXT));
+ DrawText32A( hDC, wndPtr->text, -1, &rc,
+ DT_SINGLELINE | DT_CENTER | DT_VCENTER );
+ /* do we have the focus? */
+ if (infoPtr->state & BUTTON_HASFOCUS)
+ {
+ RECT32 r = { 0, 0, 0, 0 };
+ INT32 xdelta, ydelta;
+
+ DrawText32A( hDC, wndPtr->text, -1, &r,
+ DT_SINGLELINE | DT_CALCRECT );
+ xdelta = ((rc.right - rc.left) - (r.right - r.left) - 1) / 2;
+ ydelta = ((rc.bottom - rc.top) - (r.bottom - r.top) - 1) / 2;
+ if (xdelta < 0) xdelta = 0;
+ if (ydelta < 0) ydelta = 0;
+ InflateRect32( &rc, -xdelta, -ydelta );
+ DrawFocusRect32( hDC, &rc );
+ }
+ }
}
SelectObject( hDC, hOldPen );
@@ -334,17 +334,17 @@
* using a raster brush to avoid gray text on gray background
*/
-void PB_PaintGrayOnGray(HDC hDC,HFONT hFont,RECT16 *rc,char *text)
+void PB_PaintGrayOnGray(HDC32 hDC,HFONT hFont,RECT32 *rc,char *text)
{
static int Pattern[] = {0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55};
HBITMAP hbm = CreateBitmap(8, 8, 1, 1, Pattern);
HDC hdcMem = CreateCompatibleDC(hDC);
HBITMAP hbmMem;
HBRUSH hBr;
- RECT16 rect,rc2;
+ RECT32 rect,rc2;
rect=*rc;
- DrawText16( hDC, text, -1, &rect, DT_SINGLELINE | DT_CALCRECT);
+ DrawText32A( hDC, text, -1, &rect, DT_SINGLELINE | DT_CALCRECT);
rc2=rect;
rect.left=(rc->right-rect.right)/2; /* for centering text bitmap */
rect.top=(rc->bottom-rect.bottom)/2;
@@ -354,7 +354,7 @@
DeleteObject( hbm);
PatBlt( hdcMem,0,0,rect.right,rect.bottom,WHITENESS);
if (hFont) SelectObject( hdcMem, hFont);
- DrawText16( hdcMem, text, -1, &rc2, DT_SINGLELINE);
+ DrawText32A( hdcMem, text, -1, &rc2, DT_SINGLELINE);
PatBlt( hdcMem,0,0,rect.right,rect.bottom,0xFA0089);
DeleteObject( SelectObject( hdcMem,hBr));
BitBlt( hDC,rect.left,rect.top,rect.right,rect.bottom,hdcMem,0,0,0x990000);
@@ -367,13 +367,12 @@
* Check Box & Radio Button Functions
*/
-static void CB_Paint( WND *wndPtr, HDC hDC, WORD action )
+static void CB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
{
RECT16 rc;
HBRUSH hBrush;
int textlen, delta, x, y;
TEXTMETRIC16 tm;
- SIZE16 size;
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
GetClientRect16(wndPtr->hwndSelf, &rc);
@@ -404,20 +403,22 @@
if (wndPtr->dwStyle & WS_DISABLED)
SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) );
DrawText16( hDC, wndPtr->text, textlen, &rc,
- DT_SINGLELINE | DT_VCENTER );
+ DT_SINGLELINE | DT_VCENTER | DT_NOCLIP );
}
if ((action == ODA_FOCUS) ||
((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS)))
{
- GetTextExtentPoint16( hDC, wndPtr->text, textlen, &size );
+ RECT16 rect = { 0, 0, 0, 0 };
+ DrawText16( hDC, wndPtr->text, textlen, &rect,
+ DT_SINGLELINE | DT_CALCRECT );
if (delta > 1)
{
rc.top += delta - 1;
rc.bottom -= delta + 1;
}
rc.left--;
- rc.right = MIN( rc.left + size.cx + 2, rc.right );
+ rc.right = rc.left + rect.right + 2;
DrawFocusRect16( hDC, &rc );
}
}
@@ -444,10 +445,9 @@
* Group Box Functions
*/
-static void GB_Paint( WND *wndPtr, HDC hDC, WORD action )
+static void GB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
{
RECT16 rc;
- SIZE16 size;
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
if (action != ODA_DRAWENTIRE) return;
@@ -465,13 +465,10 @@
LineTo( hDC, rc.left, rc.top+2 );
if (!wndPtr->text) return;
- GetTextExtentPoint16( hDC, wndPtr->text, strlen(wndPtr->text), &size );
- rc.left += 10;
- rc.right = rc.left + size.cx + 1;
- rc.bottom = size.cy;
if (wndPtr->dwStyle & WS_DISABLED)
SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) );
- DrawText16( hDC, wndPtr->text, -1, &rc, DT_SINGLELINE );
+ rc.left += 10;
+ DrawText16( hDC, wndPtr->text, -1, &rc, DT_SINGLELINE | DT_NOCLIP );
}
@@ -479,7 +476,7 @@
* User Button Functions
*/
-static void UB_Paint( WND *wndPtr, HDC hDC, WORD action )
+static void UB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
{
RECT16 rc;
HBRUSH hBrush;
@@ -503,7 +500,7 @@
* Ownerdrawn Button Functions
*/
-static void OB_Paint( WND *wndPtr, HDC hDC, WORD action )
+static void OB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
{
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
DRAWITEMSTRUCT32 dis;
diff --git a/controls/combo.c b/controls/combo.c
index 0904e8b..412fb2e 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -87,7 +87,7 @@
WND *wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr->dwStyle & WS_VSCROLL)
- SetScrollRange(lphc->hWndLBox,SB_VERT,0,ListMaxFirstVisible(lphl),TRUE);
+ SetScrollRange32(lphc->hWndLBox,SB_VERT,0,ListMaxFirstVisible(lphl),TRUE);
if (repaint && lphl->bRedrawFlag) InvalidateRect32( hwnd, NULL, TRUE );
}
@@ -240,7 +240,11 @@
{
Rectangle(hdc,lphc->RectButton.left-1,lphc->RectButton.top-1,
lphc->RectButton.right+1,lphc->RectButton.bottom+1);
- GRAPH_DrawReliefRect(hdc, &lphc->RectButton, 2, 2, FALSE);
+ {
+ RECT32 r;
+ CONV_RECT16TO32( &lphc->RectButton, &r );
+ GRAPH_DrawReliefRect(hdc, &r, 2, 2, FALSE);
+ }
GRAPH_DrawBitmap(hdc, hComboBit,
lphc->RectButton.left + 2,lphc->RectButton.top + 2,
0, 0, CBitWidth, CBitHeight );
@@ -889,7 +893,7 @@
SendMessage16(GetParent16(hwnd), WM_COMMAND,ID_CLB,MAKELONG(0,CBN_SELCHANGE));
lphl->ItemFocused = newFocused;
ListBoxScrollToFocus(lphl);
- SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
+ SetScrollPos32(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
@@ -971,7 +975,7 @@
}
if (wndPtr->dwStyle & WS_VSCROLL)
- SetScrollRange(hwnd, SB_VERT, 0, ListMaxFirstVisible(lphl), TRUE);
+ SetScrollRange32(hwnd, SB_VERT, 0, ListMaxFirstVisible(lphl), TRUE);
SelectObject(hdc,hOldFont);
EndPaint16( hwnd, &ps );
@@ -1008,7 +1012,7 @@
RECT16 rectsel;
/* SetFocus32(hwnd); */
- SetCapture(hwnd);
+ SetCapture32(hwnd);
lphl->PrevFocused = lphl->ItemFocused;
@@ -1030,7 +1034,7 @@
{
LPHEADLIST lphl = CLBoxGetListHeader(hwnd);
- if (GetCapture() == hwnd) ReleaseCapture();
+ if (GetCapture32() == hwnd) ReleaseCapture();
if(!lphl)
{
@@ -1070,7 +1074,7 @@
if (y < CBLMM_EDGE) {
if (lphl->FirstVisible > 0) {
lphl->FirstVisible--;
- SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
+ SetScrollPos32(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
ListBoxSetCurSel(lphl, wRet);
InvalidateRect32( hwnd, NULL, TRUE );
return 0;
@@ -1079,7 +1083,7 @@
else if (y >= (rect.bottom-CBLMM_EDGE)) {
if (lphl->FirstVisible < ListMaxFirstVisible(lphl)) {
lphl->FirstVisible++;
- SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
+ SetScrollPos32(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
ListBoxSetCurSel(lphl, wRet);
InvalidateRect32( hwnd, NULL, TRUE );
return 0;
@@ -1136,7 +1140,7 @@
lphl->FirstVisible = ListMaxFirstVisible(lphl);
if (y != lphl->FirstVisible) {
- SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
+ SetScrollPos32(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect32( hwnd, NULL, TRUE );
}
diff --git a/controls/desktop.c b/controls/desktop.c
index 810dd5c..f7529e8 100644
--- a/controls/desktop.c
+++ b/controls/desktop.c
@@ -4,13 +4,13 @@
* Copyright 1994 Alexandre Julliard
*/
+#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "win.h"
#include "desktop.h"
#include "directory.h"
-#include "file.h"
#include "graphics.h"
#include "heap.h"
@@ -20,11 +20,11 @@
*
* Load a bitmap from a file. Used by SetDeskWallPaper().
*/
-static HBITMAP DESKTOP_LoadBitmap( HDC hdc, const char *filename )
+static HBITMAP32 DESKTOP_LoadBitmap( HDC32 hdc, const char *filename )
{
BITMAPFILEHEADER *fileHeader;
BITMAPINFO *bitmapInfo;
- HBITMAP hbitmap;
+ HBITMAP32 hbitmap;
HFILE file;
LPSTR buffer;
LONG size;
@@ -33,10 +33,10 @@
if ((file = _lopen( filename, OF_READ )) == HFILE_ERROR)
{
- UINT32 len = GetWindowsDirectory( NULL, 0 );
+ UINT32 len = GetWindowsDirectory32A( NULL, 0 );
if (!(buffer = HeapAlloc( SystemHeap, 0, len + strlen(filename) + 2 )))
return 0;
- GetWindowsDirectory( buffer, len + 1 );
+ GetWindowsDirectory32A( buffer, len + 1 );
strcat( buffer, "\\" );
strcat( buffer, filename );
file = _lopen( buffer, OF_READ );
@@ -50,7 +50,7 @@
return 0;
}
_llseek( file, 0, 0 );
- size = FILE_Read( file, buffer, size );
+ size = _lread32( file, buffer, size );
_lclose( file );
fileHeader = (BITMAPFILEHEADER *)buffer;
bitmapInfo = (BITMAPINFO *)(buffer + sizeof(BITMAPFILEHEADER));
@@ -74,15 +74,16 @@
*
* Handle the WM_ERASEBKGND message.
*/
-static LONG DESKTOP_DoEraseBkgnd( HWND hwnd, HDC hdc, DESKTOPINFO *infoPtr )
+static LRESULT DESKTOP_DoEraseBkgnd( HWND32 hwnd, HDC32 hdc,
+ DESKTOPINFO *infoPtr )
{
- RECT16 rect;
+ RECT32 rect;
WND* Wnd = WIN_FindWndPtr( hwnd );
if( Wnd->hrgnUpdate > 1 ) DeleteObject( Wnd->hrgnUpdate );
Wnd->hrgnUpdate = 0;
- GetClientRect16( hwnd, &rect );
+ GetClientRect32( hwnd, &rect );
/* Paint desktop pattern (only if wall paper does not cover everything) */
@@ -93,14 +94,14 @@
/* Set colors in case pattern is a monochrome bitmap */
SetBkColor( hdc, RGB(0,0,0) );
SetTextColor( hdc, GetSysColor(COLOR_BACKGROUND) );
- FillRect16( hdc, &rect, infoPtr->hbrushPattern );
+ FillRect32( hdc, &rect, infoPtr->hbrushPattern );
}
/* Paint wall paper */
if (infoPtr->hbitmapWallPaper)
{
- int x, y;
+ INT32 x, y;
if (infoPtr->fTileWallPaper)
{
@@ -147,12 +148,12 @@
infoPtr->hbrushPattern = 0;
infoPtr->hbitmapWallPaper = 0;
SetDeskPattern();
- SetDeskWallPaper( (LPSTR)-1 );
+ SetDeskWallPaper32( (LPSTR)-1 );
break;
case WM_ERASEBKGND:
if (rootWindow == DefaultRootWindow(display)) return 1;
- return DESKTOP_DoEraseBkgnd( hwnd, (HDC)wParam, infoPtr );
+ return DESKTOP_DoEraseBkgnd( hwnd, (HDC32)wParam, infoPtr );
case WM_SYSCOMMAND:
if ((wParam & 0xfff0) != SC_CLOSE) return 0;
@@ -169,7 +170,7 @@
/***********************************************************************
* SetDeskPattern (USER.279)
*/
-BOOL SetDeskPattern(void)
+BOOL16 SetDeskPattern(void)
{
char buffer[100];
GetProfileString( "desktop", "Pattern", "(None)", buffer, 100 );
@@ -178,14 +179,25 @@
/***********************************************************************
- * SetDeskWallPaper (USER.285)
+ * SetDeskWallPaper16 (USER.285)
*/
-BOOL SetDeskWallPaper( LPCSTR filename )
+BOOL16 SetDeskWallPaper16( LPCSTR filename )
{
- HBITMAP hbitmap;
- HDC hdc;
+ return SetDeskWallPaper32( filename );
+}
+
+
+/***********************************************************************
+ * SetDeskWallPaper32 (USER32.475)
+ *
+ * FIXME: is there a unicode version?
+ */
+BOOL32 SetDeskWallPaper32( LPCSTR filename )
+{
+ HBITMAP32 hbitmap;
+ HDC32 hdc;
char buffer[256];
- WND *wndPtr = WIN_FindWndPtr( GetDesktopWindow() );
+ WND *wndPtr = WIN_GetDesktop();
DESKTOPINFO *infoPtr = (DESKTOPINFO *)wndPtr->wExtra;
if (filename == (LPSTR)-1)
@@ -193,16 +205,16 @@
GetProfileString( "desktop", "WallPaper", "(None)", buffer, 256 );
filename = buffer;
}
- hdc = GetDC( 0 );
+ hdc = GetDC32( 0 );
hbitmap = DESKTOP_LoadBitmap( hdc, filename );
- ReleaseDC( 0, hdc );
+ ReleaseDC32( 0, hdc );
if (infoPtr->hbitmapWallPaper) DeleteObject( infoPtr->hbitmapWallPaper );
infoPtr->hbitmapWallPaper = hbitmap;
infoPtr->fTileWallPaper = GetProfileInt( "desktop", "TileWallPaper", 0 );
if (hbitmap)
{
- BITMAP16 bmp;
- GetObject16( hbitmap, sizeof(bmp), &bmp );
+ BITMAP32 bmp;
+ GetObject32A( hbitmap, sizeof(bmp), &bmp );
infoPtr->bitmapSize.cx = (bmp.bmWidth != 0) ? bmp.bmWidth : 1;
infoPtr->bitmapSize.cy = (bmp.bmHeight != 0) ? bmp.bmHeight : 1;
}
@@ -215,9 +227,9 @@
*
* Set the desktop pattern.
*/
-BOOL DESKTOP_SetPattern(char *pattern )
+BOOL32 DESKTOP_SetPattern( LPCSTR pattern )
{
- WND *wndPtr = WIN_FindWndPtr( GetDesktopWindow() );
+ WND *wndPtr = WIN_GetDesktop();
DESKTOPINFO *infoPtr = (DESKTOPINFO *)wndPtr->wExtra;
int pat[8];
@@ -228,7 +240,7 @@
&pat[4], &pat[5], &pat[6], &pat[7] ))
{
WORD pattern[8];
- HBITMAP hbitmap;
+ HBITMAP32 hbitmap;
int i;
for (i = 0; i < 8; i++) pattern[i] = pat[i] & 0xffff;
diff --git a/controls/edit.c b/controls/edit.c
index 939e100..fb87a79 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -14,7 +14,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <windows.h>
+#include "windows.h"
#include "win.h"
#include "local.h"
#include "stddebug.h"
@@ -503,7 +503,7 @@
EDITSTATE *es = EDITSTATEPTR(wndPtr);
char *text = EDIT_GetPasswordPointer(wndPtr);
int ww = EDIT_GetWndWidth(wndPtr);
- HDC hdc;
+ HDC32 hdc;
HFONT hFont;
HFONT oldFont = 0;
char *start, *cp;
@@ -512,7 +512,7 @@
int length;
LINE_END ending;
- hdc = GetDC(wndPtr->hwndSelf);
+ hdc = GetDC32(wndPtr->hwndSelf);
hFont = (HFONT)EDIT_WM_GetFont(wndPtr, 0, 0L);
if (hFont)
oldFont = SelectObject(hdc, hFont);
@@ -598,7 +598,7 @@
}
if (hFont)
SelectObject(hdc, oldFont);
- ReleaseDC(wndPtr->hwndSelf, hdc);
+ ReleaseDC32(wndPtr->hwndSelf, hdc);
free(text);
}
@@ -1441,7 +1441,7 @@
EDITSTATE *es = EDITSTATEPTR(wndPtr);
char *text = EDIT_GetPasswordPointer(wndPtr);
INT ret;
- HDC hdc;
+ HDC32 hdc;
HFONT hFont;
HFONT oldFont = 0;
UINT lc = (UINT)EDIT_EM_GetLineCount(wndPtr, 0, 0L);
@@ -1449,7 +1449,7 @@
UINT ll = (UINT)EDIT_EM_LineLength(wndPtr, li, 0L);
UINT xoff = EDIT_GetXOffset(wndPtr);
- hdc = GetDC(wndPtr->hwndSelf);
+ hdc = GetDC32(wndPtr->hwndSelf);
hFont = (HFONT)EDIT_WM_GetFont(wndPtr, 0, 0L);
if (hFont)
oldFont = SelectObject(hdc, hFont);
@@ -1460,7 +1460,7 @@
es->NumTabStops, es->TabStops)) - xoff;
if (hFont)
SelectObject(hdc, oldFont);
- ReleaseDC(wndPtr->hwndSelf, hdc);
+ ReleaseDC32(wndPtr->hwndSelf, hdc);
free(text);
return ret;
}
@@ -1859,10 +1859,10 @@
es->FirstVisibleLine = nfv;
es->XOffset = nxoff;
if (IsVScrollBar(wndPtr))
- SetScrollPos(wndPtr->hwndSelf, SB_VERT,
+ SetScrollPos32(wndPtr->hwndSelf, SB_VERT,
EDIT_WM_VScroll(wndPtr, EM_GETTHUMB, 0L), TRUE);
if (IsHScrollBar(wndPtr))
- SetScrollPos(wndPtr->hwndSelf, SB_HORZ,
+ SetScrollPos32(wndPtr->hwndSelf, SB_HORZ,
EDIT_WM_HScroll(wndPtr, EM_GETTHUMB, 0L), TRUE);
if (wndPtr->hwndSelf == GetFocus32()) {
GetCaretPos16(&pos);
@@ -2604,7 +2604,7 @@
UINT li;
SetFocus32(wndPtr->hwndSelf);
- SetCapture(wndPtr->hwndSelf);
+ SetCapture32(wndPtr->hwndSelf);
l = MIN(fv + vlc - 1, MAX(fv, l));
x = MIN(EDIT_GetWndWidth(wndPtr), MAX(0, x));
c = EDIT_ColFromWndX(wndPtr, l, x);
@@ -2626,7 +2626,7 @@
*/
static LRESULT EDIT_WM_LButtonUp(WND *wndPtr, WPARAM wParam, LPARAM lParam)
{
- if (GetCapture() == wndPtr->hwndSelf)
+ if (GetCapture32() == wndPtr->hwndSelf)
ReleaseCapture();
return 0L;
}
@@ -2648,7 +2648,7 @@
UINT vlc;
UINT li;
- if (GetCapture() == wndPtr->hwndSelf) {
+ if (GetCapture32() == wndPtr->hwndSelf) {
x = (INT)LOWORD(lParam);
y = (INT)HIWORD(lParam);
fv = (UINT)EDIT_EM_GetFirstVisibleLine(wndPtr, 0, 0L);
@@ -2775,11 +2775,11 @@
TEXTMETRIC16 tm;
EDITSTATE *es = EDITSTATEPTR(wndPtr);
LPARAM sel = EDIT_EM_GetSel(wndPtr, 0, 0L);
- HDC hdc;
+ HDC32 hdc;
HFONT oldFont = 0;
es->hFont = (HFONT)wParam;
- hdc = GetDC(wndPtr->hwndSelf);
+ hdc = GetDC32(wndPtr->hwndSelf);
if (es->hFont)
oldFont = SelectObject(hdc, es->hFont);
GetTextMetrics16(hdc, &tm);
@@ -2787,7 +2787,7 @@
es->AveCharWidth = tm.tmAveCharWidth;
if (es->hFont)
SelectObject(hdc, oldFont);
- ReleaseDC(wndPtr->hwndSelf, hdc);
+ ReleaseDC32(wndPtr->hwndSelf, hdc);
EDIT_BuildLineDefs(wndPtr);
if ((BOOL)lParam && EDIT_GetRedraw(wndPtr))
InvalidateRect32( wndPtr->hwndSelf, NULL, TRUE );
diff --git a/controls/listbox.c b/controls/listbox.c
index 5a16e4a..4abf763 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -64,7 +64,7 @@
void CreateListBoxStruct(HWND hwnd, WORD CtlType, LONG styles, HWND parent)
{
LPHEADLIST lphl;
- HDC hdc;
+ HDC32 hdc;
lphl = (LPHEADLIST)xmalloc(sizeof(HEADLIST));
SetWindowLong32A(hwnd, 0, (LONG)lphl);
@@ -87,14 +87,14 @@
lphl->HasStrings = (styles & LBS_HASSTRINGS) || !lphl->OwnerDrawn;
/* create dummy hdc to set text height */
- if ((hdc = GetDC(0)))
+ if ((hdc = GetDC32(0)))
{
TEXTMETRIC16 tm;
GetTextMetrics16( hdc, &tm );
lphl->StdItemHeight = tm.tmHeight;
dprintf_listbox(stddeb,"CreateListBoxStruct: font height %d\n",
lphl->StdItemHeight);
- ReleaseDC( 0, hdc );
+ ReleaseDC32( 0, hdc );
}
if (lphl->OwnerDrawn)
@@ -148,9 +148,9 @@
void ListBoxUpdateWindow(HWND hwnd, LPHEADLIST lphl, BOOL repaint)
{
if (lphl->dwStyle & WS_VSCROLL)
- SetScrollRange(hwnd, SB_VERT, 0, ListMaxFirstVisible(lphl), TRUE);
+ SetScrollRange32(hwnd, SB_VERT, 0, ListMaxFirstVisible(lphl), TRUE);
if ((lphl->dwStyle & WS_HSCROLL) && (lphl->ItemsPerColumn != 0))
- SetScrollRange(hwnd, SB_HORZ, 1, lphl->ItemsVisible /
+ SetScrollRange32(hwnd, SB_HORZ, 1, lphl->ItemsVisible /
lphl->ItemsPerColumn + 1, TRUE);
if (repaint && lphl->bRedrawFlag) InvalidateRect32( hwnd, NULL, TRUE );
@@ -811,12 +811,16 @@
if (attrib & DDL_DRIVES)
{
int x;
+ DWORD oldstyle = lphl->dwStyle;
+
+ lphl->dwStyle &= ~LBS_SORT;
strcpy( temp, "[-a-]" );
for (x = 0; x < MAX_DOS_DRIVES; x++, temp[2]++)
{
if (DRIVE_IsValid(x))
if ((ret = ListBoxAddString(lphl, SEGPTR_GET(temp))) == LB_ERR) break;
}
+ lphl->dwStyle = oldstyle;
}
free( path );
@@ -831,8 +835,22 @@
{
LPLISTSTRUCT lpls = ListBoxGetItem(lphl,wIndex);
- if (lpls == NULL) return LB_ERR;
- *lprect = lpls->itemRect;
+ dprintf_listbox(stddeb,"ListBox LB_GETITEMRECT %i %p", wIndex,lpls);
+ if (lpls == NULL)
+ {
+ if (lphl->dwStyle & LBS_OWNERDRAWVARIABLE)
+ return LB_ERR;
+ else
+ {
+ GetClientRect16(lphl->hSelf,lprect);
+ lprect->bottom=lphl->StdItemHeight;
+ if (lprect->right<0) lprect->right=0;
+ }
+ }
+ else
+ *lprect = lpls->itemRect;
+ dprintf_listbox(stddeb," = %d,%d %d,%d\n", lprect->left,lprect->top,
+ lprect->right,lprect->bottom);
return 0;
}
@@ -897,9 +915,9 @@
lphl->ColumnsWidth = rect.right - rect.left;
if (dwStyle & WS_VSCROLL)
- SetScrollRange(hwnd, SB_VERT, 0, ListMaxFirstVisible(lphl), TRUE);
+ SetScrollRange32(hwnd, SB_VERT, 0, ListMaxFirstVisible(lphl), TRUE);
if (dwStyle & WS_HSCROLL)
- SetScrollRange(hwnd, SB_HORZ, 1, 1, TRUE);
+ SetScrollRange32(hwnd, SB_HORZ, 1, 1, TRUE);
return 0;
}
@@ -974,7 +992,7 @@
lphl->FirstVisible = ListMaxFirstVisible(lphl);
if (y != lphl->FirstVisible) {
- SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
+ SetScrollPos32(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect32( hwnd, NULL, TRUE );
}
return 0;
@@ -1029,7 +1047,7 @@
lphl->FirstVisible = lphl->FirstVisible /
lphl->ItemsPerColumn * lphl->ItemsPerColumn + 1;
if (y != lphl->FirstVisible) {
- SetScrollPos(hwnd, SB_HORZ, lphl->FirstVisible /
+ SetScrollPos32(hwnd, SB_HORZ, lphl->FirstVisible /
lphl->ItemsPerColumn + 1, TRUE);
InvalidateRect32( hwnd, NULL, TRUE );
}
@@ -1048,7 +1066,7 @@
RECT16 rectsel;
SetFocus32(hwnd);
- SetCapture(hwnd);
+ SetCapture32(hwnd);
lphl->PrevFocused = lphl->ItemFocused;
@@ -1122,7 +1140,7 @@
{
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
- if (GetCapture() == hwnd) ReleaseCapture();
+ if (GetCapture32() == hwnd) ReleaseCapture();
if (lphl->PrevFocused != lphl->ItemFocused)
ListBoxSendNotification(lphl, LBN_SELCHANGE);
@@ -1158,7 +1176,7 @@
if (y < LBMM_EDGE) {
if (lphl->FirstVisible > 0) {
lphl->FirstVisible--;
- SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
+ SetScrollPos32(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
@@ -1167,7 +1185,7 @@
if (y >= (rect.bottom-LBMM_EDGE)) {
if (lphl->FirstVisible < ListMaxFirstVisible(lphl)) {
lphl->FirstVisible++;
- SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
+ SetScrollPos32(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
@@ -1322,7 +1340,7 @@
}
}
- SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
+ SetScrollPos32(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
return 0;
}
@@ -1358,7 +1376,7 @@
lphl->ItemFocused = newFocused;
ListBoxScrollToFocus(lphl);
- SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
+ SetScrollPos32(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect32( hwnd, NULL, TRUE );
@@ -1385,7 +1403,7 @@
static LONG LBSetFont(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
- HDC hdc;
+ HDC32 hdc;
if (wParam == 0)
lphl->hFont = GetStockObject(SYSTEM_FONT);
@@ -1395,14 +1413,14 @@
/* a new font means possible new text height */
/* does this mean the height of each entry must be separately changed? */
/* or are we guaranteed to get a LBSetFont before the first insert/add? */
- if ((hdc = GetDC(0)))
+ if ((hdc = GetDC32(0)))
{
TEXTMETRIC16 tm;
GetTextMetrics16( hdc, &tm );
lphl->StdItemHeight = tm.tmHeight;
dprintf_listbox(stddeb,"LBSetFont: new font %d with height %d\n",
lphl->hFont, lphl->StdItemHeight);
- ReleaseDC( 0, hdc );
+ ReleaseDC32( 0, hdc );
}
return 0;
@@ -1517,7 +1535,7 @@
if(!(lphl->dwStyle & LBS_MULTIPLESEL) )
if( lphl->ItemsCount && lphl->ItemFocused != -1)
{
- HDC hDC = GetDC(hwnd);
+ HDC32 hDC = GetDC32(hwnd);
HFONT hOldFont = SelectObject(hDC, lphl->hFont);
LPLISTSTRUCT lpls;
@@ -1526,7 +1544,7 @@
ListBoxDrawItem(hwnd,lphl,hDC,lpls,&lpls->itemRect, ODA_FOCUS, lpls->itemState);
SelectObject(hDC, hOldFont);
- ReleaseDC(hwnd,hDC);
+ ReleaseDC32(hwnd,hDC);
}
ListBoxSendNotification(lphl, LBN_SETFOCUS);
@@ -1547,7 +1565,7 @@
if( lphl->ItemsCount )
if( lphl->ItemFocused != -1 )
{
- HDC hDC = GetDC(hwnd);
+ HDC32 hDC = GetDC32(hwnd);
HFONT hOldFont = SelectObject(hDC, lphl->hFont);
LPLISTSTRUCT lpls;
@@ -1556,7 +1574,7 @@
ListBoxDrawItem(hwnd,lphl,hDC,lpls,&lpls->itemRect, ODA_FOCUS, lpls->itemState);
SelectObject(hDC, hOldFont);
- ReleaseDC(hwnd,hDC);
+ ReleaseDC32(hwnd,hDC);
}
else
dprintf_listbox(stddeb,"LBKillFocus: no focused item!\n");
@@ -1905,7 +1923,7 @@
lphl->ItemFocused = wParam;
i = ListBoxScrollToFocus (lphl);
- SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
+ SetScrollPos32(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
if(i)
InvalidateRect32( hwnd, NULL, TRUE );
@@ -1988,7 +2006,7 @@
wRet = ListBoxSetCurSel(lphl, wParam);
- SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
+ SetScrollPos32(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect32( hwnd, NULL, TRUE );
return wRet;
@@ -2034,7 +2052,7 @@
dprintf_listbox(stddeb,"ListBox LB_SETTOPINDEX wParam=%x !\n",
wParam);
lphl->FirstVisible = wParam;
- SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
+ SetScrollPos32(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect32( hwnd, NULL, TRUE );
diff --git a/controls/menu.c b/controls/menu.c
index bc1a6ac..d18b3ca 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -87,8 +87,9 @@
#define IS_STRING_ITEM(flags) (!((flags) & (MF_BITMAP | MF_OWNERDRAW | \
MF_MENUBARBREAK | MF_MENUBREAK | MF_SEPARATOR)))
-extern void NC_DrawSysButton(HWND hwnd, HDC hdc, BOOL down); /* nonclient.c */
-extern BOOL NC_GetSysPopupPos(WND* wndPtr, RECT16* rect);
+extern void NC_DrawSysButton(HWND hwnd, HDC hdc, BOOL down); /* nonclient.c */
+extern BOOL NC_GetSysPopupPos(WND* wndPtr, RECT16* rect);
+extern HTASK TASK_GetNextTask(HTASK);
static HBITMAP hStdCheck = 0;
static HBITMAP hStdMnArrow = 0;
@@ -210,6 +211,30 @@
/***********************************************************************
+ * MENU_InitSysMenuPopup
+ *
+ * Grey the appropriate items in System menu.
+ */
+void MENU_InitSysMenuPopup(HMENU hmenu, DWORD style, DWORD clsStyle)
+{
+ BOOL gray;
+
+ gray = !(style & WS_THICKFRAME) || (style & (WS_MAXIMIZE | WS_MINIMIZE));
+ EnableMenuItem( hmenu, SC_SIZE, (gray ? MF_GRAYED : MF_ENABLED) );
+ gray = ((style & WS_MAXIMIZE) != 0);
+ EnableMenuItem( hmenu, SC_MOVE, (gray ? MF_GRAYED : MF_ENABLED) );
+ gray = !(style & WS_MINIMIZEBOX) || (style & WS_MINIMIZE);
+ EnableMenuItem( hmenu, SC_MINIMIZE, (gray ? MF_GRAYED : MF_ENABLED) );
+ gray = !(style & WS_MAXIMIZEBOX) || (style & WS_MAXIMIZE);
+ EnableMenuItem( hmenu, SC_MAXIMIZE, (gray ? MF_GRAYED : MF_ENABLED) );
+ gray = !(style & (WS_MAXIMIZE | WS_MINIMIZE));
+ EnableMenuItem( hmenu, SC_RESTORE, (gray ? MF_GRAYED : MF_ENABLED) );
+ gray = (clsStyle & CS_NOCLOSE) != 0;
+ EnableMenuItem( hmenu, SC_CLOSE, (gray ? MF_GRAYED : MF_ENABLED) );
+}
+
+
+/***********************************************************************
* MENU_FindItem
*
* Find a menu item. Return a pointer on the item, and modifies *hmenu
@@ -407,13 +432,13 @@
static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop, HWND hwndOwner )
{
MENUITEM *lpitem;
- HDC hdc;
+ HDC32 hdc;
int start, i;
int orgX, orgY, maxX, maxTab, maxTabWidth;
lppop->Width = lppop->Height = 0;
if (lppop->nItems == 0) return;
- hdc = GetDC( 0 );
+ hdc = GetDC32( 0 );
maxX = start = 0;
while (start < lppop->nItems)
{
@@ -450,7 +475,7 @@
}
lppop->Width = maxX;
- ReleaseDC( 0, hdc );
+ ReleaseDC32( 0, hdc );
}
@@ -731,12 +756,25 @@
/***********************************************************************
* MENU_SwitchTPWndTo
*/
-static BOOL MENU_SwitchTPWndTo( HTASK hTask)
+BOOL32 MENU_SwitchTPWndTo( HTASK hTask)
{
- /* This is supposed to be called when popup is hidden */
+ /* This is supposed to be called when popup is hidden.
+ * AppExit() calls with hTask == 0, so we get the next to current.
+ */
- TDB* task = (TDB*)GlobalLock16(hTask);
+ TDB* task;
+ if( !pTopPWnd ) return 0;
+
+ if( !hTask )
+ {
+ task = (TDB*)GlobalLock16( (hTask = GetCurrentTask()) );
+ if( task && task->hQueue == pTopPWnd->hmemTaskQ )
+ hTask = TASK_GetNextTask(hTask);
+ else return 0;
+ }
+
+ task = (TDB*)GlobalLock16(hTask);
if( !task ) return 0;
/* if this task got as far as menu tracking it must have a queue */
@@ -802,7 +840,7 @@
pTopPWnd = WIN_FindWndPtr(CreateWindow16( POPUPMENU_CLASS_ATOM, NULL,
WS_POPUP | WS_BORDER, x, y,
width, height,
- 0, 0, wndPtr->hInstance,
+ hwndOwner, 0, wndPtr->hInstance,
(LPVOID)(HMENU32)hmenu ));
if (!pTopPWnd) return FALSE;
skip_init = TRUE;
@@ -851,7 +889,7 @@
BOOL sendMenuSelect )
{
LPPOPUPMENU lppop;
- HDC hdc;
+ HDC32 hdc;
lppop = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
if (!lppop->nItems) return;
@@ -860,8 +898,8 @@
(lppop->items[wIndex].item_flags & MF_SEPARATOR))
wIndex = NO_SELECTED_ITEM;
if (lppop->FocusedItem == wIndex) return;
- if (lppop->wFlags & MF_POPUP) hdc = GetDC( lppop->hWnd );
- else hdc = GetDCEx( lppop->hWnd, 0, DCX_CACHE | DCX_WINDOW);
+ if (lppop->wFlags & MF_POPUP) hdc = GetDC32( lppop->hWnd );
+ else hdc = GetDCEx32( lppop->hWnd, 0, DCX_CACHE | DCX_WINDOW);
/* Clear previous highlighted item */
if (lppop->FocusedItem != NO_SELECTED_ITEM)
@@ -903,7 +941,7 @@
SendMessage16( hwndOwner, WM_MENUSELECT, hmenu,
MAKELONG( lppop->wFlags | MF_MOUSESELECT, hmenu ) );
- ReleaseDC( lppop->hWnd, hdc );
+ ReleaseDC32( lppop->hWnd, hdc );
}
@@ -1187,6 +1225,8 @@
if (menu->FocusedItem == NO_SELECTED_ITEM) return hmenu;
if (menu->FocusedItem == SYSMENU_SELECTED)
{
+ MENU_InitSysMenuPopup(wndPtr->hSysMenu, wndPtr->dwStyle,
+ wndPtr->class->style);
MENU_ShowPopup(hwndOwner, wndPtr->hSysMenu, 0, wndPtr->rectClient.left,
wndPtr->rectClient.top - menu->Height - 2*SYSMETRICS_CYBORDER,
SYSMETRICS_CXSIZE, SYSMETRICS_CYSIZE );
@@ -1445,23 +1485,21 @@
if( (menu->wFlags & (MF_POPUP | MF_SYSMENU)) == (MF_POPUP | MF_SYSMENU) )
{
- HDC hdc;
-
ShowWindow( menu->hWnd, SW_HIDE );
uSubPWndLevel = 0;
if( !IsIconic( *hwndOwner ) )
{
- hdc = GetDCEx( *hwndOwner, 0, DCX_CACHE | DCX_WINDOW);
+ HDC32 hdc = GetDCEx32( *hwndOwner, 0, DCX_CACHE | DCX_WINDOW);
NC_DrawSysButton( *hwndOwner, hdc, FALSE );
- ReleaseDC( *hwndOwner, hdc );
+ ReleaseDC32( *hwndOwner, hdc );
}
}
ReleaseCapture();
*hwndOwner = HIWORD(l);
*hmenu = LOWORD(l);
- SetCapture( *hwndOwner );
+ SetCapture32( *hwndOwner );
menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( *hmenu );
@@ -1484,9 +1522,9 @@
if( !IsIconic( *hwndOwner ) )
{
- HDC hdc = GetDCEx( *hwndOwner, 0, DCX_CACHE | DCX_WINDOW);
+ HDC32 hdc = GetDCEx32( *hwndOwner, 0, DCX_CACHE | DCX_WINDOW);
NC_DrawSysButton( *hwndOwner, hdc, TRUE );
- ReleaseDC( *hwndOwner, hdc );
+ ReleaseDC32( *hwndOwner, hdc );
}
}
}
@@ -1618,7 +1656,7 @@
POINT16 pt = { x, y };
MENU_ButtonDown( hwnd, hmenu, &hmenuCurrent, pt );
}
- SetCapture( hwnd );
+ SetCapture32( hwnd );
while (!fClosed)
{
if (!MSG_InternalGetMessage( &msg, 0, hwnd, MSGF_MENU, 0, TRUE ))
@@ -1918,7 +1956,7 @@
*/
if( hwnd == pTopPWnd->hwndSelf )
- pTopPWnd = 0;
+ { pTopPWnd = NULL; uSubPWndLevel = 0; }
else
uSubPWndLevel--;
break;
@@ -1940,7 +1978,7 @@
*/
UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth, int orgX, int orgY )
{
- HDC hdc;
+ HDC32 hdc;
RECT16 rectBar;
WND *wndPtr;
LPPOPUPMENU lppop;
@@ -1948,10 +1986,10 @@
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
if (!(lppop = (LPPOPUPMENU)USER_HEAP_LIN_ADDR((HMENU)wndPtr->wIDmenu)))
return 0;
- hdc = GetDCEx( hwnd, 0, DCX_CACHE | DCX_WINDOW );
+ hdc = GetDCEx32( hwnd, 0, DCX_CACHE | DCX_WINDOW );
SetRect16(&rectBar, orgX, orgY, orgX+menubarWidth, orgY+SYSMETRICS_CYMENU);
MENU_MenuBarCalcSize( hdc, &rectBar, lppop, hwnd );
- ReleaseDC( hwnd, hdc );
+ ReleaseDC32( hwnd, hdc );
return lppop->Height;
}
@@ -2522,7 +2560,7 @@
return FALSE;
}
dprintf_menu(stddeb,"SetMenu(%04x, %04x);\n", hWnd, hMenu);
- if (GetCapture() == hWnd) ReleaseCapture();
+ if (GetCapture32() == hWnd) ReleaseCapture();
wndPtr->wIDmenu = (UINT)hMenu;
if (hMenu != 0)
{
diff --git a/controls/scroll.c b/controls/scroll.c
index 8b6fb07..34497fc 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -1,13 +1,11 @@
/*
- * Interface code to SCROLLBAR widget
+ * Scrollbar control
*
- * Copyright Martin Ayotte, 1993
- * Copyright Alexandre Julliard, 1994
- *
- * Small fixes and implemented SB_THUMBPOSITION
- * by Peter Broadhurst, 940611
+ * Copyright 1993 Martin Ayotte
+ * Copyright 1994, 1996 Alexandre Julliard
*/
+#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
@@ -23,18 +21,18 @@
#include "debug.h"
-static HBITMAP hUpArrow = 0;
-static HBITMAP hDnArrow = 0;
-static HBITMAP hLfArrow = 0;
-static HBITMAP hRgArrow = 0;
-static HBITMAP hUpArrowD = 0;
-static HBITMAP hDnArrowD = 0;
-static HBITMAP hLfArrowD = 0;
-static HBITMAP hRgArrowD = 0;
-static HBITMAP hUpArrowI = 0;
-static HBITMAP hDnArrowI = 0;
-static HBITMAP hLfArrowI = 0;
-static HBITMAP hRgArrowI = 0;
+static HBITMAP32 hUpArrow = 0;
+static HBITMAP32 hDnArrow = 0;
+static HBITMAP32 hLfArrow = 0;
+static HBITMAP32 hRgArrow = 0;
+static HBITMAP32 hUpArrowD = 0;
+static HBITMAP32 hDnArrowD = 0;
+static HBITMAP32 hLfArrowD = 0;
+static HBITMAP32 hRgArrowD = 0;
+static HBITMAP32 hUpArrowI = 0;
+static HBITMAP32 hDnArrowI = 0;
+static HBITMAP32 hLfArrowI = 0;
+static HBITMAP32 hRgArrowI = 0;
#define TOP_ARROW(flags,pressed) \
(((flags)&ESB_DISABLE_UP) ? hUpArrowI : ((pressed) ? hUpArrowD:hUpArrow))
@@ -49,6 +47,9 @@
/* Minimum size of the rectangle between the arrows */
#define SCROLL_MIN_RECT 4
+ /* Minimum size of the thumb in pixels */
+#define SCROLL_MIN_THUMB 4
+
/* Delay (in ms) before first repetition when holding the button down */
#define SCROLL_FIRST_DELAY 200
@@ -70,34 +71,38 @@
};
/* Thumb-tracking info */
-static HWND hwndTracking = 0;
-static int nBarTracking = 0;
-static UINT uTrackingPos = 0;
+static HWND32 SCROLL_TrackingWin = 0;
+static INT32 SCROLL_TrackingBar = 0;
+static INT32 SCROLL_TrackingPos = 0;
+static INT32 SCROLL_TrackingVal = 0;
+
+/* Is the moving thumb being displayed? */
+static BOOL32 SCROLL_MovingThumb = FALSE;
/***********************************************************************
* SCROLL_LoadBitmaps
*/
static void SCROLL_LoadBitmaps(void)
{
- hUpArrow = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROW));
- hDnArrow = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROW));
- hLfArrow = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROW));
- hRgArrow = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROW));
- hUpArrowD = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWD));
- hDnArrowD = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWD));
- hLfArrowD = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWD));
- hRgArrowD = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWD));
- hUpArrowI = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWI));
- hDnArrowI = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWI));
- hLfArrowI = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWI));
- hRgArrowI = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWI));
+ hUpArrow = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_UPARROW) );
+ hDnArrow = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_DNARROW) );
+ hLfArrow = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_LFARROW) );
+ hRgArrow = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RGARROW) );
+ hUpArrowD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_UPARROWD) );
+ hDnArrowD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_DNARROWD) );
+ hLfArrowD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_LFARROWD) );
+ hRgArrowD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RGARROWD) );
+ hUpArrowI = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_UPARROWI) );
+ hDnArrowI = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_DNARROWI) );
+ hLfArrowI = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_LFARROWI) );
+ hRgArrowI = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RGARROWI) );
}
/***********************************************************************
* SCROLL_GetPtrScrollInfo
*/
-static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( WND* wndPtr, int nBar )
+static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( WND* wndPtr, INT32 nBar )
{
SCROLLBAR_INFO *infoPtr;
@@ -114,7 +119,7 @@
{
if ((infoPtr = HeapAlloc( SystemHeap, 0, sizeof(SCROLLBAR_INFO) )))
{
- infoPtr->MinVal = infoPtr->CurVal = 0;
+ infoPtr->MinVal = infoPtr->CurVal = infoPtr->Page = 0;
infoPtr->MaxVal = 100;
infoPtr->flags = ESB_ENABLE_BOTH;
if (nBar == SB_HORZ) wndPtr->pHScroll = infoPtr;
@@ -129,7 +134,7 @@
/***********************************************************************
* SCROLL_GetScrollInfo
*/
-static SCROLLBAR_INFO *SCROLL_GetScrollInfo( HWND hwnd, int nBar )
+static SCROLLBAR_INFO *SCROLL_GetScrollInfo( HWND32 hwnd, INT32 nBar )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
return SCROLL_GetPtrScrollInfo( wndPtr, nBar );
@@ -141,16 +146,18 @@
*
* Compute the scroll bar rectangle, in drawing coordinates (i.e. client
* coords for SB_CTL, window coords for SB_VERT and SB_HORZ).
- * 'arrowSize' returns the width or height of an arrow (depending on the
- * orientation of the scrollbar), and 'thumbPos' returns the position of
- * the thumb relative to the left or to the top.
+ * 'arrowSize' returns the width or height of an arrow (depending on
+ * the orientation of the scrollbar), 'thumbSize' returns the size of
+ * the thumb, and 'thumbPos' returns the position of the thumb
+ * relative to the left or to the top.
* Return TRUE if the scrollbar is vertical, FALSE if horizontal.
*/
-static BOOL SCROLL_GetScrollBarRect( HWND hwnd, int nBar, RECT16 *lprect,
- WORD *arrowSize, WORD *thumbPos )
+static BOOL32 SCROLL_GetScrollBarRect( HWND32 hwnd, INT32 nBar, RECT32 *lprect,
+ INT32 *arrowSize, INT32 *thumbSize,
+ INT32 *thumbPos )
{
- int pixels;
- BOOL vertical;
+ INT32 pixels;
+ BOOL32 vertical;
WND *wndPtr = WIN_FindWndPtr( hwnd );
switch(nBar)
@@ -172,7 +179,7 @@
break;
case SB_CTL:
- GetClientRect16( hwnd, lprect );
+ GetClientRect32( hwnd, lprect );
vertical = ((wndPtr->dwStyle & SBS_VERT) != 0);
break;
@@ -183,28 +190,44 @@
if (vertical) pixels = lprect->bottom - lprect->top;
else pixels = lprect->right - lprect->left;
- if (pixels > 2*SYSMETRICS_CXVSCROLL + SCROLL_MIN_RECT)
+ if (pixels <= 2*SYSMETRICS_CXVSCROLL + SCROLL_MIN_RECT)
{
- *arrowSize = SYSMETRICS_CXVSCROLL;
+ if (pixels > SCROLL_MIN_RECT)
+ *arrowSize = (pixels - SCROLL_MIN_RECT) / 2;
+ else
+ *arrowSize = 0;
+ *thumbPos = *thumbSize = 0;
}
- else if (pixels > SCROLL_MIN_RECT)
- {
- *arrowSize = (pixels - SCROLL_MIN_RECT) / 2;
- }
- else *arrowSize = 0;
-
- if ((pixels -= 3*SYSMETRICS_CXVSCROLL+1) > 0)
+ else
{
SCROLLBAR_INFO *info = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
- if ((info->flags & ESB_DISABLE_BOTH) == ESB_DISABLE_BOTH)
- *thumbPos = 0;
- else if (info->MinVal == info->MaxVal)
- *thumbPos = *arrowSize;
+
+ *arrowSize = SYSMETRICS_CXVSCROLL;
+ pixels -= 2 * SYSMETRICS_CXVSCROLL;
+
+ if (info->Page)
+ {
+ *thumbSize = pixels * info->Page / (info->MaxVal-info->MinVal+1);
+ if (*thumbSize < SCROLL_MIN_THUMB) *thumbSize = SCROLL_MIN_THUMB;
+ }
+ else *thumbSize = SYSMETRICS_CXVSCROLL;
+
+ if (((pixels -= *thumbSize + 1) < 0) ||
+ ((info->flags & ESB_DISABLE_BOTH) == ESB_DISABLE_BOTH))
+ {
+ /* Rectangle too small or scrollbar disabled -> no thumb */
+ *thumbPos = *thumbSize = 0;
+ }
else
- *thumbPos = *arrowSize + pixels * (info->CurVal - info->MinVal) /
- (info->MaxVal - info->MinVal);
+ {
+ INT32 max = info->MaxVal - MAX( info->Page-1, 0 );
+ if (info->MinVal >= max)
+ *thumbPos = *arrowSize;
+ else
+ *thumbPos = *arrowSize + pixels * (info->CurVal-info->MinVal) /
+ (max - info->MinVal);
+ }
}
- else *thumbPos = 0;
return vertical;
}
@@ -215,20 +238,29 @@
* Compute the current scroll position based on the thumb position in pixels
* from the top of the scroll-bar.
*/
-static UINT SCROLL_GetThumbVal( SCROLLBAR_INFO *infoPtr, RECT16 *rect,
- BOOL vertical, WORD pos )
+static UINT32 SCROLL_GetThumbVal( SCROLLBAR_INFO *infoPtr, RECT32 *rect,
+ BOOL32 vertical, INT32 pos )
{
- int pixels = vertical ? rect->bottom-rect->top : rect->right-rect->left;
- if ((pixels -= 3*SYSMETRICS_CXVSCROLL+1) <= 0) return infoPtr->MinVal;
+ INT32 thumbSize;
+ INT32 pixels = vertical ? rect->bottom-rect->top : rect->right-rect->left;
+
+ if ((pixels -= 2*SYSMETRICS_CXVSCROLL) <= 0) return infoPtr->MinVal;
+
+ if (infoPtr->Page)
+ {
+ thumbSize = pixels * infoPtr->Page/(infoPtr->MaxVal-infoPtr->MinVal+1);
+ if (thumbSize < SCROLL_MIN_THUMB) thumbSize = SCROLL_MIN_THUMB;
+ }
+ else thumbSize = SYSMETRICS_CXVSCROLL;
+
+ if ((pixels -= thumbSize + 1) <= 0) return infoPtr->MinVal;
+
pos = MAX( 0, pos - SYSMETRICS_CXVSCROLL );
if (pos > pixels) pos = pixels;
- dprintf_scroll(stddeb,"GetThumbVal: pos=%d ret=%d\n", pos,
- (infoPtr->MinVal
- + (UINT)(((int)pos * (infoPtr->MaxVal-infoPtr->MinVal) + pixels/2)
- / pixels)) );
- return (infoPtr->MinVal
- + (UINT)(((int)pos * (infoPtr->MaxVal-infoPtr->MinVal) + pixels/2)
- / pixels));
+
+ if (!infoPtr->Page) pos *= infoPtr->MaxVal - infoPtr->MinVal;
+ else pos *= infoPtr->MaxVal - infoPtr->MinVal - infoPtr->Page + 1;
+ return infoPtr->MinVal + ((pos + pixels / 2) / pixels);
}
@@ -237,14 +269,15 @@
*
* Scroll-bar hit testing (don't confuse this with WM_NCHITTEST!).
*/
-static enum SCROLL_HITTEST SCROLL_HitTest( HWND hwnd, int nBar, POINT16 pt )
+static enum SCROLL_HITTEST SCROLL_HitTest( HWND32 hwnd, INT32 nBar,
+ POINT32 pt )
{
- WORD arrowSize, thumbPos;
- RECT16 rect;
+ INT32 arrowSize, thumbSize, thumbPos;
+ RECT32 rect;
- BOOL vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
- &arrowSize, &thumbPos );
- if (!PtInRect16( &rect, pt )) return SCROLL_NOWHERE;
+ BOOL32 vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
+ &arrowSize, &thumbSize, &thumbPos );
+ if (!PtInRect32( &rect, pt )) return SCROLL_NOWHERE;
if (vertical)
{
@@ -252,8 +285,8 @@
if (pt.y >= rect.bottom - arrowSize) return SCROLL_BOTTOM_ARROW;
if (!thumbPos) return SCROLL_TOP_RECT;
pt.y -= rect.top;
- if (pt.y < (INT)thumbPos) return SCROLL_TOP_RECT;
- if (pt.y > thumbPos+SYSMETRICS_CYHSCROLL) return SCROLL_BOTTOM_RECT;
+ if (pt.y < thumbPos) return SCROLL_TOP_RECT;
+ if (pt.y > thumbPos + thumbSize) return SCROLL_BOTTOM_RECT;
return SCROLL_THUMB;
}
else /* horizontal */
@@ -262,8 +295,8 @@
if (pt.x >= rect.right - arrowSize) return SCROLL_BOTTOM_ARROW;
if (!thumbPos) return SCROLL_TOP_RECT;
pt.x -= rect.left;
- if (pt.x < (INT)thumbPos) return SCROLL_TOP_RECT;
- if (pt.x > thumbPos+SYSMETRICS_CXVSCROLL) return SCROLL_BOTTOM_RECT;
+ if (pt.x < thumbPos) return SCROLL_TOP_RECT;
+ if (pt.x > thumbPos + thumbSize) return SCROLL_BOTTOM_RECT;
return SCROLL_THUMB;
}
}
@@ -274,12 +307,12 @@
*
* Draw the scroll bar arrows.
*/
-static void SCROLL_DrawArrows( HDC hdc, SCROLLBAR_INFO *infoPtr, RECT16 *rect,
- WORD arrowSize, BOOL vertical,
- BOOL top_pressed, BOOL bottom_pressed )
+static void SCROLL_DrawArrows( HDC32 hdc, SCROLLBAR_INFO *infoPtr,
+ RECT32 *rect, INT32 arrowSize, BOOL32 vertical,
+ BOOL32 top_pressed, BOOL32 bottom_pressed )
{
- HDC hdcMem = CreateCompatibleDC( hdc );
- HBITMAP hbmpPrev = SelectObject( hdcMem, vertical ?
+ HDC32 hdcMem = CreateCompatibleDC( hdc );
+ HBITMAP32 hbmpPrev = SelectObject( hdcMem, vertical ?
TOP_ARROW(infoPtr->flags, top_pressed)
: LEFT_ARROW(infoPtr->flags, top_pressed));
SetStretchBltMode( hdc, STRETCH_DELETESCANS );
@@ -315,28 +348,29 @@
*
* Draw the moving thumb rectangle.
*/
-static void SCROLL_DrawMovingThumb( HDC hdc, RECT16 *rect, BOOL vertical,
- WORD arrowSize, WORD thumbPos )
+static void SCROLL_DrawMovingThumb( HDC32 hdc, RECT32 *rect, BOOL32 vertical,
+ INT32 arrowSize, INT32 thumbSize )
{
- RECT16 r = *rect;
+ RECT32 r = *rect;
if (vertical)
{
- r.top += thumbPos;
+ r.top += SCROLL_TrackingPos;
if (r.top < rect->top + arrowSize) r.top = rect->top + arrowSize;
- if (r.top + SYSMETRICS_CYHSCROLL >= rect->bottom - arrowSize)
- r.top = rect->bottom - arrowSize - SYSMETRICS_CYHSCROLL - 1;
- r.bottom = r.top + SYSMETRICS_CYHSCROLL + 1;
+ if (r.top + thumbSize >= rect->bottom - arrowSize)
+ r.top = rect->bottom - arrowSize - thumbSize - 1;
+ r.bottom = r.top + thumbSize + 1;
}
else
{
- r.left += thumbPos;
+ r.left += SCROLL_TrackingPos;
if (r.left < rect->left + arrowSize) r.left = rect->left + arrowSize;
- if (r.left + SYSMETRICS_CXVSCROLL >= rect->right - arrowSize)
- r.left = rect->right - arrowSize - SYSMETRICS_CXVSCROLL - 1;
- r.right = r.left + SYSMETRICS_CXVSCROLL + 1;
+ if (r.left + thumbSize >= rect->right - arrowSize)
+ r.left = rect->right - arrowSize - thumbSize - 1;
+ r.right = r.left + thumbSize + 1;
}
- InflateRect16( &r, -1, -1 );
- DrawFocusRect16( hdc, &r );
+ InflateRect32( &r, -1, -1 );
+ DrawFocusRect32( hdc, &r );
+ SCROLL_MovingThumb = !SCROLL_MovingThumb;
}
@@ -345,12 +379,13 @@
*
* Draw the scroll bar interior (everything except the arrows).
*/
-static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, int nBar, RECT16 *rect,
- WORD arrowSize, WORD thumbPos, WORD flags,
- BOOL vertical, BOOL top_selected,
- BOOL bottom_selected )
+static void SCROLL_DrawInterior( HWND32 hwnd, HDC32 hdc, INT32 nBar,
+ RECT32 *rect, INT32 arrowSize,
+ INT32 thumbSize, INT32 thumbPos,
+ UINT32 flags, BOOL32 vertical,
+ BOOL32 top_selected, BOOL32 bottom_selected )
{
- RECT16 r;
+ RECT32 r;
/* Select the correct brush and pen */
@@ -364,8 +399,8 @@
{
if (nBar == SB_CTL) /* Only scrollbar controls send WM_CTLCOLOR */
{
- HBRUSH hbrush = SendMessage32A( GetParent32(hwnd),
- WM_CTLCOLORSCROLLBAR, hdc, hwnd );
+ HBRUSH32 hbrush = SendMessage32A(GetParent32(hwnd),
+ WM_CTLCOLORSCROLLBAR, hdc, hwnd );
SelectObject( hdc, hbrush );
}
else SelectObject( hdc, sysColorObjects.hbrushScrollbar );
@@ -409,11 +444,11 @@
thumbPos - arrowSize,
top_selected ? 0x0f0000 : PATCOPY );
r.top += thumbPos - arrowSize;
- PatBlt( hdc, r.left + 1, r.top + SYSMETRICS_CYHSCROLL + 1,
+ PatBlt( hdc, r.left + 1, r.top + thumbSize + 1,
r.right - r.left - 2,
- r.bottom - r.top - SYSMETRICS_CYHSCROLL - 2,
+ r.bottom - r.top - thumbSize - 2,
bottom_selected ? 0x0f0000 : PATCOPY );
- r.bottom = r.top + SYSMETRICS_CYHSCROLL + 1;
+ r.bottom = r.top + thumbSize + 1;
}
else /* horizontal */
{
@@ -422,21 +457,26 @@
r.bottom - r.top - 2,
top_selected ? 0x0f0000 : PATCOPY );
r.left += thumbPos - arrowSize;
- PatBlt( hdc, r.left + SYSMETRICS_CYHSCROLL + 1, r.top + 1,
- r.right - r.left - SYSMETRICS_CYHSCROLL - 2,
+ PatBlt( hdc, r.left + thumbSize + 1, r.top + 1,
+ r.right - r.left - thumbSize - 2,
r.bottom - r.top - 2,
bottom_selected ? 0x0f0000 : PATCOPY );
- r.right = r.left + SYSMETRICS_CXVSCROLL + 1;
+ r.right = r.left + thumbSize + 1;
}
/* Draw the thumb */
SelectObject( hdc, sysColorObjects.hbrushBtnFace );
Rectangle( hdc, r.left, r.top, r.right, r.bottom );
- InflateRect16( &r, -1, -1 );
+ InflateRect32( &r, -1, -1 );
GRAPH_DrawReliefRect( hdc, &r, 1, 2, FALSE );
- if ((hwndTracking == hwnd) && (nBarTracking == nBar))
- SCROLL_DrawMovingThumb( hdc, rect, vertical, arrowSize, uTrackingPos);
+ if (SCROLL_MovingThumb &&
+ (SCROLL_TrackingWin == hwnd) &&
+ (SCROLL_TrackingBar == nBar))
+ {
+ SCROLL_DrawMovingThumb( hdc, rect, vertical, arrowSize, thumbSize );
+ SCROLL_MovingThumb = TRUE;
+ }
}
@@ -445,11 +485,11 @@
*
* Redraw the whole scrollbar.
*/
-void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, int nBar )
+void SCROLL_DrawScrollBar( HWND32 hwnd, HDC32 hdc, INT32 nBar, BOOL32 arrows )
{
- WORD arrowSize, thumbPos;
- RECT16 rect;
- BOOL vertical;
+ INT32 arrowSize, thumbSize, thumbPos;
+ RECT32 rect;
+ BOOL32 vertical;
WND *wndPtr = WIN_FindWndPtr( hwnd );
SCROLLBAR_INFO *infoPtr = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
@@ -458,14 +498,14 @@
((nBar == SB_HORZ) && !(wndPtr->dwStyle & WS_HSCROLL))) return;
vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
- &arrowSize, &thumbPos );
+ &arrowSize, &thumbSize, &thumbPos );
/* Draw the arrows */
- if (arrowSize) SCROLL_DrawArrows( hdc, infoPtr, &rect, arrowSize,
- vertical, FALSE, FALSE );
+ if (arrows && arrowSize) SCROLL_DrawArrows( hdc, infoPtr, &rect, arrowSize,
+ vertical, FALSE, FALSE );
- SCROLL_DrawInterior( hwnd, hdc, nBar, &rect, arrowSize, thumbPos,
- infoPtr->flags, vertical, FALSE, FALSE );
+ SCROLL_DrawInterior( hwnd, hdc, nBar, &rect, arrowSize, thumbSize,
+ thumbPos, infoPtr->flags, vertical, FALSE, FALSE );
}
@@ -475,26 +515,13 @@
* Repaint the scroll bar interior after a SetScrollRange() or
* SetScrollPos() call.
*/
-static void SCROLL_RefreshScrollBar( HWND hwnd, int nBar )
+static void SCROLL_RefreshScrollBar( HWND32 hwnd, INT32 nBar, BOOL32 arrows )
{
- WORD arrowSize, thumbPos;
- RECT16 rect;
- BOOL vertical;
- HDC hdc;
- WND *wndPtr = WIN_FindWndPtr( hwnd );
- SCROLLBAR_INFO *infoPtr = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
-
- if (!wndPtr || !infoPtr ||
- ((nBar == SB_VERT) && !(wndPtr->dwStyle & WS_VSCROLL)) ||
- ((nBar == SB_HORZ) && !(wndPtr->dwStyle & WS_HSCROLL))) return;
-
- vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
- &arrowSize, &thumbPos );
- hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
+ HDC32 hdc = GetDCEx32( hwnd, 0,
+ DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
if (!hdc) return;
- SCROLL_DrawInterior( hwnd, hdc, nBar, &rect, arrowSize, thumbPos,
- infoPtr->flags, vertical, FALSE, FALSE );
- ReleaseDC( hwnd, hdc );
+ SCROLL_DrawScrollBar( hwnd, hdc, nBar, arrows );
+ ReleaseDC32( hwnd, hdc );
}
@@ -503,10 +530,10 @@
*
* Handle a keyboard event (only for SB_CTL scrollbars).
*/
-static void SCROLL_HandleKbdEvent( HWND hwnd, WORD wParam )
+static void SCROLL_HandleKbdEvent( HWND32 hwnd, WPARAM32 wParam )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
- WPARAM msg;
+ WPARAM32 msg;
switch(wParam)
{
@@ -532,33 +559,33 @@
* 'pt' is the location of the mouse event in client (for SB_CTL) or
* windows coordinates.
*/
-void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT16 pt )
+void SCROLL_HandleScrollEvent( HWND32 hwnd, INT32 nBar, UINT32 msg, POINT32 pt)
{
/* Previous mouse position for timer events */
- static POINT16 prevPt;
+ static POINT32 prevPt;
/* Hit test code of the last button-down event */
static enum SCROLL_HITTEST trackHitTest;
/* Thumb position when tracking started. */
- static UINT trackThumbPos;
+ static UINT32 trackThumbPos;
/* Position in the scroll-bar of the last button-down event. */
- static int lastClickPos;
+ static INT32 lastClickPos;
/* Position in the scroll-bar of the last mouse event. */
- static int lastMousePos;
+ static INT32 lastMousePos;
enum SCROLL_HITTEST hittest;
- HWND hwndOwner, hwndCtl;
- BOOL vertical;
- WORD arrowSize, thumbPos;
- RECT16 rect;
- HDC hdc;
+ HWND32 hwndOwner, hwndCtl;
+ BOOL32 vertical;
+ INT32 arrowSize, thumbSize, thumbPos;
+ RECT32 rect;
+ HDC32 hdc;
SCROLLBAR_INFO *infoPtr = SCROLL_GetScrollInfo( hwnd, nBar );
if (!infoPtr) return;
if ((trackHitTest == SCROLL_NOWHERE) && (msg != WM_LBUTTONDOWN)) return;
- hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
+ hdc = GetDCEx32( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW));
vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
- &arrowSize, &thumbPos );
+ &arrowSize, &thumbSize, &thumbPos );
hwndOwner = (nBar == SB_CTL) ? GetParent32(hwnd) : hwnd;
hwndCtl = (nBar == SB_CTL) ? hwnd : 0;
@@ -570,7 +597,7 @@
lastMousePos = lastClickPos;
trackThumbPos = thumbPos;
prevPt = pt;
- SetCapture( hwnd );
+ SetCapture32( hwnd );
if (nBar == SB_CTL) SetFocus32( hwnd );
break;
@@ -619,8 +646,8 @@
break;
case SCROLL_TOP_RECT:
- SCROLL_DrawInterior( hwnd, hdc, nBar, &rect, arrowSize, thumbPos,
- infoPtr->flags, vertical,
+ SCROLL_DrawInterior( hwnd, hdc, nBar, &rect, arrowSize, thumbSize,
+ thumbPos, infoPtr->flags, vertical,
(hittest == trackHitTest), FALSE );
if (hittest == trackHitTest)
{
@@ -639,43 +666,46 @@
case SCROLL_THUMB:
if (msg == WM_LBUTTONDOWN)
{
- SCROLL_DrawMovingThumb( hdc, &rect, vertical, arrowSize,
- trackThumbPos + lastMousePos - lastClickPos );
- hwndTracking = hwnd;
- nBarTracking = nBar;
+ SCROLL_TrackingWin = hwnd;
+ SCROLL_TrackingBar = nBar;
+ SCROLL_TrackingPos = trackThumbPos + lastMousePos - lastClickPos;
+ SCROLL_DrawMovingThumb(hdc, &rect, vertical, arrowSize, thumbSize);
}
else if (msg == WM_LBUTTONUP)
{
- hwndTracking = 0;
- SCROLL_DrawInterior( hwnd, hdc, nBar, &rect, arrowSize, thumbPos,
- infoPtr->flags, vertical, FALSE, FALSE );
+ SCROLL_TrackingWin = 0;
+ SCROLL_MovingThumb = FALSE;
+ SCROLL_DrawInterior( hwnd, hdc, nBar, &rect, arrowSize, thumbSize,
+ thumbPos, infoPtr->flags, vertical,
+ FALSE, FALSE );
}
else /* WM_MOUSEMOVE */
{
- UINT pos, val;
+ UINT32 pos;
- if (!PtInRect16( &rect, pt )) pos = lastClickPos;
+ if (!PtInRect32( &rect, pt )) pos = lastClickPos;
else pos = vertical ? (pt.y - rect.top) : (pt.x - rect.left);
if (pos != lastMousePos)
{
- SCROLL_DrawMovingThumb( hdc, &rect, vertical, arrowSize,
- trackThumbPos + lastMousePos - lastClickPos );
- lastMousePos = pos;
- val = SCROLL_GetThumbVal( infoPtr, &rect, vertical,
- trackThumbPos + lastMousePos - lastClickPos );
- /* Save tracking info */
- uTrackingPos = trackThumbPos + pos - lastClickPos;
- SendMessage32A( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
- MAKEWPARAM( SB_THUMBTRACK, val ), hwndCtl );
SCROLL_DrawMovingThumb( hdc, &rect, vertical,
- arrowSize, uTrackingPos );
+ arrowSize, thumbSize );
+ lastMousePos = pos;
+ SCROLL_TrackingPos = trackThumbPos + pos - lastClickPos;
+ SCROLL_TrackingVal = SCROLL_GetThumbVal( infoPtr, &rect,
+ vertical,
+ SCROLL_TrackingPos );
+ SendMessage32A( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
+ MAKEWPARAM( SB_THUMBTRACK, SCROLL_TrackingVal),
+ hwndCtl );
+ SCROLL_DrawMovingThumb( hdc, &rect, vertical,
+ arrowSize, thumbSize );
}
}
break;
case SCROLL_BOTTOM_RECT:
- SCROLL_DrawInterior( hwnd, hdc, nBar, &rect, arrowSize, thumbPos,
- infoPtr->flags, vertical,
+ SCROLL_DrawInterior( hwnd, hdc, nBar, &rect, arrowSize, thumbSize,
+ thumbPos, infoPtr->flags, vertical,
FALSE, (hittest == trackHitTest) );
if (hittest == trackHitTest)
{
@@ -713,7 +743,7 @@
{
if (trackHitTest == SCROLL_THUMB)
{
- UINT val = SCROLL_GetThumbVal( infoPtr, &rect, vertical,
+ UINT32 val = SCROLL_GetThumbVal( infoPtr, &rect, vertical,
trackThumbPos + lastMousePos - lastClickPos );
SendMessage32A( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
MAKEWPARAM( SB_THUMBPOSITION, val ), hwndCtl );
@@ -724,20 +754,21 @@
trackHitTest = SCROLL_NOWHERE; /* Terminate tracking */
}
- ReleaseDC( hwnd, hdc );
+ ReleaseDC32( hwnd, hdc );
}
/***********************************************************************
* ScrollBarWndProc
*/
-LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
+LRESULT ScrollBarWndProc( HWND32 hwnd, UINT32 message, WPARAM32 wParam,
+ LPARAM lParam )
{
switch(message)
{
case WM_CREATE:
{
- CREATESTRUCT16 *lpCreat = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
+ CREATESTRUCT32A *lpCreat = (CREATESTRUCT32A *)lParam;
if (lpCreat->style & SBS_SIZEBOX)
{
fprintf( stdnimp, "Unimplemented style SBS_SIZEBOX.\n" );
@@ -775,7 +806,11 @@
case WM_LBUTTONUP:
case WM_MOUSEMOVE:
case WM_SYSTIMER:
- SCROLL_HandleScrollEvent( hwnd, SB_CTL, message, MAKEPOINT16(lParam) );
+ {
+ POINT32 pt;
+ CONV_POINT16TO32( (POINT16 *)&lParam, &pt );
+ SCROLL_HandleScrollEvent( hwnd, SB_CTL, message, pt );
+ }
break;
case WM_KEYDOWN:
@@ -790,64 +825,265 @@
case WM_PAINT:
{
- PAINTSTRUCT16 ps;
- HDC16 hdc = BeginPaint16( hwnd, &ps );
- SCROLL_DrawScrollBar( hwnd, hdc, SB_CTL );
- EndPaint16( hwnd, &ps );
+ PAINTSTRUCT32 ps;
+ HDC32 hdc = BeginPaint32( hwnd, &ps );
+ SCROLL_DrawScrollBar( hwnd, hdc, SB_CTL, TRUE );
+ EndPaint32( hwnd, &ps );
}
break;
- case SBM_SETSCROLLPOS:
- return SetScrollPos( hwnd, SB_CTL, wParam, (BOOL)lParam );
+ case SBM_SETPOS16:
+ case SBM_SETPOS32:
+ return SetScrollPos32( hwnd, SB_CTL, wParam, (BOOL32)lParam );
- case SBM_GETSCROLLPOS:
- return GetScrollPos( hwnd, SB_CTL );
+ case SBM_GETPOS16:
+ case SBM_GETPOS32:
+ return GetScrollPos32( hwnd, SB_CTL );
- case SBM_SETSCROLLRANGE:
- SetScrollRange( hwnd, SB_CTL, LOWORD(lParam), HIWORD(lParam),
- wParam /* FIXME: Is this correct? */ );
+ case SBM_SETRANGE16:
+ SetScrollRange32( hwnd, SB_CTL, LOWORD(lParam), HIWORD(lParam),
+ wParam /* FIXME: Is this correct? */ );
return 0;
- case SBM_ENABLE:
- return EnableScrollBar( hwnd, SB_CTL, wParam ); /* FIXME: lParam? */
+ case SBM_SETRANGE32:
+ SetScrollRange32( hwnd, SB_CTL, wParam, lParam, FALSE );
+ return 0; /* FIXME: return previous position */
- case 0x403: /* SBM_REDRAW */
- fprintf(stdnimp,"ScrollBarWndProc: undocumented message %04x, please report\n", message );
+ case SBM_GETRANGE16:
+ /* FIXME */
+ fprintf( stderr, "ScrollBar: don't know how to handle SBM_GETRANGE16 (wp=%04x,lp=%08lx)\n",
+ wParam, lParam );
+ return 0;
+
+ case SBM_GETRANGE32:
+ GetScrollRange32( hwnd, SB_CTL, (LPINT32)wParam, (LPINT32)lParam );
+ return 0;
+
+ case SBM_ENABLE_ARROWS16:
+ case SBM_ENABLE_ARROWS32:
+ return EnableScrollBar32( hwnd, SB_CTL, wParam );
+
+ case SBM_SETRANGEREDRAW32:
+ SetScrollRange32( hwnd, SB_CTL, wParam, lParam, TRUE );
+ return 0; /* FIXME: return previous position */
+
+ case SBM_SETSCROLLINFO32:
+ return SetScrollInfo32( hwnd, SB_CTL, (SCROLLINFO *)lParam, wParam );
+
+ case SBM_GETSCROLLINFO32:
+ return GetScrollInfo32( hwnd, SB_CTL, (SCROLLINFO *)lParam );
+
+ case 0x00e5:
+ case 0x00e7:
+ case 0x00e8:
+ case 0x00eb:
+ case 0x00ec:
+ case 0x00ed:
+ case 0x00ee:
+ case 0x00ef:
+ fprintf(stderr, "ScrollBar: unknown Win32 msg %04x wp=%08x lp=%08lx\n",
+ message, wParam, lParam );
break;
default:
- return DefWindowProc16( hwnd, message, wParam, lParam );
+ if (message >= WM_USER)
+ fprintf( stderr, "ScrollBar: unknown msg %04x wp=%04x lp=%08lx\n",
+ message, wParam, lParam );
+ return DefWindowProc32A( hwnd, message, wParam, lParam );
}
return 0;
}
/*************************************************************************
- * SetScrollPos (USER.62)
+ * SetScrollInfo16 (USER.475)
*/
-int SetScrollPos( HWND hwnd, int nBar, int nPos, BOOL bRedraw )
+INT16 SetScrollInfo16( HWND16 hwnd, INT16 nBar, const SCROLLINFO *info,
+ BOOL16 bRedraw )
+{
+ return (INT16)SetScrollInfo32( hwnd, nBar, info, bRedraw );
+}
+
+
+/*************************************************************************
+ * SetScrollInfo32 (USER32.500)
+ */
+INT32 SetScrollInfo32( HWND32 hwnd, INT32 nBar, const SCROLLINFO *info,
+ BOOL32 bRedraw )
{
SCROLLBAR_INFO *infoPtr;
- INT oldPos;
+ UINT32 new_flags;
+ BOOL32 repaint_arrows = FALSE;
+
+ if (!(infoPtr = SCROLL_GetScrollInfo(hwnd, nBar))) return 0;
+ if (info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL)) return 0;
+ if ((info->cbSize != sizeof(*info)) &&
+ (info->cbSize != sizeof(*info)-sizeof(info->nTrackPos))) return 0;
+
+ dprintf_scroll( stddeb, "SetScrollInfo: hwnd=%04x bar=%d", hwnd, nBar );
+
+ /* Set the page size */
+
+ if (info->fMask & SIF_PAGE)
+ {
+ dprintf_scroll( stddeb, " page=%d", info->nPage );
+ infoPtr->Page = info->nPage;
+ }
+
+ /* Set the scroll pos */
+
+ if (info->fMask & SIF_POS)
+ {
+ dprintf_scroll( stddeb, " pos=%d", info->nPos );
+ infoPtr->CurVal = info->nPos;
+ }
+
+ /* Set the scroll range */
+
+ if (info->fMask & SIF_RANGE)
+ {
+ dprintf_scroll( stddeb, " min=%d max=%d", info->nMin, info->nMax );
+
+ /* Invalid range -> range is set to (0,0) */
+ if ((info->nMin > info->nMax) ||
+ ((UINT32)(info->nMax - info->nMin) >= 0x80000000))
+ {
+ infoPtr->MinVal = 0;
+ infoPtr->MaxVal = 0;
+ }
+ else
+ {
+ infoPtr->MinVal = info->nMin;
+ infoPtr->MaxVal = info->nMax;
+ }
+ }
+
+ /* Make sure the page size is valid */
+
+ if (infoPtr->Page < 0) infoPtr->Page = 0;
+ else if (infoPtr->Page > infoPtr->MaxVal - infoPtr->MinVal + 1 )
+ infoPtr->Page = infoPtr->MaxVal - infoPtr->MinVal + 1;
+
+ /* Make sure the pos is inside the range */
+
+ if (infoPtr->CurVal < infoPtr->MinVal)
+ infoPtr->CurVal = infoPtr->MinVal;
+ else if (infoPtr->CurVal > infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 ))
+ infoPtr->CurVal = infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 );
+
+ dprintf_scroll( stddeb, "\n new values: page=%d pos=%d min=%d max=%d\n",
+ infoPtr->Page, infoPtr->CurVal,
+ infoPtr->MinVal, infoPtr->MaxVal );
+
+ /* Check if the scrollbar should be hidden or disabled */
+
+ new_flags = infoPtr->flags;
+ if (infoPtr->MinVal >= infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 ))
+ {
+ /* Hide or disable scroll-bar */
+ if (info->fMask & SIF_DISABLENOSCROLL) new_flags = ESB_DISABLE_BOTH;
+ else if (nBar != SB_CTL)
+ {
+ ShowScrollBar32( hwnd, nBar, FALSE );
+ bRedraw = FALSE; /* No need to repaint anything */
+ }
+ }
+ else /* Show and enable scroll-bar */
+ {
+ new_flags = 0;
+ if (nBar != SB_CTL) ShowScrollBar32( hwnd, nBar, TRUE );
+ }
+
+ if (infoPtr->flags != new_flags)
+ {
+ infoPtr->flags = new_flags;
+ repaint_arrows = TRUE;
+ }
+
+ if (bRedraw || repaint_arrows)
+ SCROLL_RefreshScrollBar( hwnd, nBar, repaint_arrows );
+
+ /* Return current position */
+
+ return infoPtr->CurVal;
+}
+
+
+/*************************************************************************
+ * GetScrollInfo16 (USER.476)
+ */
+BOOL16 GetScrollInfo16( HWND16 hwnd, INT16 nBar, LPSCROLLINFO info )
+{
+ return GetScrollInfo32( hwnd, nBar, info );
+}
+
+
+/*************************************************************************
+ * GetScrollInfo32 (USER32.283)
+ */
+BOOL32 GetScrollInfo32( HWND32 hwnd, INT32 nBar, LPSCROLLINFO info )
+{
+ SCROLLBAR_INFO *infoPtr;
+
+ if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE;
+ if (info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL)) return FALSE;
+ if ((info->cbSize != sizeof(*info)) &&
+ (info->cbSize != sizeof(*info)-sizeof(info->nTrackPos))) return FALSE;
+
+ if (info->fMask & SIF_PAGE) info->nPage = infoPtr->Page;
+ if (info->fMask & SIF_POS) info->nPos = infoPtr->CurVal;
+ if ((info->fMask & SIF_TRACKPOS) && (info->cbSize == sizeof(*info)))
+ info->nTrackPos = (SCROLL_TrackingWin==hwnd) ? SCROLL_TrackingVal : 0;
+ if (info->fMask & SIF_RANGE)
+ {
+ info->nMin = infoPtr->MinVal;
+ info->nMax = infoPtr->MaxVal;
+ }
+ return (info->fMask & SIF_ALL) != 0;
+}
+
+
+/*************************************************************************
+ * SetScrollPos16 (USER.62)
+ */
+INT16 SetScrollPos16( HWND16 hwnd, INT16 nBar, INT16 nPos, BOOL16 bRedraw )
+{
+ return (INT16)SetScrollPos32( hwnd, nBar, nPos, bRedraw );
+}
+
+
+/*************************************************************************
+ * SetScrollPos32 (USER32.501)
+ */
+INT32 SetScrollPos32( HWND32 hwnd, INT32 nBar, INT32 nPos, BOOL32 bRedraw )
+{
+ SCROLLINFO info;
+ SCROLLBAR_INFO *infoPtr;
+ INT32 oldPos;
if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return 0;
-
- dprintf_scroll( stddeb,"SetScrollPos min=%d max=%d pos=%d\n",
- infoPtr->MinVal, infoPtr->MaxVal, nPos );
-
- if (nPos < infoPtr->MinVal) nPos = infoPtr->MinVal;
- else if (nPos > infoPtr->MaxVal) nPos = infoPtr->MaxVal;
- oldPos = infoPtr->CurVal;
- infoPtr->CurVal = nPos;
- if (bRedraw) SCROLL_RefreshScrollBar( hwnd, nBar );
+ oldPos = infoPtr->CurVal;
+ info.cbSize = sizeof(info);
+ info.nPos = nPos;
+ info.fMask = SIF_POS;
+ SetScrollInfo32( hwnd, nBar, &info, bRedraw );
return oldPos;
}
/*************************************************************************
- * GetScrollPos (USER.63)
+ * GetScrollPos16 (USER.63)
*/
-int GetScrollPos( HWND hwnd, int nBar )
+INT16 GetScrollPos16( HWND16 hwnd, INT16 nBar )
+{
+ return (INT16)GetScrollPos32( hwnd, nBar );
+}
+
+
+/*************************************************************************
+ * GetScrollPos32 (USER32.284)
+ */
+INT32 GetScrollPos32( HWND32 hwnd, INT32 nBar )
{
SCROLLBAR_INFO *infoPtr;
@@ -857,30 +1093,34 @@
/*************************************************************************
- * SetScrollRange (USER.64)
+ * SetScrollRange16 (USER.64)
*/
-void SetScrollRange(HWND hwnd, int nBar, int MinVal, int MaxVal, BOOL bRedraw)
+void SetScrollRange16( HWND16 hwnd, INT16 nBar, INT16 MinVal, INT16 MaxVal,
+ BOOL16 bRedraw )
{
- SCROLLBAR_INFO *infoPtr;
-
- if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return;
-
- dprintf_scroll( stddeb,"SetScrollRange hwnd=%04x bar=%d min=%d max=%d\n",
- hwnd, nBar, MinVal, MaxVal );
-
- /* Invalid range -> range is set to (0,0) */
- if ((MinVal > MaxVal) || ((long)MaxVal - MinVal > 32767L))
- MinVal = MaxVal = 0;
- if (infoPtr->CurVal < MinVal) infoPtr->CurVal = MinVal;
- else if (infoPtr->CurVal > MaxVal) infoPtr->CurVal = MaxVal;
- infoPtr->MinVal = MinVal;
- infoPtr->MaxVal = MaxVal;
-
- /* Non-client scroll-bar is hidden if min==max */
- if (nBar != SB_CTL) ShowScrollBar( hwnd, nBar, (MinVal != MaxVal) );
- if (bRedraw) SCROLL_RefreshScrollBar( hwnd, nBar );
+ /* Invalid range -> range is set to (0,0) */
+ if ((INT32)MaxVal - (INT32)MinVal > 0x7fff) MinVal = MaxVal = 0;
+ SetScrollRange32( hwnd, nBar, MinVal, MaxVal, bRedraw );
}
+
+/*************************************************************************
+ * SetScrollRange32 (USER32.502)
+ */
+BOOL32 SetScrollRange32( HWND32 hwnd, INT32 nBar, INT32 MinVal, INT32 MaxVal,
+ BOOL32 bRedraw )
+{
+ SCROLLINFO info;
+
+ info.cbSize = sizeof(info);
+ info.nMin = MinVal;
+ info.nMax = MaxVal;
+ info.fMask = SIF_RANGE;
+ SetScrollInfo32( hwnd, nBar, &info, bRedraw );
+ return TRUE;
+}
+
+
/*************************************************************************
* SCROLL_SetNCSbState
*
@@ -914,44 +1154,74 @@
return wndPtr->dwStyle & (WS_VSCROLL | WS_HSCROLL);
}
-/*************************************************************************
- * GetScrollRange (USER.65)
- */
-void GetScrollRange(HWND hwnd, int nBar, LPINT16 lpMin, LPINT16 lpMax)
-{
- SCROLLBAR_INFO *infoPtr;
- if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return;
- if (lpMin) *lpMin = infoPtr->MinVal;
- if (lpMax) *lpMax = infoPtr->MaxVal;
+/*************************************************************************
+ * GetScrollRange16 (USER.65)
+ */
+BOOL16 GetScrollRange16( HWND16 hwnd, INT16 nBar, LPINT16 lpMin, LPINT16 lpMax)
+{
+ INT32 min, max;
+ BOOL16 ret = GetScrollRange32( hwnd, nBar, &min, &max );
+ if (lpMin) *lpMin = min;
+ if (lpMax) *lpMax = max;
+ return ret;
}
/*************************************************************************
- * ShowScrollBar (USER.267)
+ * GetScrollRange32 (USER32.285)
*/
-void ShowScrollBar( HWND hwnd, WORD wBar, BOOL fShow )
+BOOL32 GetScrollRange32( HWND32 hwnd, INT32 nBar, LPINT32 lpMin, LPINT32 lpMax)
+{
+ SCROLLBAR_INFO *infoPtr;
+
+ if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar )))
+ {
+ if (lpMin) lpMin = 0;
+ if (lpMax) lpMax = 0;
+ return FALSE;
+ }
+ if (lpMin) *lpMin = infoPtr->MinVal;
+ if (lpMax) *lpMax = infoPtr->MaxVal;
+ return TRUE;
+}
+
+
+/*************************************************************************
+ * ShowScrollBar16 (USER.267)
+ */
+void ShowScrollBar16( HWND16 hwnd, INT16 nBar, BOOL16 fShow )
+{
+ ShowScrollBar32( hwnd, nBar, fShow );
+}
+
+
+/*************************************************************************
+ * ShowScrollBar32 (USER32.531)
+ */
+BOOL32 ShowScrollBar32( HWND32 hwnd, INT32 nBar, BOOL32 fShow )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
- if (!wndPtr) return;
- dprintf_scroll( stddeb, "ShowScrollBar: hwnd=%04x bar=%d on=%d\n", hwnd, wBar, fShow );
+ if (!wndPtr) return FALSE;
+ dprintf_scroll( stddeb, "ShowScrollBar: hwnd=%04x bar=%d on=%d\n",
+ hwnd, nBar, fShow );
- switch(wBar)
+ switch(nBar)
{
case SB_CTL:
ShowWindow( hwnd, fShow ? SW_SHOW : SW_HIDE );
- return;
+ return TRUE;
case SB_HORZ:
if (fShow)
{
- if (wndPtr->dwStyle & WS_HSCROLL) return;
+ if (wndPtr->dwStyle & WS_HSCROLL) return TRUE;
wndPtr->dwStyle |= WS_HSCROLL;
}
else /* hide it */
{
- if (!(wndPtr->dwStyle & WS_HSCROLL)) return;
+ if (!(wndPtr->dwStyle & WS_HSCROLL)) return TRUE;
wndPtr->dwStyle &= ~WS_HSCROLL;
}
break;
@@ -959,12 +1229,12 @@
case SB_VERT:
if (fShow)
{
- if (wndPtr->dwStyle & WS_VSCROLL) return;
+ if (wndPtr->dwStyle & WS_VSCROLL) return TRUE;
wndPtr->dwStyle |= WS_VSCROLL;
}
else /* hide it */
{
- if (!(wndPtr->dwStyle & WS_VSCROLL)) return;
+ if (!(wndPtr->dwStyle & WS_VSCROLL)) return TRUE;
wndPtr->dwStyle &= ~WS_VSCROLL;
}
break;
@@ -973,98 +1243,50 @@
if (fShow)
{
if ((wndPtr->dwStyle & WS_HSCROLL)
- && (wndPtr->dwStyle & WS_VSCROLL)) return;
+ && (wndPtr->dwStyle & WS_VSCROLL)) return TRUE;
wndPtr->dwStyle |= WS_HSCROLL | WS_VSCROLL;
}
else /* hide it */
{
if (!(wndPtr->dwStyle & WS_HSCROLL)
- && !(wndPtr->dwStyle & WS_HSCROLL)) return;
+ && !(wndPtr->dwStyle & WS_HSCROLL)) return TRUE;
wndPtr->dwStyle &= ~(WS_HSCROLL | WS_VSCROLL);
}
break;
default:
- return; /* Nothing to do! */
+ return TRUE; /* Nothing to do! */
}
SetWindowPos( hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE
| SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
-}
-
-
-/*************************************************************************
- * EnableScrollBar (USER.482)
- */
-BOOL EnableScrollBar( HWND hwnd, UINT nBar, UINT flags )
-{
- SCROLLBAR_INFO *infoPtr;
- HDC hdc;
-
- if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE;
- dprintf_scroll( stddeb, "EnableScrollBar: %04x %d %d\n", hwnd, nBar, flags );
- flags &= ESB_DISABLE_BOTH;
- if (infoPtr->flags == flags) return FALSE;
- infoPtr->flags = flags;
-
- /* Redraw the whole scroll bar */
- hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
- SCROLL_DrawScrollBar( hwnd, hdc, nBar );
- ReleaseDC( hwnd, hdc );
return TRUE;
}
/*************************************************************************
- * SetScrollInfo32 (USER32.500)
+ * EnableScrollBar16 (USER.482)
*/
-INT32 SetScrollInfo32( HWND32 hwnd, INT32 nBar, LPSCROLLINFO32 lpsi,
- BOOL32 bRedraw )
+BOOL16 EnableScrollBar16( HWND16 hwnd, INT16 nBar, UINT16 flags )
{
- SCROLLBAR_INFO *infoPtr;
-
- if (!(infoPtr = SCROLL_GetScrollInfo(hwnd, nBar))) return 0;
-
- if (lpsi->fMask & SIF_PAGE) {
- /* fixme: The page size isn't used in the current
- * scrolling code - it's new for win32
- */
- infoPtr->Page = lpsi->nPage;
- }
- if (lpsi->fMask & SIF_POS)
- SetScrollPos(hwnd, nBar, lpsi->nPos, FALSE);
- if (lpsi->fMask & SIF_RANGE)
- SetScrollRange(hwnd, nBar, lpsi->nMin, lpsi->nMax, FALSE);
- if (lpsi->fMask & SIF_DISABLENOSCROLL) {
- /* fixme: Disable scroll bar if the new parameters make
- * the scroll bar unneeded
- */
- dprintf_scroll(stddeb, "SetScrollInfo: SIF_DISABLENOSCROLL not supported yet\n");
- }
-
- if (bRedraw) SCROLL_RefreshScrollBar(hwnd, nBar);
-
- /* return current thumb position */
- return (infoPtr->CurVal);
+ return EnableScrollBar32( hwnd, nBar, flags );
}
/*************************************************************************
- * GetScrollInfo32 (USER32.283)
+ * EnableScrollBar32 (USER32.170)
*/
-BOOL32 GetScrollInfo32( HWND32 hwnd, INT32 nBar, LPSCROLLINFO32 lpsi )
+BOOL32 EnableScrollBar32( HWND32 hwnd, INT32 nBar, UINT32 flags )
{
SCROLLBAR_INFO *infoPtr;
if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE;
+ dprintf_scroll( stddeb, "EnableScrollBar: %04x %d %d\n",
+ hwnd, nBar, flags );
+ flags &= ESB_DISABLE_BOTH;
+ if (infoPtr->flags == flags) return FALSE;
+ infoPtr->flags = flags;
- if (lpsi->fMask & SIF_PAGE) lpsi->nPage = infoPtr->Page;
- if (lpsi->fMask & SIF_POS) lpsi->nPos = infoPtr->CurVal;
- if (lpsi->fMask & SIF_TRACKPOS)
- lpsi->nTrackPos = hwndTracking ? uTrackingPos : 0;
- if (lpsi->fMask & SIF_RANGE)
- {
- lpsi->nMin = infoPtr->MinVal;
- lpsi->nMax = infoPtr->MaxVal;
- }
+ /* Redraw the whole scroll bar */
+ SCROLL_RefreshScrollBar( hwnd, nBar, TRUE );
return TRUE;
}
diff --git a/controls/status.c b/controls/status.c
index 3217b2b..7996a26 100644
--- a/controls/status.c
+++ b/controls/status.c
@@ -4,6 +4,7 @@
* Copyright 1996 Bruce Milner
*/
+#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include <stdio.h>
#include <stdlib.h>
#include "windows.h"
@@ -226,9 +227,9 @@
}
SW_SetPartBounds(hwnd, self);
- hdc = GetDC(hwnd);
+ hdc = GetDC32(hwnd);
SW_Refresh(hwnd, hdc, self);
- ReleaseDC(hwnd, hdc);
+ ReleaseDC32(hwnd, hdc);
return TRUE;
}
@@ -272,11 +273,11 @@
self->part0.style = 0;
height = 40;
- if ((hdc = GetDC(0))) {
+ if ((hdc = GetDC32(0))) {
TEXTMETRIC32A tm;
GetTextMetrics32A(hdc, &tm);
self->textHeight = tm.tmHeight;
- ReleaseDC(0, hdc);
+ ReleaseDC32(0, hdc);
}
parent = GetParent32(hwnd);
@@ -369,9 +370,9 @@
simple = (BOOL32) wParam;
self->simple = simple;
- hdc = GetDC(hwnd);
+ hdc = GetDC32(hwnd);
SW_Refresh(hwnd, hdc, self);
- ReleaseDC(hwnd, hdc);
+ ReleaseDC32(hwnd, hdc);
return TRUE;
}
diff --git a/controls/widgets.c b/controls/widgets.c
index 7495665..0235053 100644
--- a/controls/widgets.c
+++ b/controls/widgets.c
@@ -29,8 +29,6 @@
{
{ CS_GLOBALCLASS | CS_PARENTDC,
sizeof(STATICINFO), 0, "StaticWndProc", "STATIC" },
- { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
- sizeof(SCROLLBAR_INFO), 0, "ScrollBarWndProc", "SCROLLBAR" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
8, 0, "ListBoxWndProc", "LISTBOX" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
@@ -54,9 +52,11 @@
static WNDCLASS32A WIDGETS_BuiltinClasses32[] =
{
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
- ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0, 0, 0, 0, "BUTTON" },
+ ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0, 0, 0, 0, "BUTTON" },
+ { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
+ ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0, 0, 0, 0, "SCROLLBAR"},
{ CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOPINFO),
- 0, 0, 0, 0, 0, DESKTOP_CLASS_NAME }
+ 0, 0, 0, 0, 0, DESKTOP_CLASS_NAME }
};
#define NB_BUILTIN_CLASSES32 \