Release 960516
Thu May 16 13:35:31 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [*/*.c]
Renamed RECT, POINT and SIZE structures to RECT16, POINT16 and
SIZE16. Implemented Win32 version of most functions that take
these types as parameters.
* [configure]
Patched autoconf to attempt to correctly detect -lnsl and
-lsocket. Please check this out.
* [controls/button.c]
Added support for Win32 BM_* messages.
* [controls/menu.c]
Avoid sending extra WM_MENUSELECT messages. This avoids crashes
with Excel.
* [memory.heap.c] [include/heap.h]
Added support for SEGPTRs in Win32 heaps. Added a few macros to
make using SEGPTRs easier. They are a bit slower than MAKE_SEGPTR,
but they work with Win32.
* [memory/atom.c]
Implemented Win32 atom functions.
* [memory/local.c]
Fixed LocalReAlloc() changes to avoid copying the whole block twice.
* [win32/memory.c]
Use /dev/zero instead of MAP_ANON for VirtualAlloc().
* [windows/class.c]
Properly implemented the Win32 class functions.
* [windows/winproc.c] (New file)
New file handling the message translation between Win16 and Win32.
Mon May 13 18:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [windows/mdi.c] [windows/menu.c]
Improved WM_MDICREATE and WM_MDICASCADE handling.
* [windows/event.c] [objects/bitblt.c]
Handle GraphicsExpose event for BitBlt from screen to screen.
* [windows/event.c] [windows/win.c] [windows/nonclient.c]
Bunch of fixes for problems with -managed.
* [windows/win.c] [windows/winpos.c]
Changed conditions for WM_SIZE, WM_MOVE, and WM_GETMINMAXINFO
in CreateWindow.
* [windows/win.c] [windows/queue.c] [misc/user.c]
Do not send WM_PARENTNOTIFY when in AppExit and call WH_SHELL
on window creation/destruction.
* [objects/palette.c]
Crude RealizePalette(). At least something is visible in LviewPro.
Sun May 12 02:05:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [if1632/gdi32.spec]
Added Rectangle (use win16 version).
* [if1632/kernel32.spec]
Added GetWindowsDirectoryA (use win16 GetWindowsDirectory).
* [if1632/user32.spec]
Added GetSubMenu, MoveWindow, SetScrollPos, SetScrollRange (use win16
versions).
Added SetWindowsHookExA (empty stub for now).
* [include/handle32.h]
Changed #include <malloc.h> to #include <stdlib.h> to prevent
hate message from FreeBSD compiler.
* [win32/newfns.c]
Added new function SetWindowsHookEx32A (empty stub for now).
* [win32/user32.c]
Removed redundant debugging printf statement.
Sun May 12 01:24:57 1996 Huw D. M. Davies <h.davies1@physics.oxford.ac.uk>
* [memory/local.c]
Avoid creating adjacent free blocks.
Free the block in LocalReAlloc() before allocating a new one.
Fixed LocalReAlloc() for discarded blocks.
Fri May 10 23:05:12 1996 Jukka Iivonen <iivonen@cc.helsinki.fi>
* [resources/sysres_Fi.rc]
ChooseFont and ChooseColor dialogs updated.
Fri May 10 17:19:33 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [files/drive.c,if1632/kernel.spec]
GetCurrentDirectory(),SetCurrentDirectory() implemented.
* [if1632/advapi32.spec] [if1632/kernel.spec] [if1632/shell.spec]
[include/windows.h] [include/winreg.h] [loader/main.c]
[misc/main.c] [misc/shell.c] [misc/registry.c]
Registry fixes:
- loads win95 registry databases,
- save only updated keys on default,
- now adhers to the new function naming standard,
- minor cleanups.
Tue May 7 22:36:13 1996 Albrecht Kleine <kleine@ak.sax.de>
* [combo.c]
Added WM_COMMAND-handling for interaction between EDIT and COMBOLBOX
and synchronized mine with Greg Kreider's works.
* [commdlg.c]
Bugfix in ChooseFont: font size handling.
diff --git a/controls/button.c b/controls/button.c
index f5e7eff..60558ec 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -10,7 +10,7 @@
#include "syscolor.h"
#include "graphics.h"
#include "button.h"
-#include "stackframe.h"
+#include "heap.h"
extern void DEFWND_SetText( WND *wndPtr, LPSTR text ); /* windows/defwnd.c */
@@ -80,8 +80,7 @@
LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- RECT rect;
- POINT pt;
+ RECT16 rect;
LONG lResult = 0;
WND *wndPtr = WIN_FindWndPtr(hWnd);
LONG style = wndPtr->dwStyle & 0x0000000F;
@@ -132,15 +131,15 @@
case WM_PAINT:
if (btnPaintFunc[style])
{
- PAINTSTRUCT ps;
- HDC hdc = BeginPaint( hWnd, &ps );
+ PAINTSTRUCT16 ps;
+ HDC hdc = BeginPaint16( hWnd, &ps );
(btnPaintFunc[style])( wndPtr, hdc, ODA_DRAWENTIRE );
- ReleaseDC( hWnd, hdc );
+ EndPaint16( hWnd, &ps );
}
break;
case WM_LBUTTONDOWN:
- SendMessage( hWnd, BM_SETSTATE, TRUE, 0 );
+ SendMessage( hWnd, BM_SETSTATE16, TRUE, 0 );
SetFocus( hWnd );
SetCapture( hWnd );
break;
@@ -148,23 +147,21 @@
case WM_LBUTTONUP:
ReleaseCapture();
if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) break;
- SendMessage( hWnd, BM_SETSTATE, FALSE, 0 );
- GetClientRect( hWnd, &rect );
- pt.x = LOWORD(lParam);
- pt.y = HIWORD(lParam);
- if (PtInRect( &rect, pt ))
+ SendMessage( hWnd, BM_SETSTATE16, FALSE, 0 );
+ GetClientRect16( hWnd, &rect );
+ if (PtInRect16( &rect, MAKEPOINT16(lParam) ))
{
switch(style)
{
case BS_AUTOCHECKBOX:
- SendMessage( hWnd, BM_SETCHECK,
+ SendMessage( hWnd, BM_SETCHECK16,
!(infoPtr->state & BUTTON_CHECKED), 0 );
break;
case BS_AUTORADIOBUTTON:
- SendMessage( hWnd, BM_SETCHECK, TRUE, 0 );
+ SendMessage( hWnd, BM_SETCHECK16, TRUE, 0 );
break;
case BS_AUTO3STATE:
- SendMessage( hWnd, BM_SETCHECK,
+ SendMessage( hWnd, BM_SETCHECK16,
(infoPtr->state & BUTTON_3STATE) ? 0 :
((infoPtr->state & 3) + 1), 0 );
break;
@@ -182,12 +179,9 @@
case WM_MOUSEMOVE:
if (GetCapture() == hWnd)
{
- GetClientRect( hWnd, &rect );
- pt.x = LOWORD(lParam);
- pt.y = HIWORD(lParam);
- if (PtInRect( &rect, pt) )
- SendMessage( hWnd, BM_SETSTATE, TRUE, 0 );
- else SendMessage( hWnd, BM_SETSTATE, FALSE, 0 );
+ GetClientRect16( hWnd, &rect );
+ SendMessage(hWnd, BM_SETSTATE16,
+ PtInRect16( &rect,MAKEPOINT16(lParam) ), 0 );
}
break;
@@ -221,10 +215,11 @@
break;
case WM_SYSCOLORCHANGE:
- InvalidateRect(hWnd, NULL, FALSE);
+ InvalidateRect32( hWnd, NULL, FALSE );
break;
- case BM_SETSTYLE:
+ case BM_SETSTYLE16:
+ case BM_SETSTYLE32:
if ((wParam & 0x0f) >= MAX_BTN_TYPE) break;
wndPtr->dwStyle = (wndPtr->dwStyle & 0xfffffff0)
| (wParam & 0x0000000f);
@@ -232,11 +227,13 @@
PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
break;
- case BM_GETCHECK:
+ case BM_GETCHECK16:
+ case BM_GETCHECK32:
lResult = infoPtr->state & 3;
break;
- case BM_SETCHECK:
+ case BM_SETCHECK16:
+ case BM_SETCHECK32:
if (wParam > maxCheckState[style])
wParam = maxCheckState[style];
if ((infoPtr->state & 3) != wParam)
@@ -248,11 +245,13 @@
BUTTON_CheckAutoRadioButton( wndPtr );
break;
- case BM_GETSTATE:
+ case BM_GETSTATE16:
+ case BM_GETSTATE32:
lResult = infoPtr->state;
break;
- case BM_SETSTATE:
+ case BM_SETSTATE16:
+ case BM_SETSTATE32:
if (wParam)
{
if (infoPtr->state & BUTTON_HIGHLIGHTED) break;
@@ -281,20 +280,20 @@
static void PB_Paint( WND *wndPtr, HDC hDC, WORD action )
{
- RECT rc;
- HPEN hOldPen;
+ RECT16 rc;
+ HPEN16 hOldPen;
HBRUSH hOldBrush;
char *text;
DWORD dwTextSize;
TEXTMETRIC tm;
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
- GetClientRect(wndPtr->hwndSelf, &rc);
+ GetClientRect16(wndPtr->hwndSelf, &rc);
/* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */
if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
BUTTON_SEND_CTLCOLOR( wndPtr, hDC );
- hOldPen = (HPEN)SelectObject(hDC, sysColorObjects.hpenWindowFrame);
+ hOldPen = (HPEN16)SelectObject(hDC, sysColorObjects.hpenWindowFrame);
hOldBrush = (HBRUSH)SelectObject(hDC, sysColorObjects.hbrushBtnFace);
SetBkMode(hDC, TRANSPARENT);
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
@@ -305,12 +304,12 @@
SetPixel( hDC, rc.right-1, rc.top, GetSysColor(COLOR_WINDOW) );
SetPixel( hDC, rc.right-1, rc.bottom-1, GetSysColor(COLOR_WINDOW) );
}
- InflateRect( &rc, -1, -1 );
+ InflateRect16( &rc, -1, -1 );
if ((wndPtr->dwStyle & 0x000f) == BS_DEFPUSHBUTTON)
{
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
- InflateRect( &rc, -1, -1 );
+ InflateRect16( &rc, -1, -1 );
}
if (infoPtr->state & BUTTON_HIGHLIGHTED)
@@ -330,8 +329,8 @@
{
SetTextColor( hDC, (wndPtr->dwStyle & WS_DISABLED) ?
GetSysColor(COLOR_GRAYTEXT) : GetSysColor(COLOR_BTNTEXT));
- DrawText(hDC, text, -1, &rc,
- DT_SINGLELINE | DT_CENTER | DT_VCENTER);
+ DrawText16( hDC, text, -1, &rc,
+ DT_SINGLELINE | DT_CENTER | DT_VCENTER );
/* do we have the focus? */
if (infoPtr->state & BUTTON_HASFOCUS)
{
@@ -342,8 +341,8 @@
ydelta = ((rc.bottom - rc.top) - tm.tmHeight - 1) / 2;
if (xdelta < 0) xdelta = 0;
if (ydelta < 0) ydelta = 0;
- InflateRect( &rc, -xdelta, -ydelta );
- DrawFocusRect( hDC, &rc );
+ InflateRect16( &rc, -xdelta, -ydelta );
+ DrawFocusRect16( hDC, &rc );
}
}
@@ -358,19 +357,19 @@
static void CB_Paint( WND *wndPtr, HDC hDC, WORD action )
{
- RECT rc;
+ RECT16 rc;
HBRUSH hBrush;
int textlen, delta, x, y;
char *text;
TEXTMETRIC tm;
- SIZE size;
+ SIZE16 size;
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
- GetClientRect(wndPtr->hwndSelf, &rc);
+ GetClientRect16(wndPtr->hwndSelf, &rc);
if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
hBrush = BUTTON_SEND_CTLCOLOR( wndPtr, hDC );
- if (action == ODA_DRAWENTIRE) FillRect(hDC, &rc, hBrush);
+ if (action == ODA_DRAWENTIRE) FillRect16( hDC, &rc, hBrush );
GetTextMetrics(hDC, &tm);
delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
@@ -393,13 +392,13 @@
{
if (wndPtr->dwStyle & WS_DISABLED)
SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) );
- DrawText(hDC, text, textlen, &rc, DT_SINGLELINE | DT_VCENTER);
+ DrawText16( hDC, text, textlen, &rc, DT_SINGLELINE | DT_VCENTER );
}
if ((action == ODA_FOCUS) ||
((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS)))
{
- GetTextExtentPoint(hDC, text, textlen, &size);
+ GetTextExtentPoint16( hDC, text, textlen, &size );
if (delta > 1)
{
rc.top += delta - 1;
@@ -407,7 +406,7 @@
}
rc.left--;
rc.right = MIN( rc.left + size.cx + 2, rc.right );
- DrawFocusRect(hDC, &rc);
+ DrawFocusRect16( hDC, &rc );
}
}
@@ -425,7 +424,7 @@
for(sibling = GetNextDlgGroupItem(parent,wndPtr->hwndSelf,FALSE);
sibling != wndPtr->hwndSelf;
sibling = GetNextDlgGroupItem(parent,sibling,FALSE))
- SendMessage(sibling,BM_SETCHECK,BUTTON_UNCHECKED,0);
+ SendMessage( sibling, BM_SETCHECK16, BUTTON_UNCHECKED, 0 );
}
@@ -435,9 +434,9 @@
static void GB_Paint( WND *wndPtr, HDC hDC, WORD action )
{
- RECT rc;
+ RECT16 rc;
char *text;
- SIZE size;
+ SIZE16 size;
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
if (action != ODA_DRAWENTIRE) return;
@@ -446,7 +445,7 @@
BUTTON_SEND_CTLCOLOR( wndPtr, hDC );
SelectObject( hDC, sysColorObjects.hpenWindowFrame );
- GetClientRect( wndPtr->hwndSelf, &rc);
+ GetClientRect16( wndPtr->hwndSelf, &rc);
MoveTo( hDC, rc.left, rc.top+2 );
LineTo( hDC, rc.right-1, rc.top+2 );
@@ -455,13 +454,13 @@
LineTo( hDC, rc.left, rc.top+2 );
if (!(text = (char*) USER_HEAP_LIN_ADDR( wndPtr->hText ))) return;
- GetTextExtentPoint(hDC, text, strlen(text), &size);
+ GetTextExtentPoint16( hDC, text, strlen(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) );
- DrawText(hDC, text, -1, &rc, DT_SINGLELINE );
+ DrawText16( hDC, text, -1, &rc, DT_SINGLELINE );
}
@@ -471,21 +470,21 @@
static void UB_Paint( WND *wndPtr, HDC hDC, WORD action )
{
- RECT rc;
+ RECT16 rc;
HBRUSH hBrush;
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
if (action == ODA_SELECT) return;
- GetClientRect( wndPtr->hwndSelf, &rc);
+ GetClientRect16( wndPtr->hwndSelf, &rc);
if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
hBrush = BUTTON_SEND_CTLCOLOR( wndPtr, hDC );
- FillRect(hDC, &rc, hBrush);
+ FillRect16( hDC, &rc, hBrush );
if ((action == ODA_FOCUS) ||
((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS)))
- DrawFocusRect(hDC, &rc);
+ DrawFocusRect16( hDC, &rc );
}
@@ -495,20 +494,22 @@
static void OB_Paint( WND *wndPtr, HDC hDC, WORD action )
{
- DRAWITEMSTRUCT dis;
+ DRAWITEMSTRUCT16 *dis;
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
- dis.CtlType = ODT_BUTTON;
- dis.CtlID = wndPtr->wIDmenu;
- dis.itemID = 0;
- dis.itemAction = action;
- dis.itemState = (infoPtr->state & BUTTON_HASFOCUS) ? ODS_FOCUS : 0 |
+ if (!(dis = SEGPTR_NEW(DRAWITEMSTRUCT16))) return;
+ dis->CtlType = ODT_BUTTON;
+ dis->CtlID = wndPtr->wIDmenu;
+ dis->itemID = 0;
+ dis->itemAction = action;
+ dis->itemState = (infoPtr->state & BUTTON_HASFOCUS) ? ODS_FOCUS : 0 |
(infoPtr->state & BUTTON_HIGHLIGHTED) ? ODS_SELECTED : 0 |
(wndPtr->dwStyle & WS_DISABLED) ? ODS_DISABLED : 0;
- dis.hwndItem = wndPtr->hwndSelf;
- dis.hDC = hDC;
- GetClientRect( wndPtr->hwndSelf, &dis.rcItem );
- dis.itemData = 0;
+ dis->hwndItem = wndPtr->hwndSelf;
+ dis->hDC = hDC;
+ GetClientRect16( wndPtr->hwndSelf, &dis->rcItem );
+ dis->itemData = 0;
SendMessage( GetParent(wndPtr->hwndSelf), WM_DRAWITEM, 1,
- (LPARAM)MAKE_SEGPTR(&dis) );
+ (LPARAM)SEGPTR_GET(dis) );
+ SEGPTR_FREE(dis);
}
diff --git a/controls/combo.c b/controls/combo.c
index d2dc819..46b4b9f 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -3,6 +3,7 @@
*
* Copyright 1993 Martin Ayotte
* Copyright 1995 Bernd Schmidt
+ * Copyright 1996 Albrecht Kleine [some fixes]
*
*/
@@ -19,6 +20,7 @@
#include "user.h"
#include "win.h"
#include "graphics.h"
+#include "heap.h"
#include "listbox.h"
#include "dos_fs.h"
#include "drive.h"
@@ -33,18 +35,8 @@
* I hope no programs rely on the implementation of combos.
*/
- /*
- * May 2nd: I added 3 "work arounds" (#1,#2,#3) to make combos
- * with EDIT work. (We need that for ChooseFont dialog.)
- * Perhaps we have to rewrite something more.
- * I have prepared some more stuff, but it doesn't
- * contain here, because it's not ready ;-)
- *
- * If you're writing on combo.c, please mail to me.
- *
- * Albrecht Kleine <kleine@ak.sax.de>
- */
-
+#define ID_EDIT 1
+#define ID_CLB 2
#define CBLMM_EDGE 4 /* distance inside box which is same as moving mouse
outside box, to trigger scrolling of CBL */
@@ -97,9 +89,7 @@
if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollRange(lphc->hWndLBox,SB_VERT,0,ListMaxFirstVisible(lphl),TRUE);
- if (repaint && lphl->bRedrawFlag) {
- InvalidateRect(hwnd, NULL, TRUE);
- }
+ if (repaint && lphl->bRedrawFlag) InvalidateRect32( hwnd, NULL, TRUE );
}
/***********************************************************************
@@ -107,11 +97,11 @@
*/
static LRESULT CBNCCreate(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
- CREATESTRUCT *createStruct;
+ CREATESTRUCT16 *createStruct;
if (!hComboBit) COMBO_Init();
- createStruct = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam);
+ createStruct = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
createStruct->style |= WS_BORDER;
SetWindowLong(hwnd, GWL_STYLE, createStruct->style);
@@ -129,10 +119,11 @@
LPHEADCOMBO lphc;
LONG style = 0;
LONG cstyle = GetWindowLong(hwnd,GWL_STYLE);
- RECT rect,lboxrect;
+ RECT16 rect,lboxrect;
WND* wndPtr = WIN_FindWndPtr(hwnd);
char className[] = "COMBOLBOX"; /* Hack so that class names are > 0x10000 */
char editName[] = "EDIT";
+ HWND hwndp=0;
/* translate combo into listbox styles */
cstyle |= WS_BORDER;
@@ -147,80 +138,61 @@
lphl = ComboGetListHeader(hwnd);
lphc = ComboGetStorageHeader(hwnd);
- GetClientRect(hwnd,&rect);
- GetWindowRect(hwnd,&lboxrect);
+ GetClientRect16(hwnd,&rect);
+ lphc->LBoxTop = lphl->StdItemHeight;
- /* FIXME: combos with edit controls are broken. */
- switch(cstyle & 3) {
+ switch(cstyle & 3)
+ {
case CBS_SIMPLE: /* edit control, list always visible */
- dprintf_combo(stddeb,"CBS_SIMPLE\n");
- SetRectEmpty(&lphc->RectButton);
- lboxrect=rect; /* work around #1 */
- lphc->LBoxTop = lphl->StdItemHeight;
- lphc->hWndEdit = CreateWindow16(MAKE_SEGPTR(editName), (SEGPTR)0,
- WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT | WS_BORDER,
- 0, 0, rect.right, lphl->StdItemHeight,
- hwnd, (HMENU)1, WIN_GetWindowInstance(hwnd), 0L);
- break;
+ lboxrect=rect;
+ lboxrect.left +=8;
+ dprintf_combo(stddeb,"CBS_SIMPLE\n");
+ style= WS_BORDER | WS_CHILD | WS_VISIBLE | WS_VSCROLL;
+ SetRectEmpty16(&lphc->RectButton);
+ hwndp=hwnd;
+ break;
+
+ case CBS_DROPDOWNLIST: /* static control, dropdown listbox */
case CBS_DROPDOWN: /* edit control, dropdown listbox */
- dprintf_combo(stddeb,"CBS_DROPDOWN\n");
- lphc->RectButton = rect;
- lphc->RectButton.left = lphc->RectButton.right - 6 - CBitWidth;
- lphc->RectButton.bottom = lphc->RectButton.top + lphl->StdItemHeight;
- lphc->LBoxTop = lphl->StdItemHeight;
- SetWindowPos(hwnd, 0, 0, 0, rect.right - rect.left + 2*SYSMETRICS_CXBORDER,
+ GetWindowRect16(hwnd,&lboxrect);
+ style = WS_POPUP | WS_BORDER | WS_VSCROLL;
+ /* FIXME: WinSight says these should be CHILD windows with the TOPMOST flag
+ * set. Wine doesn't support TOPMOST, and simply setting the WS_CHILD
+ * flag doesn't work. */
+ lphc->RectButton = rect;
+ lphc->RectButton.left = lphc->RectButton.right - 6 - CBitWidth;
+ lphc->RectButton.bottom = lphc->RectButton.top + lphl->StdItemHeight;
+ SetWindowPos(hwnd, 0, 0, 0, rect.right - rect.left + 2*SYSMETRICS_CXBORDER,
lphl->StdItemHeight + 2*SYSMETRICS_CYBORDER,
SWP_NOMOVE | SWP_NOZORDER);
- lphc->hWndEdit = CreateWindow16(MAKE_SEGPTR(editName), (SEGPTR)0,
- WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT,
- 0, 0, lphc->RectButton.left, lphl->StdItemHeight,
- hwnd, (HMENU)1, WIN_GetWindowInstance(hwnd), 0L);
- break;
- case CBS_DROPDOWNLIST: /* static control, dropdown listbox */
- dprintf_combo(stddeb,"CBS_DROPDOWNLIST\n");
- lphc->RectButton = rect;
- lphc->RectButton.left = lphc->RectButton.right - 6 - CBitWidth;
- lphc->RectButton.bottom = lphc->RectButton.top + lphl->StdItemHeight;
- lphc->LBoxTop = lphl->StdItemHeight;
-
- SetWindowPos(hwnd, 0, 0, 0, rect.right,
- lphl->StdItemHeight + 2*SYSMETRICS_CYBORDER,
- SWP_NOMOVE | SWP_NOZORDER);
- break;
+ rect.right=lphc->RectButton.left - 8;
+ dprintf_combo(stddeb,(cstyle & 3)==CBS_DROPDOWN ? "CBS_DROPDOWN\n": "CBS_DROPDOWNLIST\n");
+ break;
+
+ default: fprintf(stderr,"COMBOBOX error: bad class style!\n");
+ return 0;
}
- lboxrect.top += lphc->LBoxTop;
- /* FIXME: WinSight says these should be CHILD windows with the TOPMOST flag
- * set. Wine doesn't support TOPMOST, and simply setting the WS_CHILD
- * flag doesn't work. */
- if ((cstyle & 3)==CBS_SIMPLE) /* work around #2 */
- {
- lphc->hWndLBox = CreateWindow16(MAKE_SEGPTR(className), (SEGPTR)0,
- WS_BORDER | WS_CHILD | WS_VISIBLE |
- ((cstyle & WS_HSCROLL)? WS_HSCROLL : 0) |
- ((cstyle & WS_VSCROLL)? WS_VSCROLL : 0),
- lboxrect.left +8 , lboxrect.top,
- lboxrect.right - lboxrect.left - 8,
- lboxrect.bottom - lboxrect.top,
- hwnd,0, WIN_GetWindowInstance(hwnd),
- (SEGPTR)hwnd );
- }
- else
- {
- lphc->hWndLBox = CreateWindow16(MAKE_SEGPTR(className), (SEGPTR)0,
- WS_POPUP | WS_BORDER |
+
+ if ((cstyle & 3) != CBS_DROPDOWNLIST)
+ lphc->hWndEdit = CreateWindow16(MAKE_SEGPTR(editName), (SEGPTR)0,
+ WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | ES_LEFT | WS_BORDER,
+ 0, 0, rect.right, lphl->StdItemHeight,
+ hwnd, (HMENU)ID_EDIT, WIN_GetWindowInstance(hwnd), 0L);
+
+ lboxrect.top+=lphc->LBoxTop;
+ lphc->hWndLBox = CreateWindow16(MAKE_SEGPTR(className), (SEGPTR)0, style |
((cstyle & WS_HSCROLL)? WS_HSCROLL : 0) |
((cstyle & WS_VSCROLL)? WS_VSCROLL : 0),
lboxrect.left, lboxrect.top,
lboxrect.right - lboxrect.left,
lboxrect.bottom - lboxrect.top,
- 0, 0, WIN_GetWindowInstance(hwnd),
+ hwndp,(HMENU)ID_CLB, WIN_GetWindowInstance(hwnd),
(SEGPTR)hwnd );
- ShowWindow(lphc->hWndLBox, SW_HIDE);
- }
+
wndPtr->dwStyle &= ~(WS_VSCROLL | WS_HSCROLL);
-
- dprintf_combo( stddeb, "Combo Creation hwnd=%04x LBox=%04x\n",
- hwnd, lphc->hWndLBox);
+
+ dprintf_combo( stddeb, "Combo Creation hwnd=%04x LBox=%04x Edit=%04x\n",
+ hwnd, lphc->hWndLBox, lphc->hWndEdit);
dprintf_combo( stddeb, " lbox %d,%d-%d,%d button %d,%d-%d,%d\n",
lboxrect.left, lboxrect.top, lboxrect.right, lboxrect.bottom,
lphc->RectButton.left, lphc->RectButton.top,
@@ -254,14 +226,15 @@
LPHEADLIST lphl = ComboGetListHeader(hwnd);
LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
LPLISTSTRUCT lpls;
- PAINTSTRUCT ps;
+ PAINTSTRUCT16 ps;
HBRUSH hBrush;
HFONT hOldFont;
- HDC hdc;
- RECT rect;
+ HDC16 hdc;
+ RECT16 rect;
- hdc = BeginPaint(hwnd, &ps);
- if (hComboBit != 0 && !IsRectEmpty(&lphc->RectButton)) { /* work around #3 */
+ hdc = BeginPaint16(hwnd, &ps);
+ if (hComboBit != 0 && !IsRectEmpty16(&lphc->RectButton))
+ {
GRAPH_DrawReliefRect(hdc, &lphc->RectButton, 2, 2, FALSE);
GRAPH_DrawBitmap(hdc, hComboBit,
lphc->RectButton.left + 2,lphc->RectButton.top + 2,
@@ -271,7 +244,7 @@
|| (lphc->dwStyle & 3) != CBS_DROPDOWNLIST)
{
/* we don't want to draw an entry when there is an edit control */
- EndPaint(hwnd, &ps);
+ EndPaint16(hwnd, &ps);
return 0;
}
@@ -285,21 +258,21 @@
#endif
if (hBrush == 0) hBrush = GetStockObject(WHITE_BRUSH);
- GetClientRect(hwnd, &rect);
+ GetClientRect16(hwnd, &rect);
CBCheckSize(hwnd);
rect.right -= (lphc->RectButton.right - lphc->RectButton.left);
lpls = ListBoxGetItem(lphl,lphl->ItemFocused);
if (lpls != NULL) {
- FillRect(hdc, &rect, hBrush);
+ FillRect16(hdc, &rect, hBrush);
ListBoxDrawItem (hwnd, lphl, hdc, lpls, &rect, ODA_DRAWENTIRE, 0);
if (GetFocus() == hwnd)
ListBoxDrawItem (hwnd,lphl, hdc, lpls, &rect, ODA_FOCUS, ODS_FOCUS);
}
- else FillRect(hdc, &rect, hBrush);
+ else FillRect16(hdc, &rect, hBrush);
SelectObject(hdc,hOldFont);
- EndPaint(hwnd, &ps);
+ EndPaint16(hwnd, &ps);
return 0;
}
@@ -350,12 +323,13 @@
newFocused = lphl->ItemsCount - 1;
ListBoxSetCurSel(lphl, newFocused);
+ SendMessage(hwnd, WM_COMMAND,ID_CLB,MAKELONG(0,CBN_SELCHANGE));
ListBoxSendNotification(lphl, CBN_SELCHANGE);
lphl->ItemFocused = newFocused;
ListBoxScrollToFocus(lphl);
/* SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);*/
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
@@ -375,12 +349,13 @@
newFocused = lphl->ItemsCount - 1;
ListBoxSetCurSel(lphl, newFocused);
+ SendMessage(hwnd, WM_COMMAND,ID_CLB,MAKELONG(0,CBN_SELCHANGE));
ListBoxSendNotification(lphl, CBN_SELCHANGE);
lphl->ItemFocused = newFocused;
ListBoxScrollToFocus(lphl);
/* SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);*/
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
@@ -522,7 +497,7 @@
dprintf_combo(stddeb,"CBSetCurSel: hwnd %04x wp %x lp %lx wRet %d\n",
hwnd,wParam,lParam,wRet);
/* SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);*/
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return wRet;
}
@@ -573,12 +548,14 @@
static LRESULT CBSetFont(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
LPHEADLIST lphl = ComboGetListHeader(hwnd);
-
+ LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
+
if (wParam == 0)
lphl->hFont = GetStockObject(SYSTEM_FONT);
else
lphl->hFont = (HFONT)wParam;
-
+ if (lphc->hWndEdit)
+ SendMessage(lphc->hWndEdit,WM_SETFONT,lphl->hFont,0);
return 0;
}
@@ -627,14 +604,14 @@
static LRESULT CBShowDropDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
- RECT rect;
+ RECT32 rect;
if ((lphc->dwStyle & 3) == CBS_SIMPLE) return LB_ERR;
wParam = !!wParam;
if (wParam != lphc->DropDownVisible) {
lphc->DropDownVisible = wParam;
- GetWindowRect(hwnd,&rect);
+ GetWindowRect32(hwnd,&rect);
SetWindowPos(lphc->hWndLBox, 0, rect.left, rect.top+lphc->LBoxTop, 0, 0,
SWP_NOSIZE | (wParam ? SWP_SHOWWINDOW : SWP_HIDEWINDOW));
if (!wParam) SetFocus(hwnd);
@@ -651,27 +628,27 @@
LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
LPHEADLIST lphl = ComboGetListHeader(hwnd);
LONG cstyle = GetWindowLong(hwnd,GWL_STYLE);
- RECT cRect,wRect;
+ RECT16 cRect,wRect;
/* TODO - The size of combo's and their listboxes is still broken */
if (lphc->hWndLBox == 0) return FALSE;
- GetClientRect(hwnd,&cRect);
- GetWindowRect(hwnd,&wRect);
+ GetClientRect16(hwnd,&cRect);
+ GetWindowRect16(hwnd,&wRect);
- dprintf_vxd(stddeb,"CBCheckSize: cRect %d,%d-%d,%d wRect %d,%d-%d,%d\n",
+ dprintf_combo(stddeb,"CBCheckSize: cRect %d,%d-%d,%d wRect %d,%d-%d,%d\n",
cRect.left,cRect.top,cRect.right,cRect.bottom,
wRect.left,wRect.top,wRect.right,wRect.bottom);
-
+ if ((cstyle & 3) == CBS_SIMPLE ) return TRUE ;
if ((cRect.bottom - cRect.top) >
(lphl->StdItemHeight + 2*SYSMETRICS_CYBORDER)) {
SetWindowPos(hwnd, 0, 0, 0,
cRect.right-cRect.left,
lphl->StdItemHeight+2*SYSMETRICS_CYBORDER,
SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE );
- GetClientRect(hwnd,&cRect);
- GetWindowRect(hwnd,&wRect);
+ GetClientRect16(hwnd,&cRect);
+ GetWindowRect16(hwnd,&wRect);
}
switch (cstyle & 3) {
@@ -691,10 +668,65 @@
}
CBLCheckSize(hwnd);
-
return TRUE;
}
+/***********************************************************************
+ * CBCommand
+ */
+static LRESULT CBCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
+{
+ LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
+ LPHEADLIST lphl = ComboGetListHeader(hwnd);
+ char buffer[256];
+ WORD newFocused;
+ WORD id;
+ if (lphc->hWndEdit) /* interdependence only used for CBS_SIMPLE and CBS_DROPDOWN styles */
+ {
+ switch (wParam)
+ {
+ case ID_CLB: /* update EDIT window */
+ if (HIWORD(lParam)==CBN_SELCHANGE)
+ if (lphl->HasStrings)
+ {
+ ListBoxGetText(lphl,lphl->ItemFocused, buffer);
+ dprintf_combo(stddeb,"CBCommand: update Edit: %s\n",buffer);
+ SendMessage( lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)MAKE_SEGPTR(buffer));
+ }
+ break;
+ case ID_EDIT: /* update LISTBOX window */
+ id=GetWindowWord(hwnd,GWW_ID);
+ switch (HIWORD(lParam))
+ {
+ case EN_UPDATE:GetWindowText(lphc->hWndEdit,buffer,255);
+ if (*buffer)
+ {
+ newFocused=ListBoxFindString(lphl, -1, MAKE_SEGPTR(buffer));
+ dprintf_combo(stddeb,"CBCommand: new selection #%d is= %s\n",
+ newFocused,buffer);
+ if (newFocused != (WORD)LB_ERR)
+ { /* if found something */
+ ListBoxSetCurSel(lphl, newFocused);
+ ListBoxSendNotification(lphl, CBN_SELCHANGE);
+ InvalidateRect32(hwnd, NULL, TRUE);
+ }
+ }
+ SendMessage(GetParent(hwnd),WM_COMMAND,id,
+ MAKELONG(hwnd, CBN_EDITUPDATE));
+ break;
+ case EN_CHANGE:SendMessage(GetParent(hwnd),WM_COMMAND,id,
+ MAKELONG(hwnd, CBN_EDITCHANGE));
+ break;
+ case EN_ERRSPACE:SendMessage(GetParent(hwnd),WM_COMMAND,id,
+ MAKELONG(hwnd, CBN_ERRSPACE));
+ break;
+ }
+ break;
+ }
+ }
+ return 0;
+}
+
/***********************************************************************
* ComboWndProc
@@ -715,6 +747,7 @@
case WM_SETFOCUS: return CBSetFocus(hwnd, wParam, lParam);
case WM_KILLFOCUS: return CBKillFocus(hwnd, wParam, lParam);
case WM_SIZE: return CBCheckSize(hwnd);
+ case WM_COMMAND: return CBCommand(hwnd, wParam, lParam);
case CB_RESETCONTENT: return CBResetContent(hwnd, wParam, lParam);
case CB_DIR: return CBDir(hwnd, wParam, lParam);
case CB_ADDSTRING: return CBAddString(hwnd, wParam, lParam);
@@ -758,7 +791,7 @@
*/
static LRESULT CBLCreate( HWND hwnd, WPARAM wParam, LPARAM lParam )
{
- CREATESTRUCT *createStruct = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam);
+ CREATESTRUCT16 *createStruct = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
#ifdef WINELIB32
SetWindowLong(hwnd,0,(LONG)createStruct->lpCreateParams);
#else
@@ -815,11 +848,11 @@
ListBoxSetCurSel(lphl, newFocused);
ListBoxSendNotification(lphl, CBN_SELCHANGE);
-
+ SendMessage(GetParent(hwnd), WM_COMMAND,ID_CLB,MAKELONG(0,CBN_SELCHANGE));
lphl->ItemFocused = newFocused;
ListBoxScrollToFocus(lphl);
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
@@ -838,20 +871,20 @@
{
LPHEADLIST lphl = CLBoxGetListHeader(hwnd);
LPLISTSTRUCT lpls;
- PAINTSTRUCT ps;
+ PAINTSTRUCT16 ps;
HBRUSH hBrush;
HFONT hOldFont;
WND * wndPtr = WIN_FindWndPtr(hwnd);
HWND combohwnd = CLBoxGetCombo(hwnd);
- HDC hdc;
- RECT rect;
+ HDC16 hdc;
+ RECT16 rect;
int i, top, height;
top = 0;
- hdc = BeginPaint( hwnd, &ps );
+ hdc = BeginPaint16( hwnd, &ps );
if (!IsWindowVisible(hwnd) || !lphl->bRedrawFlag) {
- EndPaint(hwnd, &ps);
+ EndPaint16(hwnd, &ps);
return 0;
}
@@ -859,8 +892,8 @@
/* listboxes should be white */
hBrush = GetStockObject(WHITE_BRUSH);
- GetClientRect(hwnd, &rect);
- FillRect(hdc, &rect, hBrush);
+ GetClientRect16(hwnd, &rect);
+ FillRect16(hdc, &rect, hBrush);
CBLCheckSize(hwnd);
lpls = lphl->lpFirst;
@@ -903,7 +936,7 @@
SetScrollRange(hwnd, SB_VERT, 0, ListMaxFirstVisible(lphl), TRUE);
SelectObject(hdc,hOldFont);
- EndPaint( hwnd, &ps );
+ EndPaint16( hwnd, &ps );
return 0;
}
@@ -934,7 +967,7 @@
{
LPHEADLIST lphl = CLBoxGetListHeader(hwnd);
int y;
- RECT rectsel;
+ RECT16 rectsel;
SetFocus(hwnd);
SetCapture(hwnd);
@@ -948,7 +981,7 @@
ListBoxSetCurSel(lphl, y);
ListBoxGetItemRect(lphl, y, &rectsel);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
@@ -968,6 +1001,7 @@
else if (lphl->PrevFocused != lphl->ItemFocused)
{
SendMessage(CLBoxGetCombo(hwnd),CB_SETCURSEL,lphl->ItemFocused,0);
+ SendMessage(GetParent(hwnd), WM_COMMAND,ID_CLB,MAKELONG(0,CBN_SELCHANGE));
ListBoxSendNotification(lphl, CBN_SELCHANGE);
}
@@ -984,12 +1018,12 @@
LPHEADLIST lphl = CLBoxGetListHeader(hwnd);
short y;
WORD wRet;
- RECT rect, rectsel;
+ RECT16 rect, rectsel;
y = SHIWORD(lParam);
wRet = ListBoxFindMouse(lphl, LOWORD(lParam), HIWORD(lParam));
ListBoxGetItemRect(lphl, wRet, &rectsel);
- GetClientRect(hwnd, &rect);
+ GetClientRect16(hwnd, &rect);
dprintf_combo(stddeb,"CBLMouseMove: hwnd %04x wp %x lp %lx y %d if %d wret %d %d,%d-%d,%d\n",
hwnd,wParam,lParam,y,lphl->ItemFocused,wRet,rectsel.left,rectsel.top,rectsel.right,rectsel.bottom);
@@ -1000,7 +1034,7 @@
lphl->FirstVisible--;
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
ListBoxSetCurSel(lphl, wRet);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
}
@@ -1009,14 +1043,14 @@
lphl->FirstVisible++;
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
ListBoxSetCurSel(lphl, wRet);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
}
else {
if ((short) wRet == lphl->ItemFocused) return 0;
ListBoxSetCurSel(lphl, wRet);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
}
}
@@ -1065,7 +1099,7 @@
if (y != lphl->FirstVisible) {
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
}
return 0;
@@ -1081,26 +1115,26 @@
LPHEADLIST lphl = ComboGetListHeader(hwnd);
LPLISTSTRUCT lpls;
HWND hWndLBox;
- RECT cRect,wRect,lRect,lwRect;
+ RECT16 cRect,wRect,lRect,lwRect;
int totheight;
char className[80];
- GetClassName(hwnd,className,80);
+ GetClassName32A(hwnd,className,80);
fflush(stddeb);
if (strncmp(className,"COMBOBOX",8)) return FALSE;
if ((hWndLBox = lphc->hWndLBox) == 0) return FALSE;
- dprintf_vxd(stddeb,"CBLCheckSize headers hw %04x lb %04x name %s\n",
+ dprintf_combo(stddeb,"CBLCheckSize headers hw %04x lb %04x name %s\n",
hwnd,hWndLBox,className);
- GetClientRect(hwnd,&cRect);
- GetWindowRect(hwnd,&wRect);
- GetClientRect(hWndLBox,&lRect);
- GetWindowRect(hWndLBox,&lwRect);
+ GetClientRect16(hwnd,&cRect);
+ GetWindowRect16(hwnd,&wRect);
+ GetClientRect16(hWndLBox,&lRect);
+ GetWindowRect16(hWndLBox,&lwRect);
- dprintf_vxd(stddeb,"CBLCheckSize: init cRect %d,%d-%d,%d wRect %d,%d-%d,%d\n",
+ dprintf_combo(stddeb,"CBLCheckSize: init cRect %d,%d-%d,%d wRect %d,%d-%d,%d\n",
cRect.left,cRect.top,cRect.right,cRect.bottom,
wRect.left,wRect.top,wRect.right,wRect.bottom);
- dprintf_vxd(stddeb," lRect %d,%d-%d,%d lwRect %d,%d-%d,%d\n",
+ dprintf_combo(stddeb," lRect %d,%d-%d,%d lwRect %d,%d-%d,%d\n",
lRect.left,lRect.top,lRect.right,lRect.bottom,
lwRect.left,lwRect.top,lwRect.right,lwRect.bottom);
fflush(stddeb);
@@ -1111,13 +1145,12 @@
/* TODO: This isn't really what windows does */
if (lRect.bottom-lRect.top < 3*lphl->StdItemHeight) {
- dprintf_vxd(stddeb," Changing; totHeight %d StdItemHght %d\n",
+ dprintf_combo(stddeb," Changing; totHeight %d StdItemHght %d\n",
totheight,lphl->StdItemHeight);
SetWindowPos(hWndLBox, 0, lRect.left, lRect.top,
lwRect.right-lwRect.left, totheight+2*SYSMETRICS_CYBORDER,
SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE );
}
-
return TRUE;
}
@@ -1174,13 +1207,17 @@
}
if (idStatic)
{
- char temp[256];
int drive = DRIVE_GetCurrentDrive();
+ const char *cwd = DRIVE_GetDosCwd(drive);
+ char *temp = SEGPTR_ALLOC( strlen(cwd) + 4 );
+ if (!temp) return FALSE;
strcpy( temp, "A:\\" );
temp[0] += drive;
- lstrcpyn( temp+3, DRIVE_GetDosCwd(drive), 253 );
+ strcpy( temp + 3, cwd );
+ AnsiLower( temp );
SendDlgItemMessage( hDlg, idStatic, WM_SETTEXT,
- 0, (LPARAM)MAKE_SEGPTR(temp) );
+ 0, (LPARAM)SEGPTR_GET(temp) );
+ SEGPTR_FREE(temp);
}
return ret;
}
diff --git a/controls/desktop.c b/controls/desktop.c
index c0d48fb..1e0c106 100644
--- a/controls/desktop.c
+++ b/controls/desktop.c
@@ -78,8 +78,8 @@
*/
static LONG DESKTOP_DoEraseBkgnd( HWND hwnd, HDC hdc, DESKTOPINFO *infoPtr )
{
- RECT rect;
- GetClientRect( hwnd, &rect );
+ RECT16 rect;
+ GetClientRect16( hwnd, &rect );
/* Paint desktop pattern (only if wall paper does not cover everything) */
@@ -90,7 +90,7 @@
/* Set colors in case pattern is a monochrome bitmap */
SetBkColor( hdc, RGB(0,0,0) );
SetTextColor( hdc, GetSysColor(COLOR_BACKGROUND) );
- FillRect( hdc, &rect, infoPtr->hbrushPattern );
+ FillRect16( hdc, &rect, infoPtr->hbrushPattern );
}
/* Paint wall paper */
diff --git a/controls/edit.c b/controls/edit.c
index d55c954..6bba8a3 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -125,7 +125,7 @@
static void EDIT_DelRight(WND *wndPtr);
static UINT EDIT_GetAveCharWidth(WND *wndPtr);
static UINT EDIT_GetLineHeight(WND *wndPtr);
-static void EDIT_GetLineRect(WND *wndPtr, UINT line, UINT scol, UINT ecol, LPRECT rc);
+static void EDIT_GetLineRect(WND *wndPtr, UINT line, UINT scol, UINT ecol, LPRECT16 rc);
static char * EDIT_GetPointer(WND *wndPtr);
static LRESULT EDIT_GetRect(WND *wndPtr, WPARAM wParam, LPARAM lParam);
static BOOL EDIT_GetRedraw(WND *wndPtr);
@@ -725,7 +725,7 @@
* column to an ending column.
*
*/
-static void EDIT_GetLineRect(WND *wndPtr, UINT line, UINT scol, UINT ecol, LPRECT rc)
+static void EDIT_GetLineRect(WND *wndPtr, UINT line, UINT scol, UINT ecol, LPRECT16 rc)
{
rc->top = EDIT_WndYFromLine(wndPtr, line);
rc->bottom = rc->top + EDIT_GetLineHeight(wndPtr);
@@ -764,7 +764,7 @@
*/
static LRESULT EDIT_GetRect(WND *wndPtr, WPARAM wParam, LPARAM lParam)
{
- GetClientRect(wndPtr->hwndSelf, (LPRECT)lParam);
+ GetClientRect16( wndPtr->hwndSelf, (LPRECT16)lParam );
return 0L;
}
@@ -802,7 +802,7 @@
*/
static UINT EDIT_GetVisibleLineCount(WND *wndPtr)
{
- RECT rc;
+ RECT16 rc;
EDIT_GetRect(wndPtr, 0, (LPARAM)&rc);
return MAX(1, MAX(rc.bottom - rc.top, 0) / EDIT_GetLineHeight(wndPtr));
@@ -816,7 +816,7 @@
*/
static UINT EDIT_GetWndWidth(WND *wndPtr)
{
- RECT rc;
+ RECT16 rc;
EDIT_GetRect(wndPtr, 0, (LPARAM)&rc);
return rc.right - rc.left;
@@ -855,9 +855,9 @@
UINT el;
UINT sc;
UINT ec;
- RECT rcWnd;
- RECT rcLine;
- RECT rcUpdate;
+ RECT16 rcWnd;
+ RECT16 rcLine;
+ RECT16 rcUpdate;
UINT l;
if (end == start )
@@ -885,26 +885,26 @@
EDIT_GetRect(wndPtr, 0, (LPARAM)&rcWnd);
if (sl == el) {
EDIT_GetLineRect(wndPtr, sl, sc, ec, &rcLine);
- if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
- InvalidateRect(wndPtr->hwndSelf, &rcUpdate, FALSE);
+ if (IntersectRect16(&rcUpdate, &rcWnd, &rcLine))
+ InvalidateRect16( wndPtr->hwndSelf, &rcUpdate, FALSE );
} else {
EDIT_GetLineRect(wndPtr, sl, sc,
(UINT)EDIT_EM_LineLength(wndPtr,
(UINT)EDIT_EM_LineIndex(wndPtr, sl, 0L), 0L),
&rcLine);
- if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
- InvalidateRect(wndPtr->hwndSelf, &rcUpdate, FALSE);
+ if (IntersectRect16(&rcUpdate, &rcWnd, &rcLine))
+ InvalidateRect16( wndPtr->hwndSelf, &rcUpdate, FALSE );
for (l = sl + 1 ; l < el ; l++) {
EDIT_GetLineRect(wndPtr, l, 0,
(UINT)EDIT_EM_LineLength(wndPtr,
(UINT)EDIT_EM_LineIndex(wndPtr, l, 0L), 0L),
&rcLine);
- if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
- InvalidateRect(wndPtr->hwndSelf, &rcUpdate, FALSE);
+ if (IntersectRect16(&rcUpdate, &rcWnd, &rcLine))
+ InvalidateRect16(wndPtr->hwndSelf, &rcUpdate, FALSE);
}
EDIT_GetLineRect(wndPtr, el, 0, ec, &rcLine);
- if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
- InvalidateRect(wndPtr->hwndSelf, &rcUpdate, FALSE);
+ if (IntersectRect16(&rcUpdate, &rcWnd, &rcLine))
+ InvalidateRect16( wndPtr->hwndSelf, &rcUpdate, FALSE );
}
}
@@ -1348,7 +1348,7 @@
EDIT_NOTIFY_PARENT(wndPtr, EN_UPDATE);
EDIT_WM_SetRedraw(wndPtr, redraw, 0L);
if (redraw) {
- InvalidateRect(wndPtr->hwndSelf, NULL, TRUE);
+ InvalidateRect32( wndPtr->hwndSelf, NULL, TRUE );
EDIT_NOTIFY_PARENT(wndPtr, EN_CHANGE);
}
return 0L;
@@ -1805,7 +1805,7 @@
UINT tw = EDIT_GetTextWidth(wndPtr);
INT dx;
INT dy;
- POINT pos;
+ POINT16 pos;
HRGN hRgn;
if (nfv >= lc)
@@ -1823,7 +1823,7 @@
GetUpdateRgn(wndPtr->hwndSelf, hRgn, FALSE);
ValidateRgn(wndPtr->hwndSelf, 0);
OffsetRgn(hRgn, dx, dy);
- InvalidateRgn(wndPtr->hwndSelf, hRgn, TRUE);
+ InvalidateRgn( wndPtr->hwndSelf, hRgn, TRUE );
DeleteObject(hRgn);
ScrollWindow(wndPtr->hwndSelf, dx, dy, NULL, NULL);
}
@@ -1836,7 +1836,7 @@
SetScrollPos(wndPtr->hwndSelf, SB_HORZ,
EDIT_WM_HScroll(wndPtr, EM_GETTHUMB, 0L), TRUE);
if (wndPtr->hwndSelf == GetFocus()) {
- GetCaretPos(&pos);
+ GetCaretPos16(&pos);
SetCaretPos(pos.x + dx, pos.y + dy);
ShowCaret(wndPtr->hwndSelf);
}
@@ -1894,7 +1894,7 @@
EDIT_EM_SetModify(wndPtr, FALSE, 0L);
EDIT_BuildLineDefs(wndPtr);
if (EDIT_GetRedraw(wndPtr))
- InvalidateRect(wndPtr->hwndSelf, NULL, TRUE);
+ InvalidateRect32( wndPtr->hwndSelf, NULL, TRUE );
EDIT_ScrollIntoView(wndPtr);
}
return 0L;
@@ -2130,7 +2130,7 @@
EDIT_NOTIFY_PARENT(wndPtr, EN_UPDATE);
EDIT_WM_SetRedraw(wndPtr, redraw, 0L);
if (redraw) {
- InvalidateRect(wndPtr->hwndSelf, NULL, TRUE);
+ InvalidateRect32( wndPtr->hwndSelf, NULL, TRUE );
EDIT_NOTIFY_PARENT(wndPtr, EN_CHANGE);
}
}
@@ -2179,7 +2179,7 @@
*/
static LRESULT EDIT_WM_Create(WND *wndPtr, WPARAM wParam, LPARAM lParam)
{
- CREATESTRUCT *cs = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam);
+ CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
EDITSTATE *es;
char *text;
@@ -2207,7 +2207,8 @@
es->PasswordChar = (cs->style & ES_PASSWORD) ? '*' : '\0';
}
if (!LOCAL_HeapSize(wndPtr->hInstance)) {
- if (!LocalInit(wndPtr->hInstance, 0, GlobalSize(wndPtr->hInstance))) {
+ if (!LocalInit(wndPtr->hInstance, 0,
+ GlobalSize16(wndPtr->hInstance))) {
fprintf(stderr, "edit: WM_CREATE: could not initialize local heap\n");
return -1L;
}
@@ -2282,22 +2283,22 @@
static LRESULT EDIT_WM_EraseBkGnd(WND *wndPtr, WPARAM wParam, LPARAM lParam)
{
HBRUSH hBrush;
- RECT rc;
+ RECT16 rc;
hBrush = (HBRUSH)EDIT_SEND_CTLCOLOR(wndPtr, wParam);
if (!hBrush)
hBrush = (HBRUSH)GetStockObject(WHITE_BRUSH);
- GetClientRect(wndPtr->hwndSelf, &rc);
+ GetClientRect16(wndPtr->hwndSelf, &rc);
IntersectClipRect((HDC)wParam, rc.left, rc.top, rc.right, rc.bottom);
- GetClipBox((HDC)wParam, &rc);
+ GetClipBox16((HDC)wParam, &rc);
/*
* FIXME: specs say that we should UnrealizeObject() the brush,
* but the specs of UnrealizeObject() say that we shouldn't
* unrealize a stock object. The default brush that
* DefWndProc() returns is ... a stock object.
*/
- FillRect((HDC)wParam, &rc, hBrush);
+ FillRect16((HDC)wParam, &rc, hBrush);
return -1L;
}
@@ -2642,23 +2643,23 @@
*/
static LRESULT EDIT_WM_Paint(WND *wndPtr, WPARAM wParam, LPARAM lParam)
{
- PAINTSTRUCT ps;
+ PAINTSTRUCT16 ps;
UINT i;
UINT fv = (UINT)EDIT_EM_GetFirstVisibleLine(wndPtr, 0, 0L);
UINT vlc = EDIT_GetVisibleLineCount(wndPtr);
UINT lc = (UINT)EDIT_EM_GetLineCount(wndPtr, 0, 0L);
- HDC hdc;
+ HDC16 hdc;
HFONT hFont;
HFONT oldFont = 0;
- RECT rc;
- RECT rcLine;
- RECT rcRgn;
+ RECT16 rc;
+ RECT16 rcLine;
+ RECT16 rcRgn;
BOOL rev = IsWindowEnabled(wndPtr->hwndSelf) &&
((GetFocus() == wndPtr->hwndSelf) ||
(wndPtr->dwStyle & ES_NOHIDESEL));
- hdc = BeginPaint(wndPtr->hwndSelf, &ps);
- GetClientRect(wndPtr->hwndSelf, &rc);
+ hdc = BeginPaint16(wndPtr->hwndSelf, &ps);
+ GetClientRect16(wndPtr->hwndSelf, &rc);
IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom);
hFont = EDIT_WM_GetFont(wndPtr, 0, 0L);
if (hFont)
@@ -2666,15 +2667,15 @@
EDIT_SEND_CTLCOLOR(wndPtr, hdc);
if (!IsWindowEnabled(wndPtr->hwndSelf))
SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
- GetClipBox(hdc, &rcRgn);
+ GetClipBox16(hdc, &rcRgn);
for (i = fv ; i <= MIN(fv + vlc, fv + lc - 1) ; i++ ) {
EDIT_GetLineRect(wndPtr, i, 0, -1, &rcLine);
- if (IntersectRect(&rc, &rcRgn, &rcLine))
+ if (IntersectRect16(&rc, &rcRgn, &rcLine))
EDIT_PaintLine(wndPtr, hdc, i, rev);
}
if (hFont)
SelectObject(hdc, oldFont);
- EndPaint(wndPtr->hwndSelf, &ps);
+ EndPaint16(wndPtr->hwndSelf, &ps);
return 0L;
}
@@ -2760,7 +2761,7 @@
ReleaseDC(wndPtr->hwndSelf, hdc);
EDIT_BuildLineDefs(wndPtr);
if ((BOOL)lParam && EDIT_GetRedraw(wndPtr))
- InvalidateRect(wndPtr->hwndSelf, NULL, TRUE);
+ InvalidateRect32( wndPtr->hwndSelf, NULL, TRUE );
if (wndPtr->hwndSelf == GetFocus()) {
DestroyCaret();
CreateCaret(wndPtr->hwndSelf, 0, 2, EDIT_GetLineHeight(wndPtr));
@@ -2815,7 +2816,7 @@
(wParam == SIZE_RESTORED))) {
if (IsMultiLine(wndPtr) && IsWordWrap(wndPtr))
EDIT_BuildLineDefs(wndPtr);
- InvalidateRect(wndPtr->hwndSelf, NULL, TRUE);
+ InvalidateRect32( wndPtr->hwndSelf, NULL, TRUE );
}
return 0L;
}
diff --git a/controls/listbox.c b/controls/listbox.c
index b6d31c0..9e40cba 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -27,7 +27,7 @@
#include "dos_fs.h"
#include "drive.h"
#include "file.h"
-#include "stackframe.h"
+#include "heap.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
@@ -117,7 +117,7 @@
if (lphl->OwnerDrawn) {
LISTSTRUCT dummyls;
- lphl->hDrawItemStruct = USER_HEAP_ALLOC(sizeof(DRAWITEMSTRUCT));
+ lphl->hDrawItemStruct = USER_HEAP_ALLOC(sizeof(DRAWITEMSTRUCT16));
lphl->needMeasure = TRUE;
dummyls.mis.CtlType = lphl->DrawCtlType;
dummyls.mis.CtlID = lphl->CtlID;
@@ -187,9 +187,7 @@
SetScrollRange(hwnd, SB_HORZ, 1, lphl->ItemsVisible /
lphl->ItemsPerColumn + 1, TRUE);
- if (repaint && lphl->bRedrawFlag) {
- InvalidateRect(hwnd, NULL, TRUE);
- }
+ if (repaint && lphl->bRedrawFlag) InvalidateRect32( hwnd, NULL, TRUE );
}
/* Returns: 0 if nothing needs to be changed */
@@ -237,10 +235,10 @@
void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc, LPLISTSTRUCT lpls,
- RECT *rect, WORD itemAction, WORD itemState)
+ RECT16 *rect, WORD itemAction, WORD itemState)
{
if (lphl->OwnerDrawn) {
- DRAWITEMSTRUCT *dis = USER_HEAP_LIN_ADDR(lphl->hDrawItemStruct);
+ DRAWITEMSTRUCT16 *dis = USER_HEAP_LIN_ADDR(lphl->hDrawItemStruct);
dis->CtlID = lpls->mis.CtlID;
dis->CtlType = lpls->mis.CtlType;
@@ -262,7 +260,7 @@
if (itemState != 0) {
dwOldTextColor = SetTextColor(hdc, 0x00FFFFFFL);
- FillRect(hdc, rect, GetStockObject(BLACK_BRUSH));
+ FillRect16(hdc, rect, GetStockObject(BLACK_BRUSH));
}
if (lphl->dwStyle & LBS_USETABSTOPS) {
@@ -270,8 +268,8 @@
(char *)lpls->itemText, strlen((char *)lpls->itemText),
lphl->iNumStops, lphl->TabStops, 0);
} else {
- TextOut(hdc, rect->left + 5, rect->top + 2,
- (char *)lpls->itemText, strlen((char *)lpls->itemText));
+ TextOut16(hdc, rect->left + 5, rect->top + 2,
+ (char *)lpls->itemText, strlen((char *)lpls->itemText));
}
if (itemState != 0) {
@@ -279,7 +277,7 @@
}
SetBkMode(hdc, OldBkMode);
- } else DrawFocusRect(hdc, rect);
+ } else DrawFocusRect16(hdc, rect);
}
return;
@@ -290,7 +288,7 @@
{
LPLISTSTRUCT lpls = lphl->lpFirst;
int i, j;
- POINT point;
+ POINT16 point;
point.x = X; point.y = Y;
if (lphl->ItemsCount == 0) return LB_ERR;
@@ -301,7 +299,7 @@
}
for(j = 0; j < lphl->ItemsVisible; i++, j++) {
if (lpls == NULL) return LB_ERR;
- if (PtInRect(&lpls->itemRect,point)) {
+ if (PtInRect16(&lpls->itemRect,point)) {
return i;
}
lpls = lpls->lpNext;
@@ -349,7 +347,7 @@
lplsnew->mis.itemHeight = lphl->StdItemHeight;
lplsnew->mis.itemWidth = 0; /* ignored */
lplsnew->mis.itemData = 0;
- SetRect(&lplsnew->itemRect, 0, 0, 0, 0);
+ SetRectEmpty16( &lplsnew->itemRect );
return lplsnew;
}
@@ -598,7 +596,8 @@
lpls->itemState = 0;
}
- if (wIndex != (UINT)-1) {
+ if ((wIndex != (UINT)-1) && (wIndex < lphl->ItemsCount))
+ {
lphl->ItemFocused = wIndex;
lpls = ListBoxGetItem(lphl, wIndex);
if (lpls == 0) return LB_ERR;
@@ -714,7 +713,7 @@
/* ------------------------- dimensions ------------------------- */
-int ListBoxGetItemRect(LPHEADLIST lphl, WORD wIndex, LPRECT lprect)
+int ListBoxGetItemRect(LPHEADLIST lphl, WORD wIndex, LPRECT16 lprect)
{
LPLISTSTRUCT lpls = ListBoxGetItem(lphl,wIndex);
@@ -773,14 +772,14 @@
{
LPHEADLIST lphl;
LONG dwStyle = GetWindowLong(hwnd,GWL_STYLE);
- RECT rect;
+ RECT16 rect;
CreateListBoxStruct(hwnd, ODT_LISTBOX, dwStyle, GetParent(hwnd));
lphl = ListBoxGetStorageHeader(hwnd);
dprintf_listbox(stddeb,"ListBox created: lphl = %p dwStyle = %04x:%04x\n",
lphl, HIWORD(dwStyle), LOWORD(dwStyle));
- GetClientRect(hwnd,&rect);
+ GetClientRect16(hwnd,&rect);
lphl->ColumnsWidth = rect.right - rect.left;
if (dwStyle & WS_VSCROLL)
@@ -850,7 +849,7 @@
if (y != lphl->FirstVisible) {
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
}
return 0;
}
@@ -906,7 +905,7 @@
if (y != lphl->FirstVisible) {
SetScrollPos(hwnd, SB_HORZ, lphl->FirstVisible /
lphl->ItemsPerColumn + 1, TRUE);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
}
}
return 0;
@@ -920,9 +919,7 @@
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
WORD wRet;
int y,n;
- RECT rectsel;
- POINT tmpPOINT;
- tmpPOINT.x = LOWORD(lParam); tmpPOINT.y = HIWORD(lParam);
+ RECT16 rectsel;
SetFocus(hwnd);
SetCapture(hwnd);
@@ -957,7 +954,7 @@
lpls->itemState = ODS_FOCUS | ODS_SELECTED;
if( n > 1 && n != LB_ERR )
- InvalidateRect(hwnd,NULL,TRUE);
+ InvalidateRect32( hwnd,NULL,TRUE );
}
else
return 0;
@@ -978,17 +975,17 @@
if( lphl->dwStyle & LBS_MULTIPLESEL || y!=lphl->PrevFocused )
{
ListBoxGetItemRect(lphl, y, &rectsel);
- InvalidateRect(hwnd, &rectsel, TRUE);
+ InvalidateRect16( hwnd, &rectsel, TRUE );
}
if( lphl->PrevFocused!=-1 && y!=lphl->PrevFocused )
{
ListBoxGetItemRect(lphl, lphl->PrevFocused, &rectsel);
- InvalidateRect(hwnd, &rectsel, TRUE);
+ InvalidateRect16( hwnd, &rectsel, TRUE );
}
#ifndef WINELIB
if (GetWindowLong(lphl->hSelf,GWL_EXSTYLE) & WS_EX_DRAGDETECT)
- if( DragDetect(lphl->hSelf,tmpPOINT) )
+ if( DragDetect(lphl->hSelf,MAKEPOINT16(lParam)) )
SendMessage(lphl->hParent, WM_BEGINDRAG,0,0L);
#endif
return 0;
@@ -1036,7 +1033,7 @@
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
int y,redraw_prev = 0;
int iRet;
- RECT rect, rectsel; /* XXX Broken */
+ RECT16 rect, rectsel; /* XXX Broken */
dprintf_listbox(stddeb,"LBMouseMove %d %d\n",SLOWORD(lParam),SHIWORD(lParam));
if ((wParam & MK_LBUTTON) != 0) {
@@ -1045,16 +1042,16 @@
if (lphl->FirstVisible > 0) {
lphl->FirstVisible--;
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
}
- GetClientRect(hwnd, &rect);
+ GetClientRect16(hwnd, &rect);
if (y >= (rect.bottom-LBMM_EDGE)) {
if (lphl->FirstVisible < ListMaxFirstVisible(lphl)) {
lphl->FirstVisible++;
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
}
@@ -1084,10 +1081,10 @@
if( lphl->PrevFocused!=-1 && redraw_prev )
{
ListBoxGetItemRect(lphl, lphl->PrevFocused, &rectsel);
- InvalidateRect(hwnd, &rectsel, TRUE);
+ InvalidateRect16( hwnd, &rectsel, TRUE );
}
ListBoxGetItemRect(lphl, iRet, &rectsel);
- InvalidateRect(hwnd, &rectsel, TRUE);
+ InvalidateRect16( hwnd, &rectsel, TRUE );
}
}
}
@@ -1104,7 +1101,7 @@
{
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
WORD newFocused = 0xFFFF;
- RECT rect;
+ RECT16 rect;
ListBoxGetItemRect(lphl,lphl->ItemFocused,&rect);
switch(wParam)
@@ -1197,14 +1194,14 @@
if( ListBoxScrollToFocus(lphl) || (lphl->dwStyle &
(LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) )
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
else
{
- InvalidateRect(hwnd, &rect, TRUE);
+ InvalidateRect16( hwnd, &rect, TRUE );
if( newFocused < 0x8000 )
{
ListBoxGetItemRect(lphl, newFocused, &rect);
- InvalidateRect(hwnd, &rect, TRUE);
+ InvalidateRect16( hwnd, &rect, TRUE );
}
}
@@ -1246,7 +1243,7 @@
ListBoxScrollToFocus(lphl);
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
@@ -1301,24 +1298,24 @@
{
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
LPLISTSTRUCT lpls;
- PAINTSTRUCT ps;
+ PAINTSTRUCT16 ps;
HBRUSH hBrush;
HFONT hOldFont;
- HDC hdc = BeginPaint( hwnd, &ps );
+ HDC16 hdc = BeginPaint16( hwnd, &ps );
DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC);
- RECT rect, paintRect, scratchRect;
+ RECT16 rect, paintRect, scratchRect;
int i, top, height, maxwidth, ipc;
top = 0;
if (!IsWindowVisible(hwnd) || !lphl->bRedrawFlag) {
- EndPaint(hwnd, &ps);
+ EndPaint16(hwnd, &ps);
return 0;
}
- GetRgnBox(dc->w.hGCClipRgn,&paintRect);
- GetClientRect(hwnd, &rect);
- IntersectRect(&paintRect,&rect,&paintRect);
+ GetRgnBox16(dc->w.hGCClipRgn,&paintRect);
+ GetClientRect16(hwnd, &rect);
+ IntersectRect16(&paintRect,&rect,&paintRect);
hOldFont = SelectObject(hdc, lphl->hFont);
@@ -1332,7 +1329,7 @@
if (hBrush == 0) hBrush = GetStockObject(WHITE_BRUSH);
- FillRect(hdc, &rect, hBrush);
+ FillRect16(hdc, &rect, hBrush);
maxwidth = rect.right;
if (lphl->dwStyle & LBS_MULTICOLUMN) {
@@ -1367,7 +1364,7 @@
lpls->itemRect.left = rect.left;
lpls->itemRect.right = rect.right;
- if( IntersectRect(&scratchRect,&paintRect,&lpls->itemRect) )
+ if( IntersectRect16(&scratchRect,&paintRect,&lpls->itemRect) )
{
dprintf_listbox(stddeb,"LBPaint: drawing item: %d %d %d %d %d\n",
rect.left,top,rect.right,top+height,lpls->itemState);
@@ -1394,7 +1391,7 @@
}
ListBoxUpdateWindow(hwnd,lphl,FALSE);
SelectObject(hdc,hOldFont);
- EndPaint( hwnd, &ps );
+ EndPaint16( hwnd, &ps );
return 0;
}
@@ -1454,7 +1451,7 @@
dprintf_listbox(stddeb,"LBKillFocus: no focused item!\n");
}
else
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
ListBoxSendNotification(lphl, LBN_KILLFOCUS);
@@ -1735,7 +1732,7 @@
ListBoxSetCurSel(lphl,iRet);
lphl->ItemFocused = iRet;
- InvalidateRect(hwnd,0,TRUE);
+ InvalidateRect32( hwnd, 0, TRUE );
}
return iRet;
}
@@ -1793,7 +1790,7 @@
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
if(i)
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return 1;
}
@@ -1805,7 +1802,7 @@
{
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
lphl->ColumnsWidth = wParam;
- InvalidateRect(hwnd,NULL,TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
@@ -1875,7 +1872,7 @@
wRet = ListBoxSetCurSel(lphl, wParam);
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return wRet;
}
@@ -1886,26 +1883,25 @@
static LONG LBSetSel(HWND hwnd, WORD wParam, LONG lParam)
{
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
- RECT rect;
+ RECT16 rect;
int iRet;
dprintf_listbox(stddeb,"ListBox LB_SETSEL wParam=%x lParam=%lX !\n", wParam, lParam);
iRet = ListBoxSetSel(lphl, LOWORD(lParam), wParam);
- if( iRet > 1 )
- InvalidateRect(hwnd, NULL, TRUE);
+ if( iRet > 1 ) InvalidateRect32( hwnd, NULL, TRUE );
else if( iRet != LB_ERR )
{
if( lphl->dwStyle & LBS_EXTENDEDSEL &&
lphl->ItemFocused != LOWORD(lParam) )
{
ListBoxGetItemRect(lphl, lphl->ItemFocused , &rect);
- InvalidateRect(hwnd,&rect,TRUE);
+ InvalidateRect16( hwnd, &rect, TRUE );
lphl->ItemFocused = LOWORD(lParam);
}
ListBoxGetItemRect(lphl,LOWORD(lParam),&rect);
- InvalidateRect(hwnd,&rect,TRUE);
+ InvalidateRect16( hwnd, &rect, TRUE );
}
return (iRet == (WORD)LB_ERR)? LB_ERR: 0;
@@ -1923,7 +1919,7 @@
lphl->FirstVisible = wParam;
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
- InvalidateRect(hwnd, NULL, TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return 0;
}
@@ -1938,7 +1934,7 @@
dprintf_listbox(stddeb,"ListBox LB_SETITEMHEIGHT wParam=%x lParam=%lX !\n", wParam, lParam);
wRet = ListBoxSetItemHeight(lphl, wParam, lParam);
- InvalidateRect(hwnd,NULL,TRUE);
+ InvalidateRect32( hwnd, NULL, TRUE );
return wRet;
}
@@ -2045,13 +2041,14 @@
*/
BOOL DlgDirSelect( HWND hDlg, LPSTR lpStr, INT id )
{
- char buffer[20];
+ char *buffer;
INT i;
dprintf_listbox( stddeb, "DlgDirSelect: %04x '%s' %d\n", hDlg, lpStr, id );
if ((i = SendDlgItemMessage( hDlg, id, LB_GETCURSEL, 0, 0 )) == LB_ERR)
return FALSE;
- SendDlgItemMessage( hDlg, id, LB_GETTEXT, i, (LPARAM)MAKE_SEGPTR(buffer) );
+ if (!(buffer = SEGPTR_ALLOC( 20 * sizeof(char) ))) return FALSE;
+ SendDlgItemMessage( hDlg, id, LB_GETTEXT, i, (LPARAM)SEGPTR_GET(buffer) );
if (buffer[0] == '[') /* drive or directory */
{
if (buffer[1] == '-') /* drive */
@@ -2060,15 +2057,18 @@
lpStr[1] = ':';
lpStr[2] = '\0';
dprintf_listbox( stddeb, "Returning drive '%s'\n", lpStr );
+ SEGPTR_FREE(buffer);
return TRUE;
}
strcpy( lpStr, buffer + 1 );
lpStr[strlen(lpStr)-1] = '\\';
dprintf_listbox( stddeb, "Returning directory '%s'\n", lpStr );
+ SEGPTR_FREE(buffer);
return TRUE;
}
strcpy( lpStr, buffer );
dprintf_listbox( stddeb, "Returning file '%s'\n", lpStr );
+ SEGPTR_FREE(buffer);
return FALSE;
}
@@ -2101,7 +2101,6 @@
if (idLBox && ((hwnd = GetDlgItem( hDlg, idLBox )) != 0))
{
char mask[20];
- char temp[] = "*.*";
if (!filespec[0]) strcpy( mask, "*.*" );
else
@@ -2131,10 +2130,18 @@
SENDMSG( LB_RESETCONTENT, 0, 0 );
if ((attrib & DDL_DIRECTORY) && !(attrib & DDL_EXCLUSIVE))
{
+ char *temp;
if (SENDMSG( LB_DIR, attrib & ~(DDL_DIRECTORY | DDL_DRIVES),
(LPARAM)spec ) == LB_ERR) return FALSE;
+ if (!(temp = SEGPTR_ALLOC( 4*sizeof(char) ))) return FALSE;
+ strcpy( temp, "*.*" );
if (SENDMSG( LB_DIR, (attrib & (DDL_DIRECTORY | DDL_DRIVES)) | DDL_EXCLUSIVE,
- (LPARAM)MAKE_SEGPTR(temp) ) == LB_ERR) return FALSE;
+ (LPARAM)SEGPTR_GET(temp) ) == LB_ERR)
+ {
+ SEGPTR_FREE(temp);
+ return FALSE;
+ }
+ SEGPTR_FREE(temp);
}
else
{
@@ -2144,12 +2151,15 @@
if (idStatic && ((hwnd = GetDlgItem( hDlg, idStatic )) != 0))
{
- char temp[256];
+ const char *cwd = DRIVE_GetDosCwd(drive);
+ char *temp = SEGPTR_ALLOC( strlen(cwd) + 4 );
+ if (!temp) return FALSE;
strcpy( temp, "A:\\" );
temp[0] += drive;
- lstrcpyn( temp+3, DRIVE_GetDosCwd(drive), 253 );
+ strcpy( temp + 3, cwd );
AnsiLower( temp );
- SENDMSG( WM_SETTEXT, 0, (LPARAM)MAKE_SEGPTR(temp) );
+ SENDMSG( WM_SETTEXT, 0, (LPARAM)SEGPTR_GET(temp) );
+ SEGPTR_FREE(temp);
}
return TRUE;
#undef SENDMSG
diff --git a/controls/menu.c b/controls/menu.c
index 20f4e06..e36dea0 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -20,6 +20,7 @@
#include "sysmetrics.h"
#include "task.h"
#include "win.h"
+#include "heap.h"
#include "menu.h"
#include "module.h"
#include "neexe.h"
@@ -27,7 +28,6 @@
#include "message.h"
#include "graphics.h"
#include "resource.h"
-#include "stackframe.h"
#include "stddebug.h"
#include "debug.h"
@@ -62,7 +62,8 @@
((DWORD)MAKELONG( (WORD)(item)->hText, (item)->xTab ))
extern void NC_DrawSysButton(HWND hwnd, HDC hdc, BOOL down); /* nonclient.c */
-static HMENU MENU_CopySysMenu(void);
+
+HMENU MENU_CopySysMenu(void);
static HBITMAP hStdCheck = 0;
static HBITMAP hStdMnArrow = 0;
@@ -136,7 +137,7 @@
/**********************************************************************
* MENU_CopySysMenu
*/
-static HMENU MENU_CopySysMenu(void)
+HMENU MENU_CopySysMenu(void)
{
HMENU hMenu;
HGLOBAL handle;
@@ -163,7 +164,7 @@
* Check whether the point (in screen coords) is in the system menu
* of the window owning the given menu.
*/
-static BOOL MENU_IsInSysMenu( POPUPMENU *menu, POINT pt )
+static BOOL MENU_IsInSysMenu( POPUPMENU *menu, POINT16 pt )
{
WND *wndPtr;
@@ -303,21 +304,23 @@
DWORD dwSize;
char *p;
- SetRect( &lpitem->rect, orgX, orgY, orgX, orgY );
+ SetRect16( &lpitem->rect, orgX, orgY, orgX, orgY );
if (lpitem->item_flags & MF_OWNERDRAW)
{
- MEASUREITEMSTRUCT mis;
- mis.CtlType = ODT_MENU;
- mis.itemID = lpitem->item_id;
- mis.itemData = GET_OWNERDRAW_DATA(lpitem);
- mis.itemHeight = 16;
- mis.itemWidth = 30;
- SendMessage( hwndOwner, WM_MEASUREITEM, 0, (LPARAM)MAKE_SEGPTR(&mis) );
- lpitem->rect.bottom += mis.itemHeight;
- lpitem->rect.right += mis.itemWidth;
+ MEASUREITEMSTRUCT *mis;
+ if (!(mis = SEGPTR_NEW(MEASUREITEMSTRUCT))) return;
+ mis->CtlType = ODT_MENU;
+ mis->itemID = lpitem->item_id;
+ mis->itemData = GET_OWNERDRAW_DATA(lpitem);
+ mis->itemHeight = 16;
+ mis->itemWidth = 30;
+ SendMessage( hwndOwner, WM_MEASUREITEM, 0, (LPARAM)SEGPTR_GET(mis) );
+ lpitem->rect.bottom += mis->itemHeight;
+ lpitem->rect.right += mis->itemWidth;
dprintf_menu( stddeb, "DrawMenuItem: MeasureItem %04x %dx%d!\n",
- lpitem->item_id, mis.itemWidth, mis.itemHeight );
+ lpitem->item_id, mis->itemWidth, mis->itemHeight );
+ SEGPTR_FREE(mis);
return;
}
@@ -434,7 +437,7 @@
*
* Calculate the size of the menu bar.
*/
-static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect, LPPOPUPMENU lppop,
+static void MENU_MenuBarCalcSize( HDC hdc, LPRECT16 lprect, LPPOPUPMENU lppop,
HWND hwndOwner )
{
LPMENUITEM lpitem, items;
@@ -506,25 +509,27 @@
static void MENU_DrawMenuItem( HWND hwnd, HDC hdc, LPMENUITEM lpitem,
UINT height, BOOL menuBar )
{
- RECT rect;
+ RECT16 rect;
if (lpitem->item_flags & MF_OWNERDRAW)
{
- DRAWITEMSTRUCT dis;
+ DRAWITEMSTRUCT16 *dis;
+ if (!(dis = SEGPTR_NEW(DRAWITEMSTRUCT16))) return;
dprintf_menu( stddeb, "DrawMenuItem: Ownerdraw!\n" );
- dis.CtlType = ODT_MENU;
- dis.itemID = lpitem->item_id;
- dis.itemData = GET_OWNERDRAW_DATA(lpitem);
- dis.itemState = 0;
- if (lpitem->item_flags & MF_CHECKED) dis.itemState |= ODS_CHECKED;
- if (lpitem->item_flags & MF_GRAYED) dis.itemState |= ODS_GRAYED;
- if (lpitem->item_flags & MF_HILITE) dis.itemState |= ODS_SELECTED;
- dis.itemAction = ODA_DRAWENTIRE | ODA_SELECT | ODA_FOCUS;
- dis.hwndItem = hwnd;
- dis.hDC = hdc;
- dis.rcItem = lpitem->rect;
- SendMessage( hwnd, WM_DRAWITEM, 0, (LPARAM)MAKE_SEGPTR(&dis) );
+ dis->CtlType = ODT_MENU;
+ dis->itemID = lpitem->item_id;
+ dis->itemData = GET_OWNERDRAW_DATA(lpitem);
+ dis->itemState = 0;
+ if (lpitem->item_flags & MF_CHECKED) dis->itemState |= ODS_CHECKED;
+ if (lpitem->item_flags & MF_GRAYED) dis->itemState |= ODS_GRAYED;
+ if (lpitem->item_flags & MF_HILITE) dis->itemState |= ODS_SELECTED;
+ dis->itemAction = ODA_DRAWENTIRE | ODA_SELECT | ODA_FOCUS;
+ dis->hwndItem = hwnd;
+ dis->hDC = hdc;
+ dis->rcItem = lpitem->rect;
+ SendMessage( hwnd, WM_DRAWITEM, 0, (LPARAM)SEGPTR_GET(dis) );
+ SEGPTR_FREE(dis);
return;
}
@@ -534,8 +539,8 @@
/* Draw the background */
if (lpitem->item_flags & MF_HILITE)
- FillRect( hdc, &rect, sysColorObjects.hbrushHighlight );
- else FillRect( hdc, &rect, sysColorObjects.hbrushMenu );
+ FillRect16( hdc, &rect, sysColorObjects.hbrushHighlight );
+ else FillRect16( hdc, &rect, sysColorObjects.hbrushMenu );
SetBkMode( hdc, TRANSPARENT );
/* Draw the separator bar (if any) */
@@ -631,18 +636,18 @@
if ((text[i] == '\t') || (text[i] == '\b')) break;
}
- DrawText( hdc, text, i, &rect, DT_LEFT | DT_VCENTER | DT_SINGLELINE );
+ DrawText16( hdc, text, i, &rect, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
if (text[i]) /* There's a tab or flush-right char */
{
if (text[i] == '\t')
{
rect.left = lpitem->xTab;
- DrawText( hdc, text + i + 1, -1, &rect,
- DT_LEFT | DT_VCENTER | DT_SINGLELINE );
+ DrawText16( hdc, text + i + 1, -1, &rect,
+ DT_LEFT | DT_VCENTER | DT_SINGLELINE );
}
- else DrawText( hdc, text + i + 1, -1, &rect,
- DT_RIGHT | DT_VCENTER | DT_SINGLELINE );
+ else DrawText16( hdc, text + i + 1, -1, &rect,
+ DT_RIGHT | DT_VCENTER | DT_SINGLELINE );
}
}
}
@@ -657,11 +662,11 @@
{
POPUPMENU *menu;
MENUITEM *item;
- RECT rect;
+ RECT16 rect;
int i;
- GetClientRect( hwnd, &rect );
- FillRect( hdc, &rect, sysColorObjects.hbrushMenu );
+ GetClientRect16( hwnd, &rect );
+ FillRect16( hdc, &rect, sysColorObjects.hbrushMenu );
menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
if (!menu || !menu->nItems) return;
item = (MENUITEM *) USER_HEAP_LIN_ADDR( menu->hItems );
@@ -675,7 +680,7 @@
*
* Paint a menu bar. Returns the height of the menu bar.
*/
-UINT MENU_DrawMenuBar(HDC hDC, LPRECT lprect, HWND hwnd, BOOL suppress_draw)
+UINT MENU_DrawMenuBar(HDC hDC, LPRECT16 lprect, HWND hwnd, BOOL suppress_draw)
{
LPPOPUPMENU lppop;
LPMENUITEM lpitem;
@@ -690,7 +695,7 @@
lprect->bottom = lprect->top + lppop->Height;
if (suppress_draw) return lppop->Height;
- FillRect(hDC, lprect, sysColorObjects.hbrushMenu );
+ FillRect16(hDC, lprect, sysColorObjects.hbrushMenu );
SelectObject( hDC, sysColorObjects.hpenWindowFrame );
MoveTo( hDC, lprect->left, lprect->bottom );
LineTo( hDC, lprect->right, lprect->bottom );
@@ -797,7 +802,8 @@
/***********************************************************************
* MENU_SelectItem
*/
-static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex )
+static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex,
+ BOOL sendMenuSelect )
{
MENUITEM *items;
LPPOPUPMENU lppop;
@@ -834,16 +840,17 @@
if (lppop->FocusedItem == SYSMENU_SELECTED)
{
NC_DrawSysButton( lppop->hWnd, hdc, TRUE );
+ if (sendMenuSelect)
#ifdef WINELIB32
/* FIX: LostInfo */
- SendMessage( hwndOwner, WM_MENUSELECT,
- MAKEWPARAM( WIN_FindWndPtr(lppop->hWnd)->hSysMenu,
- lppop->wFlags | MF_MOUSESELECT ),
- (LPARAM)hmenu );
+ SendMessage( hwndOwner, WM_MENUSELECT,
+ MAKEWPARAM( WIN_FindWndPtr(lppop->hWnd)->hSysMenu,
+ lppop->wFlags | MF_MOUSESELECT ),
+ (LPARAM)hmenu );
#else
- SendMessage( hwndOwner, WM_MENUSELECT,
- WIN_FindWndPtr(lppop->hWnd)->hSysMenu,
- MAKELONG( lppop->wFlags | MF_MOUSESELECT, hmenu ) );
+ SendMessage( hwndOwner, WM_MENUSELECT,
+ WIN_FindWndPtr(lppop->hWnd)->hSysMenu,
+ MAKELONG(lppop->wFlags | MF_MOUSESELECT, hmenu));
#endif
}
else
@@ -851,27 +858,30 @@
items[lppop->FocusedItem].item_flags |= MF_HILITE;
MENU_DrawMenuItem( lppop->hWnd, hdc, &items[lppop->FocusedItem], lppop->Height,
!(lppop->wFlags & MF_POPUP) );
+ if (sendMenuSelect)
#ifdef WINELIB32
- SendMessage( hwndOwner, WM_MENUSELECT,
- MAKEWPARAM( items[lppop->FocusedItem].item_id,
- items[lppop->FocusedItem].item_flags |
- MF_MOUSESELECT ),
- (LPARAM) hmenu );
+ SendMessage( hwndOwner, WM_MENUSELECT,
+ MAKEWPARAM( items[lppop->FocusedItem].item_id,
+ items[lppop->FocusedItem].item_flags|
+ MF_MOUSESELECT ),
+ (LPARAM) hmenu );
#else
- SendMessage( hwndOwner, WM_MENUSELECT,
- items[lppop->FocusedItem].item_id,
- MAKELONG( items[lppop->FocusedItem].item_flags | MF_MOUSESELECT, hmenu));
+ SendMessage( hwndOwner, WM_MENUSELECT,
+ items[lppop->FocusedItem].item_id,
+ MAKELONG( items[lppop->FocusedItem].item_flags | MF_MOUSESELECT, hmenu));
#endif
}
}
#ifdef WINELIB32
/* FIX: Lost Info */
- else SendMessage( hwndOwner, WM_MENUSELECT,
- MAKEWPARAM( (DWORD)hmenu, lppop->wFlags | MF_MOUSESELECT),
- hmenu );
+ else if (sendMenuSelect)
+ SendMessage( hwndOwner, WM_MENUSELECT,
+ MAKEWPARAM( (DWORD)hmenu, lppop->wFlags | MF_MOUSESELECT),
+ hmenu );
#else
- else SendMessage( hwndOwner, WM_MENUSELECT, hmenu,
- MAKELONG( lppop->wFlags | MF_MOUSESELECT, hmenu ) );
+ else if (sendMenuSelect)
+ SendMessage( hwndOwner, WM_MENUSELECT, hmenu,
+ MAKELONG( lppop->wFlags | MF_MOUSESELECT, hmenu ) );
#endif
ReleaseDC( lppop->hWnd, hdc );
@@ -897,13 +907,13 @@
{
if (!(items[i].item_flags & MF_SEPARATOR))
{
- MENU_SelectItem( hwndOwner, hmenu, i );
+ MENU_SelectItem( hwndOwner, hmenu, i, TRUE );
return;
}
}
if (MENU_HasSysMenu( menu ))
{
- MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED );
+ MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED, TRUE );
return;
}
}
@@ -911,12 +921,12 @@
{
if (!(items[i].item_flags & MF_SEPARATOR))
{
- MENU_SelectItem( hwndOwner, hmenu, i );
+ MENU_SelectItem( hwndOwner, hmenu, i, TRUE );
return;
}
}
if (MENU_HasSysMenu( menu ))
- MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED );
+ MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED, TRUE );
}
@@ -939,13 +949,13 @@
{
if (!(items[i].item_flags & MF_SEPARATOR))
{
- MENU_SelectItem( hwndOwner, hmenu, i );
+ MENU_SelectItem( hwndOwner, hmenu, i, TRUE );
return;
}
}
if (MENU_HasSysMenu( menu ))
{
- MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED );
+ MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED, TRUE );
return;
}
}
@@ -953,12 +963,12 @@
{
if (!(items[i].item_flags & MF_SEPARATOR))
{
- MENU_SelectItem( hwndOwner, hmenu, i );
+ MENU_SelectItem( hwndOwner, hmenu, i, TRUE );
return;
}
}
if (MENU_HasSysMenu( menu ))
- MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED );
+ MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED, TRUE );
}
@@ -1000,7 +1010,7 @@
item->item_flags = flags & ~(MF_HILITE | MF_MOUSESELECT);
item->item_id = id;
- SetRectEmpty( &item->rect );
+ SetRectEmpty16( &item->rect );
if (hPrevText) USER_HEAP_FREE( hPrevText );
return TRUE;
}
@@ -1144,7 +1154,8 @@
*
* Hide the sub-popup menus of this menu.
*/
-static void MENU_HideSubPopups( HWND hwndOwner, HMENU hmenu )
+static void MENU_HideSubPopups( HWND hwndOwner, HMENU hmenu,
+ BOOL sendMenuSelect )
{
MENUITEM *item;
POPUPMENU *menu, *submenu;
@@ -1165,18 +1176,18 @@
hsubmenu = (HMENU)item->item_id;
}
submenu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hsubmenu );
- MENU_HideSubPopups( hwndOwner, hsubmenu );
+ MENU_HideSubPopups( hwndOwner, hsubmenu, FALSE );
+ MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM, sendMenuSelect );
if (submenu->hWnd == pTopPWnd->hwndSelf )
- {
+ {
ShowWindow( submenu->hWnd, SW_HIDE );
uSubPWndLevel = 0;
- }
+ }
else
- {
+ {
DestroyWindow( submenu->hWnd );
submenu->hWnd = 0;
- }
- MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM );
+ }
}
@@ -1228,12 +1239,12 @@
*
* Find the menu containing a given point (in screen coords).
*/
-static HMENU MENU_FindMenuByCoords( HMENU hmenu, POINT pt )
+static HMENU MENU_FindMenuByCoords( HMENU hmenu, POINT16 pt )
{
POPUPMENU *menu;
HWND hwnd;
- if (!(hwnd = WindowFromPoint( pt ))) return 0;
+ if (!(hwnd = WindowFromPoint16( pt ))) return 0;
while (hmenu)
{
menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
@@ -1300,7 +1311,7 @@
* Return TRUE if we can go on with menu tracking.
*/
static BOOL MENU_ButtonDown( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent,
- POINT pt )
+ POINT16 pt )
{
POPUPMENU *menu;
MENUITEM *item;
@@ -1324,7 +1335,7 @@
{
if (menu->wFlags & MF_POPUP)
{
- MENU_HideSubPopups( hwndOwner, hmenu );
+ MENU_HideSubPopups( hwndOwner, hmenu, TRUE );
*hmenuCurrent = hmenu;
}
else return FALSE;
@@ -1334,8 +1345,8 @@
}
else
{
- MENU_HideSubPopups( hwndOwner, hmenu );
- MENU_SelectItem( hwndOwner, hmenu, id );
+ MENU_HideSubPopups( hwndOwner, hmenu, FALSE );
+ MENU_SelectItem( hwndOwner, hmenu, id, TRUE );
*hmenuCurrent = MENU_ShowSubPopup( hwndOwner, hmenu, FALSE );
}
return TRUE;
@@ -1350,7 +1361,7 @@
* Return TRUE if we can go on with menu tracking.
*/
static BOOL MENU_ButtonUp( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent,
- POINT pt )
+ POINT16 pt )
{
POPUPMENU *menu;
MENUITEM *item;
@@ -1378,7 +1389,7 @@
hsubmenu = (HMENU)item->item_id;
}
/* Select first item of sub-popup */
- MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM );
+ MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM, FALSE );
MENU_SelectNextItem( hwndOwner, hsubmenu );
return TRUE;
}
@@ -1392,7 +1403,7 @@
* Return TRUE if we can go on with menu tracking.
*/
static BOOL MENU_MouseMove( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent,
- POINT pt )
+ POINT16 pt )
{
MENUITEM *item;
POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
@@ -1410,12 +1421,12 @@
}
if (id == NO_SELECTED_ITEM)
{
- MENU_SelectItem( hwndOwner, *hmenuCurrent, NO_SELECTED_ITEM );
+ MENU_SelectItem( hwndOwner, *hmenuCurrent, NO_SELECTED_ITEM, TRUE );
}
else if (menu->FocusedItem != id)
{
- MENU_HideSubPopups( hwndOwner, hmenu );
- MENU_SelectItem( hwndOwner, hmenu, id );
+ MENU_HideSubPopups( hwndOwner, hmenu, FALSE );
+ MENU_SelectItem( hwndOwner, hmenu, id, TRUE );
*hmenuCurrent = MENU_ShowSubPopup( hwndOwner, hmenu, FALSE );
}
return TRUE;
@@ -1440,7 +1451,7 @@
hmenutmp = MENU_GetSubPopup( hmenuprev );
if (hmenutmp != *hmenuCurrent) hmenuprev = hmenutmp;
}
- MENU_HideSubPopups( hwndOwner, hmenuprev );
+ MENU_HideSubPopups( hwndOwner, hmenuprev, TRUE );
if ((hmenuprev == hmenu) && !(menu->wFlags & MF_POPUP))
{
@@ -1483,7 +1494,7 @@
/* If on menu-bar, go to next item */
if (!(menu->wFlags & MF_POPUP))
{
- MENU_HideSubPopups( hwndOwner, hmenu );
+ MENU_HideSubPopups( hwndOwner, hmenu, FALSE );
MENU_SelectNextItem( hwndOwner, hmenu );
if (*hmenuCurrent != hmenu)
{
@@ -1500,7 +1511,7 @@
hmenutmp = MENU_GetSubPopup( hmenuprev );
if (hmenutmp != *hmenuCurrent) hmenuprev = hmenutmp;
}
- MENU_HideSubPopups( hwndOwner, hmenuprev );
+ MENU_HideSubPopups( hwndOwner, hmenuprev, TRUE );
*hmenuCurrent = hmenuprev;
}
}
@@ -1514,7 +1525,7 @@
* before beginning tracking. This is to help menu-bar tracking.
*/
static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, int x, int y,
- HWND hwnd, LPRECT lprect )
+ HWND hwnd, const RECT16 *lprect )
{
MSG *msg;
HLOCAL16 hMsg;
@@ -1527,7 +1538,7 @@
if (!(menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu ))) return FALSE;
if (x && y)
{
- POINT pt = { x, y };
+ POINT16 pt = { x, y };
MENU_ButtonDown( hwnd, hmenu, &hmenuCurrent, pt );
}
SetCapture( hwnd );
@@ -1564,7 +1575,7 @@
case WM_LBUTTONUP:
case WM_NCLBUTTONUP:
/* If outside all menus but inside lprect, ignore it */
- if (!hsubmenu && lprect && PtInRect( lprect, msg->pt )) break;
+ if (!hsubmenu && lprect && PtInRect16(lprect, msg->pt)) break;
fClosed = !MENU_ButtonUp( hwnd, hsubmenu,
&hmenuCurrent, msg->pt );
fRemove = TRUE; /* Remove event even if outside menu */
@@ -1590,12 +1601,12 @@
switch(msg->wParam)
{
case VK_HOME:
- MENU_SelectItem( hwnd, hmenuCurrent, NO_SELECTED_ITEM );
+ MENU_SelectItem( hwnd, hmenuCurrent, NO_SELECTED_ITEM, FALSE );
MENU_SelectNextItem( hwnd, hmenuCurrent );
break;
case VK_END:
- MENU_SelectItem( hwnd, hmenuCurrent, NO_SELECTED_ITEM );
+ MENU_SelectItem( hwnd, hmenuCurrent, NO_SELECTED_ITEM, FALSE );
MENU_SelectPrevItem( hwnd, hmenuCurrent );
break;
@@ -1654,7 +1665,7 @@
else if (pos == (UINT)-1) MessageBeep(0);
else
{
- MENU_SelectItem( hwnd, hmenuCurrent, pos );
+ MENU_SelectItem( hwnd, hmenuCurrent, pos, TRUE );
fClosed = !MENU_ExecFocusedItem( hwnd, hmenuCurrent,
&hmenuCurrent );
@@ -1675,13 +1686,13 @@
}
USER_HEAP_FREE( hMsg );
ReleaseCapture();
- MENU_HideSubPopups( hwnd, hmenu );
+ MENU_HideSubPopups( hwnd, hmenu, FALSE );
if (menu->wFlags & MF_POPUP)
- {
+ {
ShowWindow( menu->hWnd, SW_HIDE );
uSubPWndLevel = 0;
- }
- MENU_SelectItem( hwnd, hmenu, NO_SELECTED_ITEM );
+ }
+ MENU_SelectItem( hwnd, hmenu, NO_SELECTED_ITEM, FALSE );
SendMessage( hwnd, WM_MENUSELECT, 0, MAKELONG( 0xffff, 0 ) );
fEndMenuCalled = FALSE;
return TRUE;
@@ -1693,7 +1704,7 @@
*
* Menu-bar tracking upon a mouse event. Called from NC_HandleSysCommand().
*/
-void MENU_TrackMouseMenuBar( HWND hwnd, POINT pt )
+void MENU_TrackMouseMenuBar( HWND hwnd, POINT16 pt )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
HideCaret(0);
@@ -1758,7 +1769,7 @@
}
}
- MENU_SelectItem( wndPtr->hwndSelf, hTrackMenu, uItem );
+ MENU_SelectItem( wndPtr->hwndSelf, hTrackMenu, uItem, TRUE );
if( uItem == NO_SELECTED_ITEM )
MENU_SelectNextItem( wndPtr->hwndSelf, hTrackMenu );
else
@@ -1773,22 +1784,33 @@
/**********************************************************************
- * TrackPopupMenu (USER.416)
+ * TrackPopupMenu16 (USER.416)
*/
-BOOL TrackPopupMenu( HMENU hMenu, UINT wFlags, short x, short y,
- short nReserved, HWND hWnd, LPRECT lpRect )
+BOOL16 TrackPopupMenu16( HMENU16 hMenu, UINT16 wFlags, INT16 x, INT16 y,
+ INT16 nReserved, HWND16 hWnd, const RECT16 *lpRect )
{
- BOOL ret;
+ BOOL ret = FALSE;
+
HideCaret(0);
- if (!MENU_ShowPopup( hWnd, hMenu, 0, x, y ))
- ret = FALSE;
- else
+ if (MENU_ShowPopup( hWnd, hMenu, 0, x, y ))
ret = MENU_TrackMenu( hMenu, wFlags, 0, 0, hWnd, lpRect );
ShowCaret(0);
return ret;
}
+/**********************************************************************
+ * TrackPopupMenu32 (USER32.548)
+ */
+BOOL32 TrackPopupMenu32( HMENU32 hMenu, UINT32 wFlags, INT32 x, INT32 y,
+ INT32 nReserved, HWND32 hWnd, const RECT32 *lpRect )
+{
+ RECT16 r;
+ CONV_RECT32TO16( lpRect, &r );
+ return TrackPopupMenu16( hMenu, wFlags, x, y, nReserved, hWnd, &r );
+}
+
+
/***********************************************************************
* PopupMenuWndProc
*/
@@ -1798,12 +1820,12 @@
{
case WM_CREATE:
{
- CREATESTRUCT *createStruct = (CREATESTRUCT*)PTR_SEG_TO_LIN(lParam);
+ CREATESTRUCT16 *cs = (CREATESTRUCT16*)PTR_SEG_TO_LIN(lParam);
#ifdef WINELIB32
- HMENU hmenu = (HMENU) (createStruct->lpCreateParams);
+ HMENU hmenu = (HMENU) (cs->lpCreateParams);
SetWindowLong( hwnd, 0, hmenu );
#else
- HMENU hmenu = (HMENU) ((int)createStruct->lpCreateParams & 0xffff);
+ HMENU hmenu = (HMENU) ((int)cs->lpCreateParams & 0xffff);
SetWindowWord( hwnd, 0, hmenu );
#endif
return 0;
@@ -1814,8 +1836,8 @@
case WM_PAINT:
{
- PAINTSTRUCT ps;
- BeginPaint( hwnd, &ps );
+ PAINTSTRUCT16 ps;
+ BeginPaint16( hwnd, &ps );
MENU_DrawPopupMenu( hwnd, ps.hdc,
#ifdef WINELIB32
(HMENU)GetWindowLong( hwnd, 0 )
@@ -1823,7 +1845,7 @@
(HMENU)GetWindowWord( hwnd, 0 )
#endif
);
- EndPaint( hwnd, &ps );
+ EndPaint16( hwnd, &ps );
return 0;
}
@@ -1861,7 +1883,7 @@
UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth, int orgX, int orgY )
{
HDC hdc;
- RECT rectBar;
+ RECT16 rectBar;
WND *wndPtr;
LPPOPUPMENU lppop;
@@ -1869,7 +1891,7 @@
if (!(lppop = (LPPOPUPMENU)USER_HEAP_LIN_ADDR((HMENU)wndPtr->wIDmenu)))
return 0;
hdc = GetDC( hwnd );
- SetRect( &rectBar, orgX, orgY, orgX+menubarWidth, orgY+SYSMETRICS_CYMENU );
+ SetRect16(&rectBar, orgX, orgY, orgX+menubarWidth, orgY+SYSMETRICS_CYMENU);
MENU_MenuBarCalcSize( hdc, &rectBar, lppop, hwnd );
ReleaseDC( hwnd, hdc );
return lppop->Height;
@@ -1984,8 +2006,8 @@
if (!(lpitem = MENU_FindItem( &hMenu, &wItemID, wHilite ))) return FALSE;
if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return FALSE;
if (menu->FocusedItem == wItemID) return TRUE;
- MENU_HideSubPopups( hWnd, hMenu );
- MENU_SelectItem( hWnd, hMenu, wItemID );
+ MENU_HideSubPopups( hWnd, hMenu, FALSE );
+ MENU_SelectItem( hWnd, hMenu, wItemID, TRUE );
return TRUE;
}
diff --git a/controls/scroll.c b/controls/scroll.c
index e0e7617..932f584 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -146,7 +146,7 @@
* 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, RECT *lprect,
+static BOOL SCROLL_GetScrollBarRect( HWND hwnd, int nBar, RECT16 *lprect,
WORD *arrowSize, WORD *thumbPos )
{
int pixels;
@@ -172,7 +172,7 @@
break;
case SB_CTL:
- GetClientRect( hwnd, lprect );
+ GetClientRect16( hwnd, lprect );
vertical = ((wndPtr->dwStyle & SBS_VERT) != 0);
break;
@@ -215,7 +215,7 @@
* Compute the current scroll position based on the thumb position in pixels
* from the top of the scroll-bar.
*/
-static UINT SCROLL_GetThumbVal( SCROLLINFO *infoPtr, RECT *rect,
+static UINT SCROLL_GetThumbVal( SCROLLINFO *infoPtr, RECT16 *rect,
BOOL vertical, WORD pos )
{
int pixels = vertical ? rect->bottom-rect->top : rect->right-rect->left;
@@ -237,14 +237,14 @@
*
* Scroll-bar hit testing (don't confuse this with WM_NCHITTEST!).
*/
-static enum SCROLL_HITTEST SCROLL_HitTest( HWND hwnd, int nBar, POINT pt )
+static enum SCROLL_HITTEST SCROLL_HitTest( HWND hwnd, int nBar, POINT16 pt )
{
WORD arrowSize, thumbPos;
- RECT rect;
+ RECT16 rect;
BOOL vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
&arrowSize, &thumbPos );
- if (!PtInRect( &rect, pt )) return SCROLL_NOWHERE;
+ if (!PtInRect16( &rect, pt )) return SCROLL_NOWHERE;
if (vertical)
{
@@ -274,7 +274,7 @@
*
* Draw the scroll bar arrows.
*/
-static void SCROLL_DrawArrows( HDC hdc, SCROLLINFO *infoPtr, RECT *rect,
+static void SCROLL_DrawArrows( HDC hdc, SCROLLINFO *infoPtr, RECT16 *rect,
WORD arrowSize, BOOL vertical,
BOOL top_pressed, BOOL bottom_pressed )
{
@@ -315,10 +315,10 @@
*
* Draw the moving thumb rectangle.
*/
-static void SCROLL_DrawMovingThumb( HDC hdc, RECT *rect, BOOL vertical,
+static void SCROLL_DrawMovingThumb( HDC hdc, RECT16 *rect, BOOL vertical,
WORD arrowSize, WORD thumbPos )
{
- RECT r = *rect;
+ RECT16 r = *rect;
if (vertical)
{
r.top += thumbPos;
@@ -335,8 +335,8 @@
r.left = rect->right - arrowSize - SYSMETRICS_CXVSCROLL - 1;
r.right = r.left + SYSMETRICS_CXVSCROLL + 1;
}
- InflateRect( &r, -1, -1 );
- DrawFocusRect( hdc, &r );
+ InflateRect16( &r, -1, -1 );
+ DrawFocusRect16( hdc, &r );
}
@@ -345,12 +345,12 @@
*
* Draw the scroll bar interior (everything except the arrows).
*/
-static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, int nBar, RECT *rect,
+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 )
{
- RECT r;
+ RECT16 r;
/* Select the correct brush and pen */
@@ -438,7 +438,7 @@
SelectObject( hdc, sysColorObjects.hbrushBtnFace );
Rectangle( hdc, r.left, r.top, r.right, r.bottom );
- InflateRect( &r, -1, -1 );
+ InflateRect16( &r, -1, -1 );
GRAPH_DrawReliefRect( hdc, &r, 1, 2, FALSE );
if ((hwndTracking == hwnd) && (nBarTracking == nBar))
SCROLL_DrawMovingThumb( hdc, rect, vertical, arrowSize, uTrackingPos);
@@ -453,7 +453,7 @@
void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, int nBar )
{
WORD arrowSize, thumbPos;
- RECT rect;
+ RECT16 rect;
BOOL vertical;
WND *wndPtr = WIN_FindWndPtr( hwnd );
SCROLLINFO *infoPtr = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
@@ -483,7 +483,7 @@
static void SCROLL_RefreshScrollBar( HWND hwnd, int nBar )
{
WORD arrowSize, thumbPos;
- RECT rect;
+ RECT16 rect;
BOOL vertical;
HDC hdc;
WND *wndPtr = WIN_FindWndPtr( hwnd );
@@ -543,10 +543,10 @@
* '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, POINT pt )
+void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT16 pt )
{
/* Previous mouse position for timer events */
- static POINT prevPt;
+ static POINT16 prevPt;
/* Hit test code of the last button-down event */
static enum SCROLL_HITTEST trackHitTest;
/* Thumb position when tracking started. */
@@ -560,7 +560,7 @@
HWND hwndOwner, hwndCtl;
BOOL vertical;
WORD arrowSize, thumbPos;
- RECT rect;
+ RECT16 rect;
HDC hdc;
SCROLLINFO *infoPtr = SCROLL_GetScrollInfo( hwnd, nBar );
@@ -675,7 +675,7 @@
{
UINT pos, val;
- if (!PtInRect( &rect, pt )) pos = lastClickPos;
+ if (!PtInRect16( &rect, pt )) pos = lastClickPos;
else pos = vertical ? (pt.y - rect.top) : (pt.x - rect.left);
if (pos != lastMousePos)
{
@@ -779,15 +779,11 @@
*/
LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
{
- POINT Pt;
- Pt.x = LOWORD(lParam); Pt.y = HIWORD(lParam);
- /* ^ Can't use MAKEPOINT macro in WINELIB32 */
-
switch(message)
{
case WM_CREATE:
{
- CREATESTRUCT *lpCreat = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam);
+ CREATESTRUCT16 *lpCreat = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
if (lpCreat->style & SBS_SIZEBOX)
{
fprintf( stdnimp, "Unimplemented style SBS_SIZEBOX.\n" );
@@ -825,7 +821,7 @@
case WM_LBUTTONUP:
case WM_MOUSEMOVE:
case WM_SYSTIMER:
- SCROLL_HandleScrollEvent( hwnd, SB_CTL, message, Pt );
+ SCROLL_HandleScrollEvent( hwnd, SB_CTL, message, MAKEPOINT16(lParam) );
break;
case WM_KEYDOWN:
@@ -840,10 +836,10 @@
case WM_PAINT:
{
- PAINTSTRUCT ps;
- HDC hdc = BeginPaint( hwnd, &ps );
+ PAINTSTRUCT16 ps;
+ HDC16 hdc = BeginPaint16( hwnd, &ps );
SCROLL_DrawScrollBar( hwnd, hdc, SB_CTL );
- EndPaint( hwnd, &ps );
+ EndPaint16( hwnd, &ps );
}
break;
diff --git a/controls/static.c b/controls/static.c
index 9b88116..7af526f 100644
--- a/controls/static.c
+++ b/controls/static.c
@@ -79,19 +79,18 @@
switch (uMsg) {
case WM_ENABLE:
- InvalidateRect(hWnd, NULL, FALSE);
+ InvalidateRect32( hWnd, NULL, FALSE );
break;
case WM_NCCREATE:
if (style == SS_ICON)
{
- CREATESTRUCT * createStruct = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam);
- if (createStruct->lpszName)
+ CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
+ if (cs->lpszName)
{
- HICON hicon = LoadIcon( createStruct->hInstance,
- createStruct->lpszName );
+ HICON hicon = LoadIcon( cs->hInstance, cs->lpszName );
if (!hicon) /* Try OEM icon (FIXME: is this right?) */
- hicon = LoadIcon( 0, createStruct->lpszName );
+ hicon = LoadIcon( 0, cs->lpszName );
STATIC_SetIcon( wndPtr, hicon );
}
return 1;
@@ -120,11 +119,11 @@
case WM_PAINT:
{
- PAINTSTRUCT ps;
- BeginPaint( hWnd, &ps );
+ PAINTSTRUCT16 ps;
+ BeginPaint16( hWnd, &ps );
if (staticPaintFunc[style])
(staticPaintFunc[style])( wndPtr, ps.hdc );
- EndPaint( hWnd, &ps );
+ EndPaint16( hWnd, &ps );
}
break;
@@ -132,7 +131,7 @@
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
color_background = GetSysColor(COLOR_BACKGROUND);
color_window = GetSysColor(COLOR_WINDOW);
- InvalidateRect(hWnd, NULL, TRUE);
+ InvalidateRect32( hWnd, NULL, TRUE );
break;
case WM_SETTEXT:
@@ -142,7 +141,7 @@
(SEGPTR)lParam ));
else
DEFWND_SetText( wndPtr, (LPSTR)PTR_SEG_TO_LIN(lParam) );
- InvalidateRect( hWnd, NULL, FALSE );
+ InvalidateRect32( hWnd, NULL, FALSE );
UpdateWindow( hWnd );
break;
@@ -151,7 +150,7 @@
infoPtr->hFont = (HFONT)wParam;
if (LOWORD(lParam))
{
- InvalidateRect( hWnd, NULL, FALSE );
+ InvalidateRect32( hWnd, NULL, FALSE );
UpdateWindow( hWnd );
}
break;
@@ -170,7 +169,7 @@
case STM_SETICON:
lResult = STATIC_SetIcon( wndPtr, (HICON)wParam );
- InvalidateRect( hWnd, NULL, FALSE );
+ InvalidateRect32( hWnd, NULL, FALSE );
UpdateWindow( hWnd );
break;
@@ -185,7 +184,7 @@
static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc )
{
- RECT rc;
+ RECT16 rc;
HBRUSH hBrush;
char *text;
WORD wFormat;
@@ -193,7 +192,7 @@
LONG style = wndPtr->dwStyle;
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
- GetClientRect( wndPtr->hwndSelf, &rc);
+ GetClientRect16( wndPtr->hwndSelf, &rc);
text = USER_HEAP_LIN_ADDR( wndPtr->hText );
switch (style & 0x0000000F)
@@ -234,42 +233,42 @@
MAKELONG(wndPtr->hwndSelf, CTLCOLOR_STATIC));
#endif
if (!hBrush) hBrush = GetStockObject(WHITE_BRUSH);
- FillRect(hdc, &rc, hBrush);
- if (text) DrawText( hdc, text, -1, &rc, wFormat );
+ FillRect16(hdc, &rc, hBrush);
+ if (text) DrawText16( hdc, text, -1, &rc, wFormat );
}
static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc )
{
- RECT rc;
+ RECT16 rc;
HBRUSH hBrush;
- GetClientRect( wndPtr->hwndSelf, &rc);
+ GetClientRect16( wndPtr->hwndSelf, &rc);
switch (wndPtr->dwStyle & 0x0f)
{
case SS_BLACKRECT:
hBrush = CreateSolidBrush(color_windowframe);
- FillRect( hdc, &rc, hBrush );
+ FillRect16( hdc, &rc, hBrush );
break;
case SS_GRAYRECT:
hBrush = CreateSolidBrush(color_background);
- FillRect( hdc, &rc, hBrush );
+ FillRect16( hdc, &rc, hBrush );
break;
case SS_WHITERECT:
hBrush = CreateSolidBrush(color_window);
- FillRect( hdc, &rc, hBrush );
+ FillRect16( hdc, &rc, hBrush );
break;
case SS_BLACKFRAME:
hBrush = CreateSolidBrush(color_windowframe);
- FrameRect( hdc, &rc, hBrush );
+ FrameRect16( hdc, &rc, hBrush );
break;
case SS_GRAYFRAME:
hBrush = CreateSolidBrush(color_background);
- FrameRect( hdc, &rc, hBrush );
+ FrameRect16( hdc, &rc, hBrush );
break;
case SS_WHITEFRAME:
hBrush = CreateSolidBrush(color_window);
- FrameRect( hdc, &rc, hBrush );
+ FrameRect16( hdc, &rc, hBrush );
break;
default:
return;
@@ -280,11 +279,11 @@
static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc )
{
- RECT rc;
+ RECT16 rc;
HBRUSH hbrush;
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
- GetClientRect( wndPtr->hwndSelf, &rc);
+ GetClientRect16( wndPtr->hwndSelf, &rc);
#ifdef WINELIB32
hbrush = SendMessage( GetParent(wndPtr->hwndSelf), WM_CTLCOLORSTATIC,
hdc, wndPtr->hwndSelf );
@@ -292,6 +291,6 @@
hbrush = SendMessage( GetParent(wndPtr->hwndSelf), WM_CTLCOLOR, hdc,
MAKELONG(wndPtr->hwndSelf, CTLCOLOR_STATIC));
#endif
- FillRect( hdc, &rc, hbrush );
+ FillRect16( hdc, &rc, hbrush );
if (infoPtr->hIcon) DrawIcon( hdc, rc.left, rc.top, infoPtr->hIcon );
}
diff --git a/controls/widgets.c b/controls/widgets.c
index 1f737bc..dc5a441 100644
--- a/controls/widgets.c
+++ b/controls/widgets.c
@@ -13,38 +13,38 @@
#include "gdi.h"
#include "user.h"
#include "module.h"
-#include "stackframe.h"
+#include "heap.h"
static WNDCLASS16 WIDGETS_BuiltinClasses[] =
{
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
- (WNDPROC)"ButtonWndProc", 0, sizeof(BUTTONINFO),
+ (WNDPROC16)"ButtonWndProc", 0, sizeof(BUTTONINFO),
0, 0, 0, 0, 0, (SEGPTR)"BUTTON" },
{ CS_GLOBALCLASS | CS_PARENTDC,
- (WNDPROC)"StaticWndProc", 0, sizeof(STATICINFO),
+ (WNDPROC16)"StaticWndProc", 0, sizeof(STATICINFO),
0, 0, 0, 0, 0, (SEGPTR)"STATIC" },
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
- (WNDPROC)"ScrollBarWndProc", 0, sizeof(SCROLLINFO),
+ (WNDPROC16)"ScrollBarWndProc", 0, sizeof(SCROLLINFO),
0, 0, 0, 0, 0, (SEGPTR)"SCROLLBAR" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
- (WNDPROC)"ListBoxWndProc", 0, 8,
+ (WNDPROC16)"ListBoxWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)"LISTBOX" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
- (WNDPROC)"ComboBoxWndProc", 0, 8,
+ (WNDPROC16)"ComboBoxWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)"COMBOBOX" },
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS,
- (WNDPROC)"ComboLBoxWndProc", 0, 8,
+ (WNDPROC16)"ComboLBoxWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)"COMBOLBOX" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
- (WNDPROC)"EditWndProc", 0, sizeof(DWORD),
+ (WNDPROC16)"EditWndProc", 0, sizeof(DWORD),
0, 0, 0, 0, 0, (SEGPTR)"EDIT" },
- { CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC)"PopupMenuWndProc", 0, 8,
+ { CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC16)"PopupMenuWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)POPUPMENU_CLASS_NAME },
- { CS_GLOBALCLASS, (WNDPROC)"DesktopWndProc", 0, sizeof(DESKTOPINFO),
+ { CS_GLOBALCLASS, (WNDPROC16)"DesktopWndProc", 0, sizeof(DESKTOPINFO),
0, 0, 0, 0, 0, (SEGPTR)DESKTOP_CLASS_NAME },
- { CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC)"DefDlgProc", 0, DLGWINDOWEXTRA,
+ { CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC16)"DefDlgProc", 0, DLGWINDOWEXTRA,
0, 0, 0, 0, 0, (SEGPTR)DIALOG_CLASS_NAME },
- { CS_GLOBALCLASS, (WNDPROC)"MDIClientWndProc", 0, sizeof(MDICLIENTINFO),
+ { CS_GLOBALCLASS, (WNDPROC16)"MDIClientWndProc", 0, sizeof(MDICLIENTINFO),
0, 0, 0, STOCK_LTGRAY_BRUSH, 0, (SEGPTR)"MDICLIENT" }
};
@@ -60,16 +60,18 @@
BOOL WIDGETS_Init(void)
{
int i;
- char name[20];
+ char *name;
WNDCLASS16 *class = WIDGETS_BuiltinClasses;
+ if (!(name = SEGPTR_ALLOC( 20 * sizeof(char) ))) return FALSE;
for (i = 0; i < NB_BUILTIN_CLASSES; i++, class++)
{
strcpy( name, (char *)class->lpszClassName );
- class->lpszClassName = MAKE_SEGPTR(name);
+ class->lpszClassName = SEGPTR_GET(name);
class->hCursor = LoadCursor( 0, IDC_ARROW );
class->lpfnWndProc = MODULE_GetWndProcEntry16( (char *)class->lpfnWndProc );
if (!RegisterClass16( class )) return FALSE;
}
+ SEGPTR_FREE(name);
return TRUE;
}