mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 22:05:49 +00:00
Removed old wine code
svn path=/trunk/; revision=1963
This commit is contained in:
parent
b0f6cfbe69
commit
bc8b4c3210
48 changed files with 58 additions and 31851 deletions
|
@ -1,598 +0,0 @@
|
|||
/* File: button.c -- Button type widgets
|
||||
*
|
||||
* Copyright (C) 1993 Johannes Ruscheinski
|
||||
* Copyright (C) 1993 David Metcalfe
|
||||
* Copyright (C) 1994 Alexandre Julliard
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/button.h>
|
||||
#include <user32/paint.h>
|
||||
#include <user32/nc.h>
|
||||
#include <user32/syscolor.h>
|
||||
#include <user32/defwnd.h>
|
||||
|
||||
|
||||
static void PB_Paint( WND *wndPtr, HDC hDC, WORD action );
|
||||
static void PB_PaintGrayOnGray(HDC hDC,HFONT hFont,RECT *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 BUTTON_CheckAutoRadioButton( WND *wndPtr );
|
||||
|
||||
#define MAX_BTN_TYPE 12
|
||||
|
||||
static const WORD maxCheckState[MAX_BTN_TYPE] =
|
||||
{
|
||||
BUTTON_UNCHECKED, /* BS_PUSHBUTTON */
|
||||
BUTTON_UNCHECKED, /* BS_DEFPUSHBUTTON */
|
||||
BUTTON_CHECKED, /* BS_CHECKBOX */
|
||||
BUTTON_CHECKED, /* BS_AUTOCHECKBOX */
|
||||
BUTTON_CHECKED, /* BS_RADIOBUTTON */
|
||||
BUTTON_3STATE, /* BS_3STATE */
|
||||
BUTTON_3STATE, /* BS_AUTO3STATE */
|
||||
BUTTON_UNCHECKED, /* BS_GROUPBOX */
|
||||
BUTTON_UNCHECKED, /* BS_USERBUTTON */
|
||||
BUTTON_CHECKED, /* BS_AUTORADIOBUTTON */
|
||||
BUTTON_UNCHECKED, /* Not defined */
|
||||
BUTTON_UNCHECKED /* BS_OWNERDRAW */
|
||||
};
|
||||
|
||||
typedef void (*pfPaint)( WND *wndPtr, HDC hdc, WORD action );
|
||||
|
||||
static const pfPaint btnPaintFunc[MAX_BTN_TYPE] =
|
||||
{
|
||||
PB_Paint, /* BS_PUSHBUTTON */
|
||||
PB_Paint, /* BS_DEFPUSHBUTTON */
|
||||
CB_Paint, /* BS_CHECKBOX */
|
||||
CB_Paint, /* BS_AUTOCHECKBOX */
|
||||
CB_Paint, /* BS_RADIOBUTTON */
|
||||
CB_Paint, /* BS_3STATE */
|
||||
CB_Paint, /* BS_AUTO3STATE */
|
||||
GB_Paint, /* BS_GROUPBOX */
|
||||
UB_Paint, /* BS_USERBUTTON */
|
||||
CB_Paint, /* BS_AUTORADIOBUTTON */
|
||||
NULL, /* Not defined */
|
||||
OB_Paint /* BS_OWNERDRAW */
|
||||
};
|
||||
|
||||
#define PAINT_BUTTON(wndPtr,style,action) \
|
||||
if (btnPaintFunc[style]) { \
|
||||
HDC hdc = GetDC( (wndPtr)->hwndSelf ); \
|
||||
(btnPaintFunc[style])(wndPtr,hdc,action); \
|
||||
ReleaseDC( (wndPtr)->hwndSelf, hdc ); }
|
||||
|
||||
#define BUTTON_SEND_CTLCOLOR(wndPtr,hdc) \
|
||||
SendMessageA( GetParent((wndPtr)->hwndSelf), WM_CTLCOLORBTN, \
|
||||
(WPARAM)(hdc), (LPARAM)(wndPtr)->hwndSelf )
|
||||
|
||||
static HBITMAP hbitmapCheckBoxes = 0;
|
||||
static WORD checkBoxWidth = 0, checkBoxHeight = 0;
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* ButtonWndProc
|
||||
*/
|
||||
LRESULT WINAPI ButtonWndProc( HWND hWnd, UINT uMsg,
|
||||
WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
RECT rect;
|
||||
POINT pt = { LOWORD(lParam), HIWORD(lParam) };
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
|
||||
LONG style = wndPtr->dwStyle & 0x0f;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_GETDLGCODE:
|
||||
switch(style)
|
||||
{
|
||||
case BS_PUSHBUTTON: return DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON;
|
||||
case BS_DEFPUSHBUTTON: return DLGC_BUTTON | DLGC_DEFPUSHBUTTON;
|
||||
case BS_RADIOBUTTON:
|
||||
case BS_AUTORADIOBUTTON: return DLGC_BUTTON | DLGC_RADIOBUTTON;
|
||||
default: return DLGC_BUTTON;
|
||||
}
|
||||
|
||||
case WM_ENABLE:
|
||||
PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
|
||||
break;
|
||||
|
||||
case WM_CREATE:
|
||||
if (!hbitmapCheckBoxes)
|
||||
{
|
||||
BITMAP bmp;
|
||||
hbitmapCheckBoxes = LoadBitmapA(0, MAKEINTRESOURCEA(OBM_CHECKBOXES));
|
||||
GetObjectA( hbitmapCheckBoxes, sizeof(bmp), &bmp );
|
||||
checkBoxWidth = bmp.bmWidth / 4;
|
||||
checkBoxHeight = bmp.bmHeight / 3;
|
||||
}
|
||||
if (style < 0L || style >= MAX_BTN_TYPE) return -1; /* abort */
|
||||
infoPtr->state = BUTTON_UNCHECKED;
|
||||
infoPtr->hFont = 0;
|
||||
return 0;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
return 1;
|
||||
|
||||
case WM_PAINT:
|
||||
if (btnPaintFunc[style])
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc = wParam ? (HDC)wParam : BeginPaint( hWnd, &ps );
|
||||
SetBkMode( hdc, OPAQUE );
|
||||
(btnPaintFunc[style])( wndPtr, hdc, ODA_DRAWENTIRE );
|
||||
if( !wParam ) EndPaint( hWnd, &ps );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_LBUTTONDBLCLK:
|
||||
SendMessageA( hWnd, BM_SETSTATE, TRUE, 0 );
|
||||
SetFocus( hWnd );
|
||||
SetCapture( hWnd );
|
||||
break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
ReleaseCapture();
|
||||
if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) break;
|
||||
SendMessageA( hWnd, BM_SETSTATE, FALSE, 0 );
|
||||
GetClientRect( hWnd, &rect );
|
||||
if (PtInRect( &rect, pt ))
|
||||
{
|
||||
switch(style)
|
||||
{
|
||||
case BS_AUTOCHECKBOX:
|
||||
SendMessageA( hWnd, BM_SETCHECK,
|
||||
!(infoPtr->state & BUTTON_CHECKED), 0 );
|
||||
break;
|
||||
case BS_AUTORADIOBUTTON:
|
||||
SendMessageA( hWnd, BM_SETCHECK, TRUE, 0 );
|
||||
break;
|
||||
case BS_AUTO3STATE:
|
||||
SendMessageA( hWnd, BM_SETCHECK,
|
||||
(infoPtr->state & BUTTON_3STATE) ? 0 :
|
||||
((infoPtr->state & 3) + 1), 0 );
|
||||
break;
|
||||
}
|
||||
SendMessageA( GetParent(hWnd), WM_COMMAND,
|
||||
MAKEWPARAM( wndPtr->wIDmenu, BN_CLICKED ), (LPARAM)hWnd);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
if (GetCapture() == hWnd)
|
||||
{
|
||||
GetClientRect( hWnd, &rect );
|
||||
SendMessageA( hWnd, BM_SETSTATE, PtInRect(&rect, pt), 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NCHITTEST:
|
||||
if(style == BS_GROUPBOX) return HTTRANSPARENT;
|
||||
return DefWindowProcA( hWnd, uMsg, wParam, lParam );
|
||||
|
||||
case WM_SETTEXT:
|
||||
DEFWND_SetTextA( wndPtr, (LPCSTR)lParam );
|
||||
if( wndPtr->dwStyle & WS_VISIBLE )
|
||||
PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
|
||||
return 0;
|
||||
|
||||
case WM_SETFONT:
|
||||
infoPtr->hFont = (HFONT)wParam;
|
||||
if (lParam && (wndPtr->dwStyle & WS_VISIBLE))
|
||||
PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
|
||||
break;
|
||||
|
||||
case WM_GETFONT:
|
||||
return (LRESULT)infoPtr->hFont;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
infoPtr->state |= BUTTON_HASFOCUS;
|
||||
if (style == BS_AUTORADIOBUTTON)
|
||||
{
|
||||
SendMessageA( hWnd, BM_SETCHECK, 1, 0 );
|
||||
}
|
||||
PAINT_BUTTON( wndPtr, style, ODA_FOCUS );
|
||||
break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
infoPtr->state &= ~BUTTON_HASFOCUS;
|
||||
PAINT_BUTTON( wndPtr, style, ODA_FOCUS );
|
||||
InvalidateRect( hWnd, NULL, TRUE );
|
||||
break;
|
||||
|
||||
case WM_SYSCOLORCHANGE:
|
||||
InvalidateRect( hWnd, NULL, FALSE );
|
||||
break;
|
||||
|
||||
case BM_SETSTYLE:
|
||||
if ((wParam & 0x0f) >= MAX_BTN_TYPE) break;
|
||||
wndPtr->dwStyle = (wndPtr->dwStyle & 0xfffffff0)
|
||||
| (wParam & 0x0000000f);
|
||||
style = wndPtr->dwStyle & 0x0000000f;
|
||||
PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE );
|
||||
break;
|
||||
|
||||
case BM_GETCHECK:
|
||||
return infoPtr->state & 3;
|
||||
|
||||
case BM_SETCHECK:
|
||||
if (wParam > maxCheckState[style]) wParam = maxCheckState[style];
|
||||
if ((infoPtr->state & 3) != wParam)
|
||||
{
|
||||
if ((style == BS_RADIOBUTTON) || (style == BS_AUTORADIOBUTTON))
|
||||
{
|
||||
if (wParam)
|
||||
wndPtr->dwStyle |= WS_TABSTOP;
|
||||
else
|
||||
wndPtr->dwStyle &= ~WS_TABSTOP;
|
||||
}
|
||||
infoPtr->state = (infoPtr->state & ~3) | wParam;
|
||||
PAINT_BUTTON( wndPtr, style, ODA_SELECT );
|
||||
}
|
||||
if ((style == BS_AUTORADIOBUTTON) && (wParam == BUTTON_CHECKED))
|
||||
BUTTON_CheckAutoRadioButton( wndPtr );
|
||||
break;
|
||||
|
||||
case BM_GETSTATE:
|
||||
return infoPtr->state;
|
||||
|
||||
case BM_SETSTATE:
|
||||
if (wParam)
|
||||
{
|
||||
if (infoPtr->state & BUTTON_HIGHLIGHTED) break;
|
||||
infoPtr->state |= BUTTON_HIGHLIGHTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) break;
|
||||
infoPtr->state &= ~BUTTON_HIGHLIGHTED;
|
||||
}
|
||||
PAINT_BUTTON( wndPtr, style, ODA_SELECT );
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Push Button Functions
|
||||
*/
|
||||
|
||||
static void PB_Paint( WND *wndPtr, HDC hDC, WORD action )
|
||||
{
|
||||
RECT rc;
|
||||
HPEN hOldPen;
|
||||
HBRUSH hOldBrush;
|
||||
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
|
||||
|
||||
GetClientRect( 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, GetSysColorPen(COLOR_WINDOWFRAME));
|
||||
hOldBrush =(HBRUSH)SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE));
|
||||
SetBkMode(hDC, TRANSPARENT);
|
||||
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
|
||||
if (action == ODA_DRAWENTIRE)
|
||||
{
|
||||
SetPixel( hDC, rc.left, rc.top, GetSysColor(COLOR_WINDOW) );
|
||||
SetPixel( hDC, rc.left, rc.bottom-1, GetSysColor(COLOR_WINDOW) );
|
||||
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 );
|
||||
|
||||
if ((wndPtr->dwStyle & 0x000f) == BS_DEFPUSHBUTTON)
|
||||
{
|
||||
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
|
||||
InflateRect( &rc, -1, -1 );
|
||||
}
|
||||
|
||||
if (infoPtr->state & BUTTON_HIGHLIGHTED)
|
||||
{
|
||||
/* draw button shadow: */
|
||||
SelectObject(hDC, GetSysColorBrush(COLOR_BTNSHADOW));
|
||||
PatBlt(hDC, rc.left, rc.top, 1, rc.bottom-rc.top, PATCOPY );
|
||||
PatBlt(hDC, rc.left, rc.top, rc.right-rc.left, 1, PATCOPY );
|
||||
rc.left += 2; /* To position the text down and right */
|
||||
rc.top += 2;
|
||||
} else {
|
||||
rc.right++, rc.bottom++;
|
||||
DrawEdge( hDC, &rc, EDGE_RAISED, BF_RECT );
|
||||
rc.right--, rc.bottom--;
|
||||
}
|
||||
|
||||
/* draw button label, if any: */
|
||||
// && wndPtr->text[0]
|
||||
if (wndPtr->text )
|
||||
{
|
||||
LOGBRUSH lb;
|
||||
GetObject( GetSysColorBrush(COLOR_BTNFACE), 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) );
|
||||
DrawTextA( hDC, wndPtr->text, -1, &rc,
|
||||
DT_SINGLELINE | DT_CENTER | DT_VCENTER );
|
||||
/* do we have the focus? */
|
||||
if (infoPtr->state & BUTTON_HASFOCUS)
|
||||
{
|
||||
RECT r = { 0, 0, 0, 0 };
|
||||
INT xdelta, ydelta;
|
||||
|
||||
DrawTextA( 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;
|
||||
InflateRect( &rc, -xdelta, -ydelta );
|
||||
DrawFocusRect( hDC, &rc );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SelectObject( hDC, hOldPen );
|
||||
SelectObject( hDC, hOldBrush );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Push Button sub function [internal]
|
||||
* using a raster brush to avoid gray text on gray background
|
||||
*/
|
||||
|
||||
void PB_PaintGrayOnGray(HDC hDC,HFONT hFont,RECT *rc,char *text)
|
||||
{
|
||||
static const 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;
|
||||
RECT rect,rc2;
|
||||
|
||||
rect=*rc;
|
||||
DrawTextA( 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;
|
||||
hbmMem = CreateCompatibleBitmap( hDC,rect.right,rect.bottom );
|
||||
SelectObject( hdcMem, hbmMem);
|
||||
hBr = SelectObject( hdcMem, CreatePatternBrush(hbm) );
|
||||
DeleteObject( hbm );
|
||||
PatBlt( hdcMem,0,0,rect.right,rect.bottom,WHITENESS);
|
||||
if (hFont) SelectObject( hdcMem, hFont);
|
||||
DrawTextA( 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);
|
||||
DeleteDC( hdcMem);
|
||||
DeleteObject( hbmMem );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Check Box & Radio Button Functions
|
||||
*/
|
||||
|
||||
static void CB_Paint( WND *wndPtr, HDC hDC, WORD action )
|
||||
{
|
||||
RECT rbox, rtext, client;
|
||||
HBRUSH hBrush;
|
||||
int textlen, delta;
|
||||
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
|
||||
|
||||
textlen = 0;
|
||||
GetClientRect(wndPtr->hwndSelf, &client);
|
||||
rbox = rtext = client;
|
||||
|
||||
if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
|
||||
|
||||
/* Something is still not right, checkboxes (and edit controls)
|
||||
* in wsping have white backgrounds instead of dark grey.
|
||||
* BUTTON_SEND_CTLCOLOR() is even worse since it returns 0 in this
|
||||
* particular case and the background is not painted at all.
|
||||
*/
|
||||
|
||||
hBrush = GetControlBrush( wndPtr->hwndSelf, hDC, CTLCOLOR_BTN );
|
||||
|
||||
if (wndPtr->dwStyle & BS_LEFTTEXT)
|
||||
{
|
||||
/* magic +4 is what CTL3D expects */
|
||||
|
||||
rtext.right -= checkBoxWidth + 4;
|
||||
rbox.left = rbox.right - checkBoxWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
rtext.left += checkBoxWidth + 4;
|
||||
rbox.right = checkBoxWidth;
|
||||
}
|
||||
|
||||
/* Draw the check-box bitmap */
|
||||
|
||||
|
||||
if (wndPtr->text) {
|
||||
textlen = lstrlenA( wndPtr->text );
|
||||
}
|
||||
if (action == ODA_DRAWENTIRE || action == ODA_SELECT)
|
||||
{
|
||||
HDC hMemDC = CreateCompatibleDC( hDC );
|
||||
int x = 0, y = 0;
|
||||
delta = (rbox.bottom - rbox.top - checkBoxHeight) >> 1;
|
||||
|
||||
if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush );
|
||||
else FillRect( hDC, &client, hBrush );
|
||||
|
||||
if (infoPtr->state & BUTTON_HIGHLIGHTED) x += 2 * checkBoxWidth;
|
||||
if (infoPtr->state & (BUTTON_CHECKED | BUTTON_3STATE)) x += checkBoxWidth;
|
||||
if (((wndPtr->dwStyle & 0x0f) == BS_RADIOBUTTON) ||
|
||||
((wndPtr->dwStyle & 0x0f) == BS_AUTORADIOBUTTON)) y += checkBoxHeight;
|
||||
else if (infoPtr->state & BUTTON_3STATE) y += 2 * checkBoxHeight;
|
||||
|
||||
SelectObject( hMemDC, hbitmapCheckBoxes );
|
||||
BitBlt( hDC, rbox.left, rbox.top + delta, checkBoxWidth,
|
||||
checkBoxHeight, hMemDC, x, y, SRCCOPY );
|
||||
DeleteDC( hMemDC );
|
||||
|
||||
if( textlen && action != ODA_SELECT )
|
||||
{
|
||||
if (wndPtr->dwStyle & WS_DISABLED)
|
||||
SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) );
|
||||
DrawTextA( hDC, wndPtr->text, textlen, &rtext,
|
||||
DT_SINGLELINE | DT_VCENTER );
|
||||
textlen = 0; /* skip DrawText() below */
|
||||
}
|
||||
}
|
||||
|
||||
if ((action == ODA_FOCUS) ||
|
||||
((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS)))
|
||||
{
|
||||
/* again, this is what CTL3D expects */
|
||||
|
||||
SetRectEmpty(&rbox);
|
||||
if( textlen )
|
||||
DrawTextA( hDC, wndPtr->text, textlen, &rbox,
|
||||
DT_SINGLELINE | DT_CALCRECT );
|
||||
textlen = rbox.bottom - rbox.top;
|
||||
delta = ((rtext.bottom - rtext.top) - textlen)/2;
|
||||
rbox.bottom = (rbox.top = rtext.top + delta - 1) + textlen + 2;
|
||||
textlen = rbox.right - rbox.left;
|
||||
rbox.right = (rbox.left += --rtext.left) + textlen + 2;
|
||||
IntersectRect(&rbox, &rbox, &rtext);
|
||||
DrawFocusRect( hDC, &rbox );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* BUTTON_CheckAutoRadioButton
|
||||
*
|
||||
* wndPtr is checked, uncheck every other auto radio button in group
|
||||
*/
|
||||
static void BUTTON_CheckAutoRadioButton( WND *wndPtr )
|
||||
{
|
||||
HWND parent, sibling, start;
|
||||
WND *sibPtr;
|
||||
if (!(wndPtr->dwStyle & WS_CHILD)) return;
|
||||
parent = wndPtr->parent->hwndSelf;
|
||||
/* assure that starting control is not disabled or invisible */
|
||||
start = sibling = GetNextDlgGroupItem( parent, wndPtr->hwndSelf, TRUE );
|
||||
do
|
||||
{
|
||||
|
||||
if (!sibling) break;
|
||||
sibPtr = WIN_FindWndPtr(sibling);
|
||||
if (!sibPtr) break;
|
||||
if ((wndPtr->hwndSelf != sibling) &&
|
||||
((sibPtr->dwStyle & 0x0f) == BS_AUTORADIOBUTTON))
|
||||
SendMessageA( sibling, BM_SETCHECK, BUTTON_UNCHECKED, 0 );
|
||||
sibling = GetNextDlgGroupItem( parent, sibling, FALSE );
|
||||
} while (sibling != start);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Group Box Functions
|
||||
*/
|
||||
|
||||
static void GB_Paint( WND *wndPtr, HDC hDC, WORD action )
|
||||
{
|
||||
RECT rc, rcFrame;
|
||||
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
|
||||
|
||||
if (action != ODA_DRAWENTIRE) return;
|
||||
|
||||
BUTTON_SEND_CTLCOLOR( wndPtr, hDC );
|
||||
|
||||
GetClientRect( wndPtr->hwndSelf, &rc);
|
||||
if (TWEAK_WineLook == WIN31_LOOK) {
|
||||
HPEN hPrevPen = SelectObject( hDC,
|
||||
GetSysColorPen(COLOR_WINDOWFRAME));
|
||||
HBRUSH hPrevBrush = SelectObject( hDC,
|
||||
GetStockObject(NULL_BRUSH) );
|
||||
|
||||
Rectangle( hDC, rc.left, rc.top + 2, rc.right - 1, rc.bottom - 1 );
|
||||
SelectObject( hDC, hPrevBrush );
|
||||
SelectObject( hDC, hPrevPen );
|
||||
} else {
|
||||
TEXTMETRIC tm;
|
||||
rcFrame = rc;
|
||||
|
||||
if (infoPtr->hFont)
|
||||
SelectObject (hDC, infoPtr->hFont);
|
||||
GetTextMetricsA (hDC, &tm);
|
||||
rcFrame.top += (tm.tmHeight / 2) - 1;
|
||||
DrawEdge (hDC, &rcFrame, EDGE_ETCHED, BF_RECT);
|
||||
}
|
||||
|
||||
if (wndPtr->text)
|
||||
{
|
||||
if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
|
||||
if (wndPtr->dwStyle & WS_DISABLED)
|
||||
SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) );
|
||||
rc.left += 10;
|
||||
DrawTextA( hDC, wndPtr->text, -1, &rc, DT_SINGLELINE | DT_NOCLIP );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* User Button Functions
|
||||
*/
|
||||
|
||||
static void UB_Paint( WND *wndPtr, HDC hDC, WORD action )
|
||||
{
|
||||
RECT rc;
|
||||
HBRUSH hBrush;
|
||||
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
|
||||
|
||||
if (action == ODA_SELECT) return;
|
||||
|
||||
GetClientRect( wndPtr->hwndSelf, &rc);
|
||||
|
||||
if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
|
||||
hBrush = GetControlBrush( wndPtr->hwndSelf, hDC, CTLCOLOR_BTN );
|
||||
|
||||
FillRect( hDC, &rc, hBrush );
|
||||
if ((action == ODA_FOCUS) ||
|
||||
((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS)))
|
||||
DrawFocusRect( hDC, &rc );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Ownerdrawn Button Functions
|
||||
*/
|
||||
|
||||
static void OB_Paint( WND *wndPtr, HDC hDC, WORD action )
|
||||
{
|
||||
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
|
||||
DRAWITEMSTRUCT dis;
|
||||
|
||||
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;
|
||||
dis.itemData = 0;
|
||||
GetClientRect( wndPtr->hwndSelf, &dis.rcItem );
|
||||
SendMessageA( GetParent(wndPtr->hwndSelf), WM_DRAWITEM,
|
||||
wndPtr->wIDmenu, (LPARAM)&dis );
|
||||
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,250 +0,0 @@
|
|||
/*
|
||||
* Icontitle window class.
|
||||
*
|
||||
* Copyright 1997 Alex Korobka
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/paint.h>
|
||||
#include <user32/sysmetr.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/heapdup.h>
|
||||
#include <user32/widgets.h>
|
||||
|
||||
#define WM_ISACTIVEICON 0x0035
|
||||
|
||||
static LPCSTR emptyTitleText = "<...>";
|
||||
|
||||
WINBOOL bMultiLineTitle;
|
||||
HFONT hIconTitleFont;
|
||||
|
||||
/***********************************************************************
|
||||
* ICONTITLE_Init
|
||||
*/
|
||||
WINBOOL ICONTITLE_Init(void)
|
||||
{
|
||||
LOGFONT logFont;
|
||||
|
||||
SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
|
||||
SystemParametersInfoA( SPI_GETICONTITLEWRAP, 0, &bMultiLineTitle, 0 );
|
||||
hIconTitleFont = CreateFontIndirectA( &logFont );
|
||||
return (hIconTitleFont) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ICONTITLE_Create
|
||||
*/
|
||||
HWND ICONTITLE_Create( WND* wnd )
|
||||
{
|
||||
WND* wndPtr;
|
||||
HWND hWnd;
|
||||
|
||||
|
||||
|
||||
if( wnd->dwStyle & WS_CHILD ) {
|
||||
|
||||
hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_NAME_A, NULL,
|
||||
WS_CHILD | WS_CLIPSIBLINGS, 0, 0, 1, 1,
|
||||
wnd->parent->hwndSelf, 0, wnd->hInstance, NULL );
|
||||
}
|
||||
else {
|
||||
|
||||
hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_NAME_A, NULL,
|
||||
WS_CLIPSIBLINGS, 0, 0, 1, 1,
|
||||
wnd->hwndSelf, 0, wnd->hInstance, NULL );
|
||||
|
||||
}
|
||||
wndPtr = WIN_FindWndPtr( hWnd );
|
||||
if( wndPtr )
|
||||
{
|
||||
wndPtr->owner = wnd; /* MDI depends on this */
|
||||
wndPtr->dwStyle &= ~(WS_CAPTION | WS_BORDER);
|
||||
if( wnd->dwStyle & WS_DISABLED ) wndPtr->dwStyle |= WS_DISABLED;
|
||||
return hWnd;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ICONTITLE_GetTitlePos
|
||||
*/
|
||||
WINBOOL ICONTITLE_GetTitlePos( WND* wnd, LPRECT lpRect )
|
||||
{
|
||||
LPSTR str;
|
||||
int length = lstrlenA( wnd->owner->text );
|
||||
|
||||
if( length )
|
||||
{
|
||||
str = HeapAlloc( GetProcessHeap(), 0, length + 1 );
|
||||
lstrcpyA( str, wnd->owner->text );
|
||||
while( str[length - 1] == ' ' ) /* remove trailing spaces */
|
||||
{
|
||||
str[--length] = '\0';
|
||||
if( !length )
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, str );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( !length )
|
||||
{
|
||||
str = (LPSTR)emptyTitleText;
|
||||
length = lstrlenA( str );
|
||||
}
|
||||
|
||||
if( str )
|
||||
{
|
||||
HDC hDC = GetDC( wnd->hwndSelf );
|
||||
if( hDC )
|
||||
{
|
||||
HFONT hPrevFont = SelectObject( hDC, hIconTitleFont );
|
||||
|
||||
SetRect( lpRect, 0, 0, sysMetrics[SM_CXICONSPACING] -
|
||||
SYSMETRICS_CXBORDER * 2, SYSMETRICS_CYBORDER * 2 );
|
||||
|
||||
DrawTextA( hDC, str, length, lpRect, DT_CALCRECT |
|
||||
DT_CENTER | DT_NOPREFIX | DT_WORDBREAK |
|
||||
(( bMultiLineTitle ) ? 0 : DT_SINGLELINE) );
|
||||
|
||||
SelectObject( hDC, hPrevFont );
|
||||
ReleaseDC( wnd->hwndSelf, hDC );
|
||||
|
||||
lpRect->right += 4 * SYSMETRICS_CXBORDER - lpRect->left;
|
||||
lpRect->left = wnd->owner->rectWindow.left + SYSMETRICS_CXICON / 2 -
|
||||
(lpRect->right - lpRect->left) / 2;
|
||||
lpRect->bottom -= lpRect->top;
|
||||
lpRect->top = wnd->owner->rectWindow.top + SYSMETRICS_CYICON;
|
||||
}
|
||||
if( str != emptyTitleText ) HeapFree( GetProcessHeap(), 0, str );
|
||||
return ( hDC ) ? TRUE : FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ICONTITLE_Paint
|
||||
*/
|
||||
WINBOOL ICONTITLE_Paint( WND* wnd, HDC hDC, WINBOOL bActive )
|
||||
{
|
||||
HFONT hPrevFont;
|
||||
HBRUSH hBrush = 0;
|
||||
COLORREF textColor = 0;
|
||||
|
||||
if( bActive )
|
||||
{
|
||||
hBrush = GetSysColorBrush(COLOR_ACTIVECAPTION);
|
||||
textColor = GetSysColor(COLOR_CAPTIONTEXT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( wnd->dwStyle & WS_CHILD )
|
||||
{
|
||||
hBrush = wnd->parent->class->hbrBackground;
|
||||
if( hBrush )
|
||||
{
|
||||
INT level;
|
||||
LOGBRUSH logBrush;
|
||||
GetObjectA( hBrush, sizeof(logBrush), &logBrush );
|
||||
level = GetRValue(logBrush.lbColor) +
|
||||
GetGValue(logBrush.lbColor) +
|
||||
GetBValue(logBrush.lbColor);
|
||||
if( level < (0x7F * 3) )
|
||||
textColor = RGB( 0xFF, 0xFF, 0xFF );
|
||||
}
|
||||
else
|
||||
hBrush = GetStockObject( WHITE_BRUSH );
|
||||
}
|
||||
else
|
||||
{
|
||||
hBrush = GetStockObject( BLACK_BRUSH );
|
||||
textColor = RGB( 0xFF, 0xFF, 0xFF );
|
||||
}
|
||||
}
|
||||
|
||||
FillWindow( wnd->parent->hwndSelf, wnd->hwndSelf, hDC, hBrush );
|
||||
|
||||
hPrevFont = SelectObject( hDC, hIconTitleFont );
|
||||
if( hPrevFont )
|
||||
{
|
||||
RECT rect;
|
||||
INT length;
|
||||
char buffer[80];
|
||||
|
||||
rect.left = rect.top = 0;
|
||||
rect.right = wnd->rectWindow.right - wnd->rectWindow.left;
|
||||
rect.bottom = wnd->rectWindow.bottom - wnd->rectWindow.top;
|
||||
|
||||
length = GetWindowTextA( wnd->owner->hwndSelf, buffer, 80 );
|
||||
SetTextColor( hDC, textColor );
|
||||
SetBkMode( hDC, TRANSPARENT );
|
||||
|
||||
DrawTextA( hDC, buffer, length, &rect, DT_CENTER | DT_NOPREFIX |
|
||||
DT_WORDBREAK | ((bMultiLineTitle) ? 0 : DT_SINGLELINE) );
|
||||
|
||||
SelectObject( hDC, hPrevFont );
|
||||
}
|
||||
return ( hPrevFont ) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* IconTitleWndProc
|
||||
*/
|
||||
LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg,
|
||||
WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
WND *wnd = WIN_FindWndPtr( hWnd );
|
||||
|
||||
switch( msg )
|
||||
{
|
||||
case WM_NCHITTEST:
|
||||
return HTCAPTION;
|
||||
|
||||
case WM_NCMOUSEMOVE:
|
||||
case WM_NCLBUTTONDBLCLK:
|
||||
return SendMessageA( wnd->owner->hwndSelf, msg, wParam, lParam );
|
||||
|
||||
case WM_ACTIVATE:
|
||||
if( wParam ) SetActiveWindow( wnd->owner->hwndSelf );
|
||||
/* fall through */
|
||||
|
||||
case WM_CLOSE:
|
||||
return 0;
|
||||
|
||||
case WM_SHOWWINDOW:
|
||||
if( wnd && wParam )
|
||||
{
|
||||
RECT titleRect;
|
||||
|
||||
ICONTITLE_GetTitlePos( wnd, &titleRect );
|
||||
if( wnd->owner->next != wnd ) /* keep icon title behind the owner */
|
||||
SetWindowPos( hWnd, wnd->owner->hwndSelf,
|
||||
titleRect.left, titleRect.top,
|
||||
titleRect.right, titleRect.bottom, SWP_NOACTIVATE );
|
||||
else
|
||||
SetWindowPos( hWnd, 0, titleRect.left, titleRect.top,
|
||||
titleRect.right, titleRect.bottom,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER );
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
if( wnd )
|
||||
{
|
||||
WND* iconWnd = wnd->owner;
|
||||
|
||||
if( iconWnd->dwStyle & WS_CHILD )
|
||||
lParam = SendMessageA( iconWnd->hwndSelf, WM_ISACTIVEICON, 0, 0 );
|
||||
else
|
||||
lParam = (iconWnd->hwndSelf == GetActiveWindow());
|
||||
|
||||
if( ICONTITLE_Paint( wnd, (HDC)wParam, (WINBOOL)lParam ) )
|
||||
ValidateRect( hWnd, NULL );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProcA( hWnd, msg, wParam, lParam );
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,509 +0,0 @@
|
|||
/*
|
||||
* Static control
|
||||
*
|
||||
* Copyright David W. Metcalfe, 1993
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/static.h>
|
||||
#include <user32/debug.h>
|
||||
#include <user32/syscolor.h>
|
||||
#include <user32/nc.h>
|
||||
#include <user32/defwnd.h>
|
||||
|
||||
|
||||
/* Static Control Styles */
|
||||
|
||||
|
||||
|
||||
|
||||
//#define SS_ETCHEDHORZ 0x00000010L
|
||||
//#define SS_ETCHEDVERT 0x00000011L
|
||||
//#define SS_ETCHEDFRAME 0x00000012L
|
||||
#define SS_TYPEMASK 0x0000001FL
|
||||
|
||||
//#define SS_NOPREFIX 0x00000080L
|
||||
//#define SS_NOTIFY 0x00000100L
|
||||
//#define SS_CENTERIMAGE 0x00000200L
|
||||
//#define SS_RIGHTJUST 0x00000400L
|
||||
//#define SS_REALSIZEIMAGE 0x00000800L
|
||||
//#define SS_SUNKEN 0x00001000L
|
||||
|
||||
/* Static Control Messages */
|
||||
|
||||
//#define STM_SETICON 0x0170
|
||||
//#define STM_GETICON 0x0171
|
||||
//#define STM_SETIMAGE 0x0172
|
||||
//#define STM_GETIMAGE 0x0173
|
||||
|
||||
static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc );
|
||||
static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc );
|
||||
static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc );
|
||||
static void STATIC_PaintBitmapfn( WND *wndPtr, HDC hdc );
|
||||
static void STATIC_PaintEtchedfn( WND *wndPtr, HDC hdc );
|
||||
|
||||
static COLORREF color_windowframe, color_background, color_window;
|
||||
|
||||
|
||||
typedef void (*pfPaint)( WND *, HDC );
|
||||
|
||||
static pfPaint staticPaintFunc[SS_TYPEMASK+1] =
|
||||
{
|
||||
STATIC_PaintTextfn, /* SS_LEFT */
|
||||
STATIC_PaintTextfn, /* SS_CENTER */
|
||||
STATIC_PaintTextfn, /* SS_RIGHT */
|
||||
STATIC_PaintIconfn, /* SS_ICON */
|
||||
STATIC_PaintRectfn, /* SS_BLACKRECT */
|
||||
STATIC_PaintRectfn, /* SS_GRAYRECT */
|
||||
STATIC_PaintRectfn, /* SS_WHITERECT */
|
||||
STATIC_PaintRectfn, /* SS_BLACKFRAME */
|
||||
STATIC_PaintRectfn, /* SS_GRAYFRAME */
|
||||
STATIC_PaintRectfn, /* SS_WHITEFRAME */
|
||||
NULL, /* Not defined */
|
||||
STATIC_PaintTextfn, /* SS_SIMPLE */
|
||||
STATIC_PaintTextfn, /* SS_LEFTNOWORDWRAP */
|
||||
NULL, /* SS_OWNERDRAW */
|
||||
STATIC_PaintBitmapfn, /* SS_BITMAP */
|
||||
NULL, /* SS_ENHMETAFILE */
|
||||
STATIC_PaintEtchedfn, /* SS_ETCHEDHORIZ */
|
||||
STATIC_PaintEtchedfn, /* SS_ETCHEDVERT */
|
||||
STATIC_PaintEtchedfn, /* SS_ETCHEDFRAME */
|
||||
};
|
||||
|
||||
HICON STATIC_LoadIcon(WND *wndPtr,const void *name )
|
||||
{
|
||||
HICON hIcon;
|
||||
if ( wndPtr->class->bUnicode ) {
|
||||
hIcon = LoadIconW(wndPtr->hInstance,(LPCWSTR)name);
|
||||
}
|
||||
else
|
||||
hIcon = LoadIconA(wndPtr->hInstance,(LPCSTR)name);
|
||||
|
||||
return hIcon;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* STATIC_SetIcon
|
||||
*
|
||||
* Set the icon for an SS_ICON control.
|
||||
*/
|
||||
HICON STATIC_SetIcon( WND *wndPtr, HICON hicon )
|
||||
{
|
||||
HICON prevIcon;
|
||||
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
|
||||
ICONINFO iconinfo;
|
||||
BITMAP info;
|
||||
|
||||
if ( !GetIconInfo(hicon, &iconinfo ) )
|
||||
return NULL;
|
||||
|
||||
if ( iconinfo.hbmColor )
|
||||
GetObject(iconinfo.hbmColor, sizeof(BITMAP),&info);
|
||||
else
|
||||
GetObject(iconinfo.hbmMask, sizeof(BITMAP),&info);
|
||||
|
||||
if ((wndPtr->dwStyle & SS_TYPEMASK) != SS_ICON) return 0;
|
||||
|
||||
prevIcon = infoPtr->hIcon;
|
||||
infoPtr->hIcon = hicon;
|
||||
if (hicon)
|
||||
{
|
||||
SetWindowPos( wndPtr->hwndSelf, 0, 0, 0, info.bmWidth, info.bmHeight,
|
||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
|
||||
}
|
||||
return prevIcon;
|
||||
}
|
||||
|
||||
|
||||
HBITMAP STATIC_LoadBitmap(WND *wndPtr,const void *name )
|
||||
{
|
||||
HBITMAP hBitmap;
|
||||
if ( wndPtr->class->bUnicode ) {
|
||||
hBitmap = LoadBitmapW(wndPtr->hInstance,(LPCWSTR)name);
|
||||
}
|
||||
else
|
||||
hBitmap = LoadBitmapA(wndPtr->hInstance,(LPCSTR)name);
|
||||
return hBitmap;
|
||||
}
|
||||
/***********************************************************************
|
||||
* STATIC_SetBitmap
|
||||
*
|
||||
* Set the bitmap for an SS_BITMAP control.
|
||||
*/
|
||||
HICON STATIC_SetBitmap( WND *wndPtr, HICON hicon )
|
||||
{
|
||||
|
||||
HICON prevIcon;
|
||||
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
|
||||
BITMAP info;
|
||||
|
||||
if ( hicon == NULL )
|
||||
return NULL;
|
||||
|
||||
GetObject(hicon, sizeof(BITMAP),&info);
|
||||
|
||||
if ((wndPtr->dwStyle & SS_TYPEMASK) != SS_BITMAP) return 0;
|
||||
|
||||
prevIcon = infoPtr->hIcon;
|
||||
infoPtr->hIcon = hicon;
|
||||
if (hicon)
|
||||
{
|
||||
SetWindowPos( wndPtr->hwndSelf, 0, 0, 0, info.bmWidth, info.bmHeight,
|
||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
|
||||
}
|
||||
|
||||
return prevIcon;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* StaticWndProc
|
||||
*/
|
||||
LRESULT WINAPI StaticWndProc( HWND hWnd, UINT uMsg, WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
LRESULT lResult = 0;
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
LONG style = wndPtr->dwStyle & SS_TYPEMASK;
|
||||
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_NCCREATE: {
|
||||
CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
|
||||
|
||||
if ((TWEAK_WineLook > WIN31_LOOK) && (wndPtr->dwStyle & SS_SUNKEN))
|
||||
wndPtr->dwExStyle |= WS_EX_STATICEDGE;
|
||||
|
||||
if (style == SS_ICON)
|
||||
{
|
||||
if (cs->lpszName) {
|
||||
STATIC_SetIcon( wndPtr,STATIC_LoadIcon(wndPtr,cs->lpszName));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (style == SS_BITMAP)
|
||||
{
|
||||
if (cs->lpszName) {
|
||||
STATIC_SetBitmap( wndPtr,STATIC_LoadBitmap(wndPtr,cs->lpszName));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( wndPtr->class->bUnicode )
|
||||
return DefWindowProcW( hWnd, uMsg, wParam, lParam );
|
||||
else
|
||||
return DefWindowProcA( hWnd, uMsg, wParam, lParam );
|
||||
}
|
||||
case WM_CREATE:
|
||||
if (style < 0L || style > SS_TYPEMASK)
|
||||
{
|
||||
DPRINT( "Unknown style 0x%02lx\n", style );
|
||||
lResult = -1L;
|
||||
break;
|
||||
}
|
||||
/* initialise colours */
|
||||
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
|
||||
color_background = GetSysColor(COLOR_BACKGROUND);
|
||||
color_window = GetSysColor(COLOR_WINDOW);
|
||||
break;
|
||||
|
||||
case WM_NCDESTROY:
|
||||
if (style == SS_ICON) {
|
||||
/*
|
||||
* FIXME
|
||||
* DestroyIcon( STATIC_SetIcon( wndPtr, 0 ) );
|
||||
*
|
||||
* We don't want to do this yet because DestroyIcon is broken. If the icon
|
||||
* had already been loaded by the application the last thing we want to do is
|
||||
* GlobalFree the handle.
|
||||
*/
|
||||
} else {
|
||||
if ( wndPtr->class->bUnicode )
|
||||
lResult = DefWindowProcW( hWnd, uMsg, wParam, lParam );
|
||||
else
|
||||
lResult = DefWindowProcA( hWnd, uMsg, wParam, lParam );
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
BeginPaint( hWnd, &ps );
|
||||
if (staticPaintFunc[style])
|
||||
(staticPaintFunc[style])( wndPtr, ps.hdc );
|
||||
EndPaint( hWnd, &ps );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_ENABLE:
|
||||
InvalidateRect( hWnd, NULL, FALSE );
|
||||
break;
|
||||
|
||||
case WM_SYSCOLORCHANGE:
|
||||
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
|
||||
color_background = GetSysColor(COLOR_BACKGROUND);
|
||||
color_window = GetSysColor(COLOR_WINDOW);
|
||||
InvalidateRect( hWnd, NULL, TRUE );
|
||||
break;
|
||||
|
||||
case WM_SETTEXT:
|
||||
if (style == SS_ICON)
|
||||
{
|
||||
if (lParam) {
|
||||
STATIC_SetIcon( wndPtr,STATIC_LoadIcon(wndPtr,(const void *)lParam));
|
||||
}
|
||||
|
||||
}
|
||||
else if (style == SS_BITMAP)
|
||||
{
|
||||
if (lParam) {
|
||||
STATIC_SetBitmap( wndPtr,STATIC_LoadBitmap(wndPtr,(const void *)lParam));
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
DEFWND_SetText( wndPtr, (const void *)lParam );
|
||||
|
||||
}
|
||||
InvalidateRect( hWnd, NULL, FALSE );
|
||||
UpdateWindow( hWnd );
|
||||
break;
|
||||
|
||||
case WM_SETFONT:
|
||||
if (style == SS_ICON) return 0;
|
||||
if (style == SS_BITMAP) return 0;
|
||||
infoPtr->hFont = (HFONT)wParam;
|
||||
if (LOWORD(lParam))
|
||||
{
|
||||
InvalidateRect( hWnd, NULL, FALSE );
|
||||
UpdateWindow( hWnd );
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_GETFONT:
|
||||
return infoPtr->hFont;
|
||||
|
||||
case WM_NCHITTEST:
|
||||
return HTTRANSPARENT;
|
||||
|
||||
case WM_GETDLGCODE:
|
||||
return DLGC_STATIC;
|
||||
|
||||
case STM_GETIMAGE:
|
||||
case STM_GETICON:
|
||||
return infoPtr->hIcon;
|
||||
|
||||
case STM_SETIMAGE:
|
||||
/* FIXME: handle wParam */
|
||||
lResult = STATIC_SetBitmap( wndPtr, (HBITMAP)lParam );
|
||||
InvalidateRect( hWnd, NULL, FALSE );
|
||||
UpdateWindow( hWnd );
|
||||
break;
|
||||
|
||||
|
||||
case STM_SETICON:
|
||||
lResult = STATIC_SetIcon( wndPtr, (HICON)wParam );
|
||||
InvalidateRect( hWnd, NULL, FALSE );
|
||||
UpdateWindow( hWnd );
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( wndPtr->class->bUnicode )
|
||||
lResult = DefWindowProcW( hWnd, uMsg, wParam, lParam );
|
||||
else
|
||||
lResult = DefWindowProcA( hWnd, uMsg, wParam, lParam );
|
||||
break;
|
||||
}
|
||||
|
||||
return lResult;
|
||||
}
|
||||
|
||||
|
||||
static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc )
|
||||
{
|
||||
RECT rc;
|
||||
HBRUSH hBrush;
|
||||
WORD wFormat;
|
||||
|
||||
LONG style = wndPtr->dwStyle;
|
||||
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
|
||||
|
||||
GetClientRect( wndPtr->hwndSelf, &rc);
|
||||
|
||||
switch (style & SS_TYPEMASK)
|
||||
{
|
||||
case SS_LEFT:
|
||||
wFormat = DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_NOCLIP;
|
||||
break;
|
||||
|
||||
case SS_CENTER:
|
||||
wFormat = DT_CENTER | DT_EXPANDTABS | DT_WORDBREAK | DT_NOCLIP;
|
||||
break;
|
||||
|
||||
case SS_RIGHT:
|
||||
wFormat = DT_RIGHT | DT_EXPANDTABS | DT_WORDBREAK | DT_NOCLIP;
|
||||
break;
|
||||
|
||||
case SS_SIMPLE:
|
||||
wFormat = DT_LEFT | DT_SINGLELINE | DT_VCENTER | DT_NOCLIP;
|
||||
break;
|
||||
|
||||
case SS_LEFTNOWORDWRAP:
|
||||
wFormat = DT_LEFT | DT_SINGLELINE | DT_EXPANDTABS | DT_VCENTER | DT_NOCLIP;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (style & SS_NOPREFIX)
|
||||
wFormat |= DT_NOPREFIX;
|
||||
|
||||
if (infoPtr->hFont) SelectObject( hdc, infoPtr->hFont );
|
||||
hBrush = MSG_SendMessage( wndPtr->parent, WM_CTLCOLORSTATIC,
|
||||
(WPARAM)hdc,(LPARAM) wndPtr->hwndSelf );
|
||||
if (!hBrush) hBrush = GetStockObject(WHITE_BRUSH);
|
||||
FillRect( hdc, &rc, hBrush );
|
||||
if (wndPtr->text) {
|
||||
if ( wndPtr->class->bUnicode ) {
|
||||
DrawTextW( hdc, wndPtr->text, -1, &rc, wFormat );
|
||||
}
|
||||
else {
|
||||
DrawTextA( hdc, wndPtr->text, -1, &rc, wFormat );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc )
|
||||
{
|
||||
RECT rc;
|
||||
HBRUSH hBrush;
|
||||
|
||||
GetClientRect( wndPtr->hwndSelf, &rc);
|
||||
|
||||
switch (wndPtr->dwStyle & SS_TYPEMASK)
|
||||
{
|
||||
case SS_BLACKRECT:
|
||||
hBrush = CreateSolidBrush(color_windowframe);
|
||||
FillRect( hdc, &rc, hBrush );
|
||||
break;
|
||||
case SS_GRAYRECT:
|
||||
hBrush = CreateSolidBrush(color_background);
|
||||
FillRect( hdc, &rc, hBrush );
|
||||
break;
|
||||
case SS_WHITERECT:
|
||||
hBrush = CreateSolidBrush(color_window);
|
||||
FillRect( hdc, &rc, hBrush );
|
||||
break;
|
||||
case SS_BLACKFRAME:
|
||||
hBrush = CreateSolidBrush(color_windowframe);
|
||||
FrameRect( hdc, &rc, hBrush );
|
||||
break;
|
||||
case SS_GRAYFRAME:
|
||||
hBrush = CreateSolidBrush(color_background);
|
||||
FrameRect( hdc, &rc, hBrush );
|
||||
break;
|
||||
case SS_WHITEFRAME:
|
||||
hBrush = CreateSolidBrush(color_window);
|
||||
FrameRect( hdc, &rc, hBrush );
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
DeleteObject( hBrush );
|
||||
}
|
||||
|
||||
|
||||
static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc )
|
||||
{
|
||||
RECT rc;
|
||||
HBRUSH hbrush;
|
||||
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
|
||||
|
||||
GetClientRect( wndPtr->hwndSelf, &rc );
|
||||
hbrush = MSG_SendMessage( wndPtr->parent, WM_CTLCOLORSTATIC,
|
||||
(WPARAM)hdc, (LPARAM)wndPtr->hwndSelf );
|
||||
FillRect( hdc, &rc, hbrush );
|
||||
if (infoPtr->hIcon) DrawIcon( hdc, rc.left, rc.top, infoPtr->hIcon );
|
||||
}
|
||||
|
||||
static void STATIC_PaintBitmapfn(WND *wndPtr, HDC hdc )
|
||||
{
|
||||
RECT rc;
|
||||
HBRUSH hbrush;
|
||||
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
|
||||
HDC hMemDC;
|
||||
HBITMAP oldbitmap;
|
||||
|
||||
GetClientRect( wndPtr->hwndSelf, &rc );
|
||||
hbrush = MSG_SendMessage( wndPtr->parent, WM_CTLCOLORSTATIC,
|
||||
(WPARAM)hdc,(LPARAM) wndPtr->hwndSelf );
|
||||
FillRect( hdc, &rc, hbrush );
|
||||
if (infoPtr->hIcon) {
|
||||
BITMAP bmp;
|
||||
GetObject( infoPtr->hIcon, sizeof(BITMAP),&bmp);
|
||||
|
||||
if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
|
||||
|
||||
oldbitmap = SelectObject(hMemDC,infoPtr->hIcon);
|
||||
BitBlt(hdc,bmp.bmWidth,bmp.bmHeight,bmp.bmWidth,bmp.bmHeight,hMemDC,0,0,SRCCOPY);
|
||||
// BitBlt(hdc,bmp.size.cx,bmp.size.cy,bmp.bmWidth,bmp.bmHeight,hMemDC,0,0,SRCCOPY);
|
||||
DeleteDC(hMemDC);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void STATIC_PaintEtchedfn( WND *wndPtr, HDC hdc )
|
||||
{
|
||||
RECT rc;
|
||||
HBRUSH hbrush;
|
||||
HPEN hpen;
|
||||
|
||||
if (TWEAK_WineLook == WIN31_LOOK)
|
||||
return;
|
||||
|
||||
GetClientRect( wndPtr->hwndSelf, &rc );
|
||||
hbrush = MSG_SendMessage( wndPtr->parent, WM_CTLCOLORSTATIC,
|
||||
(WPARAM)hdc, (LPARAM)wndPtr->hwndSelf );
|
||||
FillRect( hdc, &rc, hbrush );
|
||||
|
||||
switch (wndPtr->dwStyle & SS_TYPEMASK)
|
||||
{
|
||||
case SS_ETCHEDHORZ:
|
||||
hpen = SelectObject (hdc, GetSysColorPen (COLOR_3DSHADOW));
|
||||
MoveToEx (hdc, rc.left, rc.bottom / 2 - 1, NULL);
|
||||
LineTo (hdc, rc.right - 1, rc.bottom / 2 - 1);
|
||||
SelectObject (hdc, GetSysColorPen (COLOR_3DHIGHLIGHT));
|
||||
MoveToEx (hdc, rc.left, rc.bottom / 2, NULL);
|
||||
LineTo (hdc, rc.right, rc.bottom / 2);
|
||||
LineTo (hdc, rc.right, rc.bottom / 2 - 1);
|
||||
SelectObject (hdc, hpen);
|
||||
break;
|
||||
|
||||
case SS_ETCHEDVERT:
|
||||
hpen = SelectObject (hdc, GetSysColorPen (COLOR_3DSHADOW));
|
||||
MoveToEx (hdc, rc.right / 2 - 1, rc.top, NULL);
|
||||
LineTo (hdc, rc.right / 2 - 1, rc.bottom - 1);
|
||||
SelectObject (hdc, GetSysColorPen (COLOR_3DHIGHLIGHT));
|
||||
MoveToEx (hdc, rc.right / 2, rc.top, NULL);
|
||||
LineTo (hdc, rc.right / 2, rc.bottom);
|
||||
LineTo (hdc, rc.right / 2 -1 , rc.bottom);
|
||||
SelectObject (hdc, hpen);
|
||||
break;
|
||||
|
||||
case SS_ETCHEDFRAME:
|
||||
DrawEdge (hdc, &rc, EDGE_ETCHED, BF_RECT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
* Windows widgets (built-in window classes)
|
||||
*
|
||||
* Copyright 1993 Alexandre Julliard
|
||||
*/
|
||||
|
||||
#define UNICODE
|
||||
#include <windows.h>
|
||||
#include <user32/widgets.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/button.h>
|
||||
#include <user32/scroll.h>
|
||||
#include <user32/static.h>
|
||||
#include <user32/mdi.h>
|
||||
#include <user32/dialog.h>
|
||||
#include <user32/heapdup.h>
|
||||
|
||||
|
||||
/* Built-in classes */
|
||||
#ifndef DLGWINDOWEXTRA
|
||||
#define DLGWINDOWEXTRA sizeof(DIALOGINFO)
|
||||
#endif
|
||||
|
||||
static WNDCLASS WIDGETS_BuiltinClasses[BIC_NB_CLASSES+1] =
|
||||
{
|
||||
/* BIC_BUTTON */
|
||||
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
|
||||
ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0,
|
||||
(HCURSOR)IDC_ARROW, 0, 0, BUTTON_CLASS_NAME },
|
||||
/* BIC_EDIT */
|
||||
{ CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
|
||||
EditWndProc, 0, sizeof(void *), 0, 0,
|
||||
(HCURSOR)IDC_IBEAM, 0, 0, EDIT_CLASS_NAME },
|
||||
/* BIC_LISTBOX */
|
||||
{ CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
|
||||
ListBoxWndProc, 0, sizeof(void *), 0, 0,
|
||||
(HCURSOR)IDC_ARROW, 0, 0, LISTBOX_CLASS_NAME },
|
||||
/* BIC_COMBO */
|
||||
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
|
||||
ComboWndProc, 0, sizeof(void *), 0, 0,
|
||||
(HCURSOR)IDC_ARROW, 0, 0, COMBOBOX_CLASS_NAME },
|
||||
/* BIC_COMBOLB */
|
||||
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS, ComboLBWndProc,
|
||||
0, sizeof(void *), 0, 0, (HCURSOR)IDC_ARROW, 0, 0,COMBOLBOX_CLASS_NAME},
|
||||
/* BIC_POPUPMENU */
|
||||
// { CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0, sizeof(HMENU),
|
||||
// 0, 0, (HCURSOR)IDC_ARROW, NULL_BRUSH, 0, POPUPMENU_CLASS_NAME },
|
||||
/* BIC_STATIC */
|
||||
{ CS_GLOBALCLASS | CS_PARENTDC, StaticWndProc,
|
||||
0, sizeof(STATICINFO), 0, 0, (HCURSOR)IDC_ARROW, 0, 0, STATIC_CLASS_NAME },
|
||||
/* BIC_SCROLL */
|
||||
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
|
||||
ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0,
|
||||
(HCURSOR)IDC_ARROW, 0, 0, SCROLLBAR_CLASS_NAME},
|
||||
/* BIC_MDICLIENT */
|
||||
// { CS_GLOBALCLASS, MDIClientWndProc,
|
||||
// 0, sizeof(MDICLIENTINFO), 0, 0, 0, LTGRAY_BRUSH, 0, "MDIClient" },
|
||||
/* BIC_DESKTOP */
|
||||
//sizeof(DESKTOPINFO)
|
||||
{ CS_GLOBALCLASS, DesktopWndProc, 0, 1024,
|
||||
0, 0, (HCURSOR)IDC_ARROW, 0, 0, DESKTOP_CLASS_NAME },
|
||||
/* BIC_DIALOG */
|
||||
{ CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProc, 100, 100,
|
||||
0, 0, (HCURSOR)IDC_ARROW, 0, 0, DIALOG_CLASS_NAMEW },
|
||||
/* BIC_ICONTITLE */
|
||||
{ CS_GLOBALCLASS, IconTitleWndProc, 0, 0,
|
||||
0, 0, (HCURSOR)IDC_ARROW, 0, 0, ICONTITLE_CLASS_NAME },
|
||||
/* BIC_DIALOG Ascii */
|
||||
{ CS_GLOBALCLASS, DefDlgProcA, 100, 100,
|
||||
0, 0, (HCURSOR)IDC_ARROW, 0, 0, (LPWSTR)DIALOG_CLASS_NAME_A }
|
||||
};
|
||||
|
||||
|
||||
static ATOM bicAtomTable[BIC_NB_CLASSES+1];
|
||||
|
||||
/***********************************************************************
|
||||
* WIDGETS_Init
|
||||
*
|
||||
* Initialize the built-in window classes.
|
||||
*/
|
||||
WINBOOL WIDGETS_Init(void)
|
||||
{
|
||||
int i;
|
||||
WNDCLASS *cls = WIDGETS_BuiltinClasses;
|
||||
|
||||
/* Create builtin classes */
|
||||
|
||||
for (i = 0; i < BIC_NB_CLASSES; i++)
|
||||
{
|
||||
|
||||
cls[i].hCursor = LoadCursorW( 0, (LPCWSTR)cls[i].hCursor );
|
||||
if (!(bicAtomTable[i] = RegisterClassW( &cls[i] ))) return FALSE;
|
||||
}
|
||||
|
||||
cls[i].hCursor = LoadCursorW( 0, (LPCWSTR)cls[i].hCursor );
|
||||
if (!(bicAtomTable[i] = RegisterClassA( &cls[i] ))) return FALSE;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message,
|
||||
WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* WIDGETS_IsControl
|
||||
*
|
||||
* Check whether pWnd is a built-in control or not.
|
||||
*/
|
||||
WINBOOL WIDGETS_IsControl( WND* pWnd, BUILTIN_CLASS cls )
|
||||
{
|
||||
if( cls >= BIC_NB_CLASSES )
|
||||
return FALSE;
|
||||
return (pWnd->class->atomName == bicAtomTable[cls]);
|
||||
}
|
|
@ -1,297 +0,0 @@
|
|||
/*
|
||||
* Caret functions
|
||||
*
|
||||
* Copyright 1993 David Metcalfe
|
||||
* Copyright 1996 Frans van Dorsselaer
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/caret.h>
|
||||
#include <user32/debug.h>
|
||||
|
||||
static CARET Caret = { 0, 0, FALSE, 0, 0, 2, 12, 0, 500, 0 };
|
||||
|
||||
|
||||
WINBOOL STDCALL CreateCaret( HWND hwnd, HBITMAP bitmap,
|
||||
INT width, INT height )
|
||||
{
|
||||
DPRINT("hwnd=%04x\n",(UINT) hwnd);
|
||||
|
||||
if (!hwnd) return FALSE;
|
||||
|
||||
/* if cursor already exists, destroy it */
|
||||
if (Caret.hwnd) DestroyCaret();
|
||||
|
||||
if (bitmap && ((UINT)bitmap != 1))
|
||||
{
|
||||
BITMAP bmp;
|
||||
if (!GetObject( bitmap, sizeof(bmp), &bmp )) return FALSE;
|
||||
Caret.width = bmp.bmWidth;
|
||||
Caret.height = bmp.bmHeight;
|
||||
/* FIXME: we should make a copy of the bitmap instead of a brush */
|
||||
Caret.hBrush = CreatePatternBrush( bitmap );
|
||||
}
|
||||
else
|
||||
{
|
||||
Caret.width = width ? width : GetSystemMetrics(SM_CXBORDER);
|
||||
Caret.height = height ? height : GetSystemMetrics(SM_CYBORDER);
|
||||
Caret.hBrush = CreateSolidBrush(bitmap ?
|
||||
GetSysColor(COLOR_GRAYTEXT) :
|
||||
GetSysColor(COLOR_WINDOW) );
|
||||
}
|
||||
|
||||
Caret.hwnd = hwnd;
|
||||
Caret.hidden = 1;
|
||||
Caret.on = FALSE;
|
||||
Caret.x = 0;
|
||||
Caret.y = 0;
|
||||
|
||||
Caret.timeout = GetProfileIntA( "windows", "CursorBlinkRate", 500 );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WINBOOL STDCALL DestroyCaret(void)
|
||||
{
|
||||
if (!Caret.hwnd) return FALSE;
|
||||
|
||||
DPRINT("hwnd=%04x, timerid=%d\n", (UINT)Caret.hwnd,(UINT) Caret.timerid);
|
||||
|
||||
CARET_KillTimer();
|
||||
CARET_DisplayCaret(CARET_OFF);
|
||||
DeleteObject( Caret.hBrush );
|
||||
Caret.hwnd = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WINBOOL STDCALL SetCaretPos( INT x, INT y)
|
||||
{
|
||||
if (!Caret.hwnd) return FALSE;
|
||||
if ((x == Caret.x) && (y == Caret.y)) return TRUE;
|
||||
|
||||
DPRINT("x=%d, y=%d\n", x, y);
|
||||
|
||||
CARET_KillTimer();
|
||||
CARET_DisplayCaret(CARET_OFF);
|
||||
Caret.x = x;
|
||||
Caret.y = y;
|
||||
if (!Caret.hidden)
|
||||
{
|
||||
CARET_DisplayCaret(CARET_ON);
|
||||
CARET_SetTimer();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* HideCaret (USER.317)
|
||||
*/
|
||||
WINBOOL STDCALL HideCaret( HWND hwnd )
|
||||
{
|
||||
if (!Caret.hwnd) return FALSE;
|
||||
if (hwnd && (Caret.hwnd != hwnd)) return FALSE;
|
||||
|
||||
DPRINT("hwnd=%04x, hidden=%d\n",
|
||||
hwnd, Caret.hidden);
|
||||
|
||||
CARET_KillTimer();
|
||||
CARET_DisplayCaret(CARET_OFF);
|
||||
Caret.hidden++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* ShowCaret (USER.529)
|
||||
*/
|
||||
WINBOOL STDCALL ShowCaret( HWND hwnd )
|
||||
{
|
||||
if (!Caret.hwnd) return FALSE;
|
||||
if (hwnd && (Caret.hwnd != hwnd)) return FALSE;
|
||||
|
||||
DPRINT("hwnd=%04x, hidden=%d\n",
|
||||
hwnd, Caret.hidden);
|
||||
|
||||
if (Caret.hidden)
|
||||
{
|
||||
Caret.hidden--;
|
||||
if (!Caret.hidden)
|
||||
{
|
||||
CARET_DisplayCaret(CARET_ON);
|
||||
CARET_SetTimer();
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* SetCaretBlinkTime (USER.465)
|
||||
*/
|
||||
WINBOOL STDCALL SetCaretBlinkTime( UINT msecs )
|
||||
{
|
||||
if (!Caret.hwnd) return FALSE;
|
||||
|
||||
DPRINT("hwnd=%04x, msecs=%d\n",
|
||||
Caret.hwnd, msecs);
|
||||
|
||||
Caret.timeout = msecs;
|
||||
CARET_ResetTimer();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* GetCaretBlinkTime (USER.209)
|
||||
*/
|
||||
UINT STDCALL GetCaretBlinkTime(void)
|
||||
{
|
||||
return Caret.timeout;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* GetCaretPos (USER.210)
|
||||
*/
|
||||
WINBOOL STDCALL GetCaretPos( LPPOINT pt )
|
||||
{
|
||||
if (!Caret.hwnd || !pt) return FALSE;
|
||||
pt->x = Caret.x;
|
||||
pt->y = Caret.y;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* CARET_GetHwnd
|
||||
*/
|
||||
HWND CARET_GetHwnd(void)
|
||||
{
|
||||
return Caret.hwnd;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* CARET_GetRect
|
||||
*/
|
||||
void CARET_GetRect(LPRECT lprc)
|
||||
{
|
||||
lprc->right = (lprc->left = Caret.x) + Caret.width - 1;
|
||||
lprc->bottom = (lprc->top = Caret.y) + Caret.height - 1;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* CARET_DisplayCaret
|
||||
*/
|
||||
void CARET_DisplayCaret( DISPLAY_CARET status )
|
||||
{
|
||||
HDC hdc;
|
||||
HBRUSH hPrevBrush;
|
||||
|
||||
if (Caret.on && (status == CARET_ON)) return;
|
||||
if (!Caret.on && (status == CARET_OFF)) return;
|
||||
|
||||
/* So now it's always a toggle */
|
||||
|
||||
Caret.on = !Caret.on;
|
||||
/* do not use DCX_CACHE here, for x,y,width,height are in logical units */
|
||||
if (!(hdc = GetDCEx( Caret.hwnd, 0, DCX_USESTYLE /*| DCX_CACHE*/ ))) return;
|
||||
hPrevBrush = SelectObject( hdc, Caret.hBrush );
|
||||
PatBlt( hdc, Caret.x, Caret.y, Caret.width, Caret.height, PATINVERT );
|
||||
SelectObject( hdc, hPrevBrush );
|
||||
ReleaseDC( Caret.hwnd, hdc );
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* CARET_Callback
|
||||
*/
|
||||
VOID CALLBACK CARET_Callback( HWND hwnd, UINT msg, UINT id, DWORD ctime)
|
||||
{
|
||||
DPRINT("hwnd=%04x, timerid=%d, caret=%d\n", hwnd, id, Caret.on);
|
||||
CARET_DisplayCaret(CARET_TOGGLE);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* CARET_SetTimer
|
||||
*/
|
||||
void CARET_SetTimer(void)
|
||||
{
|
||||
if (Caret.timerid)
|
||||
KillTimer( (HWND)0, Caret.timerid );
|
||||
Caret.timerid = SetTimer( (HWND)0, 0, Caret.timeout,CARET_Callback );
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* CARET_ResetTimer
|
||||
*/
|
||||
void CARET_ResetTimer(void)
|
||||
{
|
||||
if (Caret.timerid)
|
||||
{
|
||||
KillTimer( (HWND)0, Caret.timerid );
|
||||
Caret.timerid = SetTimer( (HWND)0, 0, Caret.timeout,
|
||||
CARET_Callback );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* CARET_KillTimer
|
||||
*/
|
||||
void CARET_KillTimer(void)
|
||||
{
|
||||
if (Caret.timerid)
|
||||
{
|
||||
KillTimer( (HWND)0, Caret.timerid );
|
||||
Caret.timerid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* CreateIconFromResource (USER32.76)
|
||||
*/
|
||||
HICON STDCALL CreateIconFromResource( LPBYTE bits, UINT cbSize,
|
||||
WINBOOL bIcon, DWORD dwVersion)
|
||||
{
|
||||
return CreateIconFromResourceEx( bits, cbSize, bIcon, dwVersion, 0,0,0);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* CreateIconFromResourceEx (USER32.77)
|
||||
*/
|
||||
HICON STDCALL CreateIconFromResourceEx( LPBYTE bits, UINT cbSize,
|
||||
WINBOOL bIcon, DWORD dwVersion,
|
||||
INT width, INT height,
|
||||
UINT cFlag )
|
||||
{
|
||||
/*
|
||||
TDB* pTask = (TDB*)GlobalLock( GetCurrentTask() );
|
||||
if( pTask )
|
||||
return CURSORICON_CreateFromResource( pTask->hInstance, 0, bits, cbSize, bIcon, dwVersion,
|
||||
width, height, cFlag );
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#include <windows.h>
|
||||
//#include <user32/uitools.h>
|
||||
#include <user32/debug.h>
|
||||
|
||||
WINBOOL STDCALL DrawEdge( HDC hdc, LPRECT rc, UINT edge, UINT flags )
|
||||
{
|
||||
DPRINT("graphics %04x %d,%d-%d,%d %04x %04x\n",
|
||||
hdc, rc->left, rc->top, rc->right, rc->bottom, edge, flags );
|
||||
|
||||
if(flags & BF_DIAGONAL)
|
||||
return UITOOLS95_DrawDiagEdge(hdc, rc, edge, flags);
|
||||
else
|
||||
return UITOOLS95_DrawRectEdge(hdc, rc, edge, flags);
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
#include <windows.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/paint.h>
|
||||
|
||||
|
||||
void FillWindow( HWND hwndParent, HWND hwnd, HDC hdc, HBRUSH hbrush )
|
||||
{
|
||||
RECT rect;
|
||||
GetClientRect( hwnd, &rect );
|
||||
PaintRect( hwndParent, hwnd, hdc, hbrush, &rect );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PaintRect (USER.325)
|
||||
*/
|
||||
void PaintRect( HWND hwndParent, HWND hwnd, HDC hdc,
|
||||
HBRUSH hbrush, const RECT *rect)
|
||||
{
|
||||
if( hbrush <= CTLCOLOR_MAX )
|
||||
{
|
||||
if( hwndParent )
|
||||
hbrush = PAINT_GetControlBrush( hwndParent, hwnd, hdc, (UINT)hbrush );
|
||||
else
|
||||
return;
|
||||
}
|
||||
if( hbrush )
|
||||
FillRect( hdc, rect, hbrush );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
INT STDCALL FrameRect( HDC hdc, const RECT *rect, HBRUSH hbrush )
|
||||
{
|
||||
HBRUSH prevBrush;
|
||||
//int left, top, right, bottom;
|
||||
|
||||
if ( hdc == NULL )
|
||||
return 0;
|
||||
|
||||
//left = XLPTODP( dc, rect->left );
|
||||
//top = YLPTODP( dc, rect->top );
|
||||
//right = XLPTODP( dc, rect->right );
|
||||
//bottom = YLPTODP( dc, rect->bottom );
|
||||
|
||||
//if ( (right <= left) || (bottom <= top) ) return 0;
|
||||
if (!(prevBrush = SelectObject( hdc, hbrush ))) return 0;
|
||||
|
||||
PatBlt( hdc, rect->left, rect->top, 1,
|
||||
rect->bottom - rect->top, PATCOPY );
|
||||
PatBlt( hdc, rect->right - 1, rect->top, 1,
|
||||
rect->bottom - rect->top, PATCOPY );
|
||||
PatBlt( hdc, rect->left, rect->top,
|
||||
rect->right - rect->left, 1, PATCOPY );
|
||||
PatBlt( hdc, rect->left, rect->bottom - 1,
|
||||
rect->right - rect->left, 1, PATCOPY );
|
||||
|
||||
SelectObject( hdc, prevBrush );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
INT STDCALL FillRect( HDC hdc, const RECT *rect, HBRUSH hbrush )
|
||||
{
|
||||
HBRUSH prevBrush;
|
||||
|
||||
if (!(prevBrush = SelectObject( hdc, hbrush ))) return 0;
|
||||
PatBlt( hdc, rect->left, rect->top,
|
||||
rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
|
||||
SelectObject( hdc, prevBrush );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL InvertRect( HDC hDC, CONST RECT *lprc)
|
||||
{
|
||||
return PatBlt( hDC, lprc->left, lprc->top,
|
||||
lprc->right - lprc->left, lprc->bottom - lprc->top, DSTINVERT );
|
||||
}
|
|
@ -1,208 +0,0 @@
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
//#include <user32/static.h>
|
||||
|
||||
HICON LoadStandardIcon(UINT IconId);
|
||||
|
||||
HICON
|
||||
STDCALL
|
||||
CreateIcon(
|
||||
HINSTANCE hInstance,
|
||||
int nWidth,
|
||||
int nHeight,
|
||||
BYTE cPlanes,
|
||||
BYTE cBitsPixel,
|
||||
CONST BYTE *lpbANDbits,
|
||||
CONST BYTE *lpbXORbits)
|
||||
{
|
||||
#if 0
|
||||
|
||||
ICONINFO IconInfo;
|
||||
IconInfo.fIcon = TRUE;
|
||||
IconInfo.hbmMask = NULL;
|
||||
IconInfo.hbmColor = NULL;
|
||||
return CreateIconIndirect( &IconInfo );
|
||||
#endif
|
||||
}
|
||||
|
||||
HICON
|
||||
STDCALL
|
||||
CreateIconIndirect(
|
||||
PICONINFO lpIconInfo)
|
||||
{
|
||||
BITMAP bmpXor,bmpAnd;
|
||||
HICON hObj;
|
||||
int sizeXor,sizeAnd;
|
||||
|
||||
GetObject(lpIconInfo->hbmColor,sizeof(BITMAP),&bmpXor);
|
||||
GetObject(lpIconInfo->hbmMask,sizeof(BITMAP),&bmpAnd);
|
||||
|
||||
|
||||
|
||||
sizeXor = bmpXor.bmHeight * bmpXor.bmWidthBytes;
|
||||
sizeAnd = bmpAnd.bmHeight * bmpAnd.bmWidthBytes;
|
||||
|
||||
hObj = GlobalAlloc( GMEM_MOVEABLE,
|
||||
sizeof(ICONINFO) + sizeXor + sizeAnd );
|
||||
if (hObj)
|
||||
{
|
||||
ICONINFO *info;
|
||||
|
||||
info = (ICONINFO *)( hObj );
|
||||
info->xHotspot = lpIconInfo->xHotspot;
|
||||
info->yHotspot = lpIconInfo->yHotspot;
|
||||
//info->nWidth = bmpXor.bmWidth;
|
||||
//info->nHeight = bmpXor.bmHeight;
|
||||
//info->nWidthBytes = bmpXor.bmWidthBytes;
|
||||
//info->bPlanes = bmpXor.bmPlanes;
|
||||
//info->bBitsPerPixel = bmpXor.bmBitsPixel;
|
||||
|
||||
/* Transfer the bitmap bits to the CURSORICONINFO structure */
|
||||
|
||||
GetBitmapBits( lpIconInfo->hbmMask ,sizeAnd,(char*)(info + 1) );
|
||||
GetBitmapBits( lpIconInfo->hbmColor,sizeXor,(char*)(info + 1) +sizeAnd);
|
||||
|
||||
}
|
||||
return hObj;
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DestroyIcon(
|
||||
HICON hIcon)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HICON
|
||||
STDCALL
|
||||
CopyIcon(
|
||||
HICON hIcon)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetIconInfo(
|
||||
HICON hIcon,
|
||||
PICONINFO piconinfo)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
HICON
|
||||
STDCALL
|
||||
LoadIconA(HINSTANCE hInstance,LPCSTR lpIconName )
|
||||
{
|
||||
HRSRC hrsrc;
|
||||
ICONINFO *IconInfo;
|
||||
|
||||
if ( hInstance == NULL ) {
|
||||
return LoadStandardIcon((UINT)lpIconName);
|
||||
}
|
||||
//RT_GROUP_ICON
|
||||
hrsrc = FindResourceExA(hInstance,RT_GROUP_ICON, lpIconName, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));
|
||||
|
||||
if ( hrsrc == NULL )
|
||||
return NULL;
|
||||
|
||||
IconInfo = (ICONINFO *)LoadResource(hInstance, hrsrc);
|
||||
if ( IconInfo != NULL || IconInfo->fIcon == FALSE )
|
||||
return NULL;
|
||||
|
||||
return CreateIconIndirect(IconInfo);
|
||||
}
|
||||
|
||||
HICON
|
||||
STDCALL
|
||||
LoadIconW(HINSTANCE hInstance,LPCWSTR lpIconName )
|
||||
{
|
||||
HRSRC hrsrc;
|
||||
ICONINFO *IconInfo;
|
||||
|
||||
if ( hInstance == NULL ) {
|
||||
return LoadStandardIcon((UINT)lpIconName);
|
||||
}
|
||||
|
||||
hrsrc = FindResourceW(hInstance,lpIconName,RT_GROUP_ICON);
|
||||
if ( hrsrc == NULL )
|
||||
return NULL;
|
||||
|
||||
IconInfo = (ICONINFO *)LoadResource(hInstance, hrsrc);
|
||||
if ( IconInfo != NULL || IconInfo->fIcon == FALSE )
|
||||
return NULL;
|
||||
|
||||
return CreateIconIndirect(IconInfo);
|
||||
}
|
||||
|
||||
HICON LoadStandardIcon(UINT IconId)
|
||||
{
|
||||
HMODULE hModule = LoadLibraryA("user32.dll");
|
||||
switch (IconId )
|
||||
{
|
||||
case (UINT)IDI_APPLICATION:
|
||||
IconId = 100;
|
||||
return LoadIconW(hModule,(LPWSTR)IconId);
|
||||
break;
|
||||
case (UINT)IDI_ASTERISK:
|
||||
//
|
||||
IconId = 103;
|
||||
return LoadIconW(hModule,(LPWSTR)IconId);
|
||||
break;
|
||||
case (UINT)IDI_EXCLAMATION:
|
||||
IconId = 101;
|
||||
return LoadIconW(hModule,(LPWSTR)IconId);
|
||||
break;
|
||||
case (UINT)IDI_HAND:
|
||||
//
|
||||
return LoadIconW(hModule,(LPWSTR)MAKEINTRESOURCE(104));
|
||||
break;
|
||||
case (UINT)IDI_QUESTION:
|
||||
IconId = 102;
|
||||
return LoadIconW(hModule,(LPWSTR)IconId);
|
||||
break;
|
||||
case (UINT)IDI_WINLOGO:
|
||||
IconId = 105;
|
||||
return LoadIconW(hModule,(LPWSTR)IconId);
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
WINBOOL STDCALL DrawIcon(HDC hDC, int xLeft, int yTop, HICON hIcon )
|
||||
{
|
||||
|
||||
return DrawIconEx( hDC, xLeft, yTop,hIcon, -1, -1,0,NULL, DI_DEFAULTSIZE);
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DrawIconEx(HDC hdc, int xLeft, int yTop,
|
||||
HICON hIcon, int cxWidth, int cyWidth,
|
||||
UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
|
||||
{
|
||||
//ICONINFO IconInfo;
|
||||
//SIZE Size;;
|
||||
//GetIconInfo(hIcon,&IconInfo);
|
||||
//GetBitmapDimensionEx(IconInfo.hbmMask,&Size);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DrawFocusRect(
|
||||
HDC hDC,
|
||||
CONST RECT * lprc)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
|
@ -1,256 +0,0 @@
|
|||
/*
|
||||
* Rectangle-related functions
|
||||
*
|
||||
* CopyxRight 1993, 1996 Alexandre Julliard
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ntos/minmax.h>
|
||||
#define MIN min
|
||||
#define MAX max
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/win.h>
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetRect(
|
||||
LPRECT lprc,
|
||||
int xLeft,
|
||||
int yTop,
|
||||
int xRight,
|
||||
int yBottom)
|
||||
{
|
||||
if ( lprc == NULL )
|
||||
return FALSE;
|
||||
lprc->left = xLeft;
|
||||
lprc->right = xRight;
|
||||
lprc->top = yTop;
|
||||
lprc->bottom = yBottom;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetRectEmpty32 (USER32.500)
|
||||
*/
|
||||
WINBOOL STDCALL SetRectEmpty( LPRECT lprc )
|
||||
{
|
||||
if ( lprc == NULL )
|
||||
return FALSE;
|
||||
lprc->left = lprc->right = lprc->top = lprc->bottom = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//added memcpy and check BD
|
||||
|
||||
/***********************************************************************
|
||||
* CopyRect32 (USER32.62)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
CopyRect(
|
||||
LPRECT lprcDst,
|
||||
CONST RECT *lprcSrc)
|
||||
{
|
||||
if ( lprcDst == NULL || lprcSrc == NULL )
|
||||
return FALSE;
|
||||
*lprcDst = *lprcSrc;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* IsRectEmpty32 (USER32.347)
|
||||
*/
|
||||
WINBOOL STDCALL IsRectEmpty( const RECT *lprc )
|
||||
{
|
||||
if ( lprc == NULL )
|
||||
return TRUE;
|
||||
return ((lprc->left == lprc->right) || (lprc->top == lprc->bottom));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PtInRect32 (USER32.424)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
PtInRect(
|
||||
CONST RECT *lprc,
|
||||
POINT pt)
|
||||
{
|
||||
return ((pt.x >= lprc->left) && (pt.x < lprc->right) &&
|
||||
(pt.y >= lprc->top) && (pt.y < lprc->bottom));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* OffsetRect32 (USER32.406)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
OffsetRect(
|
||||
LPRECT lprc,
|
||||
int dx,
|
||||
int dy)
|
||||
{
|
||||
if ( lprc == NULL )
|
||||
return FALSE;
|
||||
lprc->left += dx;
|
||||
lprc->right += dx;
|
||||
lprc->top += dy;
|
||||
lprc->bottom += dy;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* InflateRect32 (USER32.321)
|
||||
*/
|
||||
WINBOOL STDCALL InflateRect( LPRECT lprc, INT dx, INT dy )
|
||||
{
|
||||
lprc->left -= dx;
|
||||
lprc->top -= dy;
|
||||
lprc->right += dx;
|
||||
lprc->bottom += dy;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* IntersectRect32 (USER32.327)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
IntersectRect(
|
||||
LPRECT lprcDst,
|
||||
CONST RECT *lprcSrc1,
|
||||
CONST RECT *lprcSrc2)
|
||||
{
|
||||
if (IsRectEmpty(lprcSrc1) || IsRectEmpty(lprcSrc2) ||
|
||||
(lprcSrc1->left >= lprcSrc2->right) || (lprcSrc2->left >= lprcSrc1->right) ||
|
||||
(lprcSrc1->top >= lprcSrc2->bottom) || (lprcSrc2->top >= lprcSrc1->bottom))
|
||||
{
|
||||
SetRectEmpty( lprcDst );
|
||||
return FALSE;
|
||||
}
|
||||
lprcDst->left = MAX( lprcSrc1->left, lprcSrc2->left );
|
||||
lprcDst->right = MIN( lprcSrc1->right, lprcSrc2->right );
|
||||
lprcDst->top = MAX( lprcSrc1->top, lprcSrc2->top );
|
||||
lprcDst->bottom = MIN( lprcSrc1->bottom, lprcSrc2->bottom );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* UnionRect32 (USER32.559)
|
||||
*/
|
||||
WINBOOL STDCALL UnionRect( LPRECT lprcDst, const RECT *lprcSrc1,
|
||||
const RECT *lprcSrc2 )
|
||||
{
|
||||
if (IsRectEmpty(lprcSrc1))
|
||||
{
|
||||
if (IsRectEmpty(lprcSrc2))
|
||||
{
|
||||
SetRectEmpty( lprcDst );
|
||||
return FALSE;
|
||||
}
|
||||
else *lprcDst = *lprcSrc2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsRectEmpty(lprcSrc2))
|
||||
*lprcDst = *lprcSrc1;
|
||||
else
|
||||
{
|
||||
lprcDst->left = MIN( lprcSrc1->left, lprcSrc2->left );
|
||||
lprcDst->right = MAX( lprcSrc1->right, lprcSrc2->right );
|
||||
lprcDst->top = MIN( lprcSrc1->top, lprcSrc2->top );
|
||||
lprcDst->bottom = MAX( lprcSrc1->bottom, lprcSrc2->bottom );
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* EqualRect32 (USER32.194)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
EqualRect(
|
||||
CONST RECT *lprc1,
|
||||
CONST RECT *lprc2)
|
||||
{
|
||||
return ((lprc1->left == lprc2->left) && (lprc1->right == lprc2->right) &&
|
||||
(lprc1->top == lprc2->top) && (lprc1->bottom == lprc2->bottom));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SubtractRect32 (USER32.536)
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SubtractRect(
|
||||
LPRECT lprcDst,
|
||||
CONST RECT *lprcSrc1,
|
||||
CONST RECT *lprcSrc2)
|
||||
{
|
||||
RECT tmp;
|
||||
|
||||
if (IsRectEmpty( lprcSrc1 ))
|
||||
{
|
||||
SetRectEmpty( lprcDst );
|
||||
return FALSE;
|
||||
}
|
||||
// changed BD
|
||||
CopyRect(lprcDst,lprcSrc1);
|
||||
|
||||
if (IntersectRect( &tmp, lprcSrc1, lprcSrc2 ))
|
||||
{
|
||||
if (EqualRect( &tmp, lprcDst ))
|
||||
{
|
||||
SetRectEmpty( lprcDst );
|
||||
return FALSE;
|
||||
}
|
||||
if ((tmp.top == lprcDst->top) && (tmp.bottom == lprcDst->bottom))
|
||||
{
|
||||
if (tmp.left == lprcDst->left) lprcDst->left = tmp.right;
|
||||
else if (tmp.right == lprcDst->right) lprcDst->right = tmp.left;
|
||||
}
|
||||
else if ((tmp.left == lprcDst->left) && (tmp.right == lprcDst->right))
|
||||
{
|
||||
if (tmp.top == lprcDst->top) lprcDst->top = tmp.bottom;
|
||||
else if (tmp.bottom == lprcDst->bottom) lprcDst->bottom = tmp.top;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
|
@ -1,160 +0,0 @@
|
|||
/*
|
||||
* Support for system colors
|
||||
*
|
||||
* Copyright David W. Metcalfe, 1993
|
||||
* Copyright Alexandre Julliard, 1994
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/syscolor.h>
|
||||
|
||||
typedef struct _sysco
|
||||
{
|
||||
const char *name;
|
||||
const char *value;
|
||||
} syscol;
|
||||
|
||||
static int DefSysColors[] =
|
||||
{
|
||||
223,223,223, /* COLOR_SCROLLBAR */
|
||||
192,192,192, /* COLOR_BACKGROUND */
|
||||
0,0,128, /* COLOR_ACTIVECAPTION */
|
||||
128,128,128, /* COLOR_INACTIVECAPTION */
|
||||
192,192,192, /* COLOR_MENU */
|
||||
255,255,255, /* COLOR_WINDOW */
|
||||
0,0,0, /* COLOR_WINDOWFRAME */
|
||||
0,0,0, /* COLOR_MENUTEXT */
|
||||
0,0,0, /* COLOR_WINDOWTEXT */
|
||||
255,255,255, /* COLOR_CAPTIONTEXT */
|
||||
192,192,192, /* COLOR_ACTIVEBORDER */
|
||||
192,192,192, /* COLOR_INACTIVEBORDER */
|
||||
128,128,128, /* COLOR_APPWORKSPACE */
|
||||
0,0,128, /* COLOR_HIGHLIGHT */
|
||||
255,255,255, /* COLOR_HIGHLIGHTTEXT */
|
||||
192,192,192, /* COLOR_BTNFACE */
|
||||
128,128,128, /* COLOR_BTNSHADOW */
|
||||
192,192,192, /* COLOR_GRAYTEXT */
|
||||
0,0,0, /* COLOR_BTNTEXT */
|
||||
0,0,0,/* COLOR_INACTIVECAPTIONTEXT */
|
||||
255,255,255, /* COLOR_BTNHIGHLIGHT */
|
||||
0,0,0, /* COLOR_3DDKSHADOW */
|
||||
223,223,223, /* COLOR_3DLIGHT */
|
||||
0,0,0, /* COLOR_INFOTEXT */
|
||||
255,255,192, /* COLOR_INFOBK */
|
||||
184,180,184, /* COLOR_ALTERNATEBTNFACE */
|
||||
0,0,255, /* COLOR_HOTLIGHT */
|
||||
16,132,208, /* COLOR_GRADIENTACTIVECAPTION */
|
||||
184,180,184 /* COLOR_GRADIENTINACTIVECAPTION */
|
||||
};
|
||||
|
||||
//#define NUM_SYS_COLORS (COLOR_GRADIENTINACTIVECAPTION+1)
|
||||
#define NUM_SYS_COLORS 29
|
||||
|
||||
static COLORREF SysColors[NUM_SYS_COLORS];
|
||||
static HBRUSH SysColorBrushes[NUM_SYS_COLORS];
|
||||
static HPEN SysColorPens[NUM_SYS_COLORS];
|
||||
|
||||
static char bSysColorInit = FALSE;
|
||||
|
||||
DWORD STDCALL GetSysColor( INT nIndex )
|
||||
{
|
||||
if ( bSysColorInit == FALSE )
|
||||
SYSCOLOR_Init();
|
||||
if (nIndex >= 0 && nIndex < NUM_SYS_COLORS)
|
||||
return SysColors[nIndex];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* SetSysColors (USER.505)
|
||||
*/
|
||||
WINBOOL STDCALL SetSysColors( INT nChanges, const INT *lpSysColor,
|
||||
const COLORREF *lpColorValues )
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( bSysColorInit == FALSE )
|
||||
SYSCOLOR_Init();
|
||||
for (i = 0; i < nChanges; i++)
|
||||
{
|
||||
SYSCOLOR_SetColor( lpSysColor[i], lpColorValues[i] );
|
||||
}
|
||||
|
||||
/* Send WM_SYSCOLORCHANGE message to all windows */
|
||||
|
||||
SendMessageA( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0 );
|
||||
|
||||
/* Repaint affected portions of all visible windows */
|
||||
|
||||
RedrawWindow( GetDesktopWindow(), NULL, 0,
|
||||
RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
HBRUSH STDCALL GetSysColorBrush( INT index )
|
||||
{
|
||||
if ( bSysColorInit == FALSE )
|
||||
SYSCOLOR_Init();
|
||||
if (0 <= index && index < NUM_SYS_COLORS)
|
||||
return SysColorBrushes[index];
|
||||
|
||||
return GetStockObject(LTGRAY_BRUSH);
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***********************************************************************
|
||||
* GetSysColorPen (Not a Windows API)
|
||||
*
|
||||
* This function is new to the Wine lib -- it does not exist in
|
||||
* Windows. However, it is a natural complement for GetSysColorBrush
|
||||
* in the Win API and is needed quite a bit inside Wine.
|
||||
*/
|
||||
HPEN GetSysColorPen( INT index )
|
||||
{
|
||||
|
||||
if ( bSysColorInit == FALSE )
|
||||
SYSCOLOR_Init();
|
||||
return SysColorPens[index];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* SYSCOLOR_Init
|
||||
*/
|
||||
|
||||
void SYSCOLOR_Init(void)
|
||||
{
|
||||
int i, r, g, b;
|
||||
|
||||
for (i = 0; i < NUM_SYS_COLORS; i++)
|
||||
{
|
||||
r = DefSysColors[i*3];
|
||||
g = DefSysColors[i*3+ 1 ];
|
||||
b = DefSysColors[i*3+ 2 ];
|
||||
SYSCOLOR_SetColor( i, RGB(r,g,b) );
|
||||
}
|
||||
bSysColorInit = TRUE;
|
||||
}
|
||||
|
||||
void SYSCOLOR_SetColor( int index, COLORREF color )
|
||||
{
|
||||
if (index < 0 || index >= NUM_SYS_COLORS) return;
|
||||
SysColors[index] = color;
|
||||
if (SysColorBrushes[index]) DeleteObject( SysColorBrushes[index] );
|
||||
SysColorBrushes[index] = CreateSolidBrush( color );
|
||||
if (SysColorPens[index]) DeleteObject( SysColorPens[index] );
|
||||
SysColorPens[index] = CreatePen( PS_SOLID, 1, color );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
#include <windows.h>
|
||||
#include <user32/text.h>
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
DrawTextA(
|
||||
HDC hDC,LPCSTR lpString,
|
||||
int nCount, LPRECT lpRect, UINT uFormat)
|
||||
{
|
||||
DRAWTEXTPARAMS dtp;
|
||||
dtp.cbSize = sizeof(DRAWTEXTPARAMS);
|
||||
dtp.iTabLength = 0;
|
||||
return TEXT_DrawTextEx(hDC,(void *)lpString, nCount,lpRect,uFormat, &dtp, FALSE);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
DrawTextW(
|
||||
HDC hDC, LPCWSTR lpString,
|
||||
int nCount, LPRECT lpRect, UINT uFormat)
|
||||
{
|
||||
DRAWTEXTPARAMS dtp;
|
||||
dtp.cbSize = sizeof(DRAWTEXTPARAMS);
|
||||
dtp.iTabLength = 0;
|
||||
return TEXT_DrawTextEx(hDC,(void *)lpString,nCount,lpRect,uFormat, &dtp,TRUE);
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetTabbedTextExtentA (USER32.293)
|
||||
*/
|
||||
DWORD
|
||||
STDCALL
|
||||
GetTabbedTextExtentA(HDC hDC, LPCSTR lpString, int nCount, int nTabPositions,
|
||||
LPINT lpnTabStopPositions)
|
||||
{
|
||||
|
||||
return TEXT_TabbedTextOutA( hDC, 0, 0, lpString, nCount, nTabPositions,
|
||||
lpnTabStopPositions,0, FALSE );
|
||||
}
|
||||
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
GetTabbedTextExtentW(HDC hDC, LPCWSTR lpString, int nCount, int nTabPositions,
|
||||
LPINT lpnTabStopPositions)
|
||||
{
|
||||
|
||||
return TEXT_TabbedTextOutW( hDC, 0, 0, lpString, nCount, nTabPositions,
|
||||
lpnTabStopPositions, 0, FALSE );
|
||||
}
|
||||
|
||||
|
||||
LONG
|
||||
STDCALL
|
||||
TabbedTextOutA( HDC hDC, int X, int Y, LPCSTR lpString,
|
||||
int nCount, int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin)
|
||||
{
|
||||
return TEXT_TabbedTextOutA( hDC, X, Y, lpString, nCount, nTabPositions,
|
||||
lpnTabStopPositions, nTabOrigin, TRUE );
|
||||
}
|
||||
|
||||
LONG
|
||||
STDCALL
|
||||
TabbedTextOutW( HDC hDC, int X, int Y, LPCWSTR lpString,
|
||||
int nCount, int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin)
|
||||
{
|
||||
return TEXT_TabbedTextOutW( hDC, 0, 0, lpString, nCount, nTabPositions,
|
||||
lpnTabStopPositions, nTabOrigin, TRUE );
|
||||
}
|
||||
|
|
@ -1,440 +0,0 @@
|
|||
#include <ntos/minmax.h>
|
||||
#define MIN min
|
||||
#define MAX max
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/dce.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/debug.h>
|
||||
|
||||
DCE *firstDCE = 0;
|
||||
HDC defaultDCstate = 0;
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* REGION_UnionRectWithRgn
|
||||
* Adds a rectangle to a HRGN32
|
||||
* A helper used by scroll.c
|
||||
*/
|
||||
WINBOOL REGION_UnionRectWithRgn( HRGN hrgn, const RECT *lpRect )
|
||||
{
|
||||
|
||||
HRGN hRgn;
|
||||
hRgn = CreateRectRgn(lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
|
||||
|
||||
CombineRgn(hrgn,hrgn,hRgn, RGN_DIFF);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DCE_AllocDCE
|
||||
*
|
||||
* Allocate a new DCE.
|
||||
*/
|
||||
DCE *DCE_AllocDCE( struct tagWND * wndPtr, DCE_TYPE type )
|
||||
{
|
||||
DCE * dce;
|
||||
|
||||
|
||||
if (!(dce = HeapAlloc( GetProcessHeap(), 0, sizeof(DCE) ))) return NULL;
|
||||
if (!(dce->hDC = CreateDC( "DISPLAY", NULL, NULL, NULL)))
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, dce );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* store DCE handle in DC hook data field */
|
||||
if ( wndPtr != NULL ) {
|
||||
OffsetWindowOrgEx(dce->hDC,-wndPtr->rectWindow.left, -wndPtr->rectWindow.top, NULL );
|
||||
dce->hwndCurrent = wndPtr->hwndSelf;
|
||||
}
|
||||
else
|
||||
dce->hwndCurrent = NULL;
|
||||
dce->hClipRgn = 0;
|
||||
dce->next = firstDCE;
|
||||
firstDCE = dce;
|
||||
|
||||
|
||||
FillRect(dce->hDC,&(wndPtr->rectWindow),GetStockObject(GRAY_BRUSH));
|
||||
|
||||
#if 0
|
||||
if( type != DCE_CACHE_DC ) /* owned or class DC */
|
||||
{
|
||||
dce->DCXflags = DCX_DCEBUSY;
|
||||
if( wndPtr != NULL )
|
||||
{
|
||||
|
||||
|
||||
if( wndPtr->dwStyle & WS_CLIPCHILDREN ) dce->DCXflags |= DCX_CLIPCHILDREN;
|
||||
if( wndPtr->dwStyle & WS_CLIPSIBLINGS ) dce->DCXflags |= DCX_CLIPSIBLINGS;
|
||||
}
|
||||
//SetHookFlags(dce->hDC,DCHF_INVALIDATEVISRGN);
|
||||
}
|
||||
else dce->DCXflags = DCX_CACHE | DCX_DCEEMPTY;
|
||||
#endif
|
||||
return dce;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DCE_FreeDCE
|
||||
*/
|
||||
DCE* DCE_FreeDCE( DCE *dce )
|
||||
{
|
||||
DCE **ppDCE = &firstDCE;
|
||||
|
||||
if (!dce) return NULL;
|
||||
while (*ppDCE && (*ppDCE != dce)) ppDCE = &(*ppDCE)->next;
|
||||
if (*ppDCE == dce) *ppDCE = dce->next;
|
||||
|
||||
// SetDCHook(dce->hDC, NULL, 0L);
|
||||
|
||||
DeleteDC( dce->hDC );
|
||||
if( dce->hClipRgn && !(dce->DCXflags & DCX_KEEPCLIPRGN) )
|
||||
DeleteObject(dce->hClipRgn);
|
||||
HeapFree( GetProcessHeap(), 0, dce );
|
||||
return *ppDCE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DCE_DeleteClipRgn
|
||||
*/
|
||||
void DCE_DeleteClipRgn( DCE* dce )
|
||||
{
|
||||
dce->DCXflags &= ~(DCX_EXCLUDERGN | DCX_INTERSECTRGN | DCX_WINDOWPAINT);
|
||||
|
||||
if( dce->DCXflags & DCX_KEEPCLIPRGN )
|
||||
dce->DCXflags &= ~DCX_KEEPCLIPRGN;
|
||||
else
|
||||
if( dce->hClipRgn > 1 )
|
||||
DeleteObject( dce->hClipRgn );
|
||||
|
||||
dce->hClipRgn = 0;
|
||||
|
||||
//DPRINT("\trestoring VisRgn\n");
|
||||
|
||||
SelectClipRgn(dce->hDC,NULL);
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DCE_GetVisRect
|
||||
*
|
||||
* Calculate the visible rectangle of a window (i.e. the client or
|
||||
* window area clipped by the client area of all ancestors) in the
|
||||
* corresponding coordinates. Return FALSE if the visible region is empty.
|
||||
*/
|
||||
WINBOOL DCE_GetVisRect( WND *wndPtr, WINBOOL clientArea, RECT *lprect )
|
||||
{
|
||||
*lprect = clientArea ? wndPtr->rectClient : wndPtr->rectWindow;
|
||||
|
||||
if (wndPtr->dwStyle & WS_VISIBLE)
|
||||
{
|
||||
INT xoffset = lprect->left;
|
||||
INT yoffset = lprect->top;
|
||||
|
||||
while (wndPtr->dwStyle & WS_CHILD)
|
||||
{
|
||||
wndPtr = wndPtr->parent;
|
||||
|
||||
if ( (wndPtr->dwStyle & (WS_ICONIC | WS_VISIBLE)) != WS_VISIBLE )
|
||||
goto fail;
|
||||
|
||||
xoffset += wndPtr->rectClient.left;
|
||||
yoffset += wndPtr->rectClient.top;
|
||||
OffsetRect( lprect, wndPtr->rectClient.left,
|
||||
wndPtr->rectClient.top );
|
||||
|
||||
if( (wndPtr->rectClient.left >= wndPtr->rectClient.right) ||
|
||||
(wndPtr->rectClient.top >= wndPtr->rectClient.bottom) ||
|
||||
(lprect->left >= wndPtr->rectClient.right) ||
|
||||
(lprect->right <= wndPtr->rectClient.left) ||
|
||||
(lprect->top >= wndPtr->rectClient.bottom) ||
|
||||
(lprect->bottom <= wndPtr->rectClient.top) )
|
||||
goto fail;
|
||||
|
||||
lprect->left = MAX( lprect->left, wndPtr->rectClient.left );
|
||||
lprect->right = MIN( lprect->right, wndPtr->rectClient.right );
|
||||
lprect->top = MAX( lprect->top, wndPtr->rectClient.top );
|
||||
lprect->bottom = MIN( lprect->bottom, wndPtr->rectClient.bottom );
|
||||
}
|
||||
OffsetRect( lprect, -xoffset, -yoffset );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
fail:
|
||||
SetRectEmpty( lprect );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DCE_AddClipRects
|
||||
*
|
||||
* Go through the linked list of windows from pWndStart to pWndEnd,
|
||||
* adding to the clip region the intersection of the target rectangle
|
||||
* with an offset window rectangle.
|
||||
*/
|
||||
WINBOOL DCE_AddClipRects( WND *pWndStart, WND *pWndEnd,
|
||||
HRGN hrgnClip, LPRECT lpRect, int x, int y )
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
// if( pWndStart->pDriver->pIsSelfClipping( pWndStart ) )
|
||||
// return TRUE; /* The driver itself will do the clipping */
|
||||
|
||||
for (; pWndStart != pWndEnd; pWndStart = pWndStart->next)
|
||||
{
|
||||
if( !(pWndStart->dwStyle & WS_VISIBLE) ) continue;
|
||||
|
||||
rect.left = pWndStart->rectWindow.left + x;
|
||||
rect.top = pWndStart->rectWindow.top + y;
|
||||
rect.right = pWndStart->rectWindow.right + x;
|
||||
rect.bottom = pWndStart->rectWindow.bottom + y;
|
||||
|
||||
if( IntersectRect( &rect, &rect, lpRect ))
|
||||
if(!REGION_UnionRectWithRgn( hrgnClip, &rect ))
|
||||
break;
|
||||
}
|
||||
return (pWndStart == pWndEnd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DCE_GetVisRgn
|
||||
*
|
||||
* Return the visible region of a window, i.e. the client or window area
|
||||
* clipped by the client area of all ancestors, and then optionally
|
||||
* by siblings and children.
|
||||
*/
|
||||
HRGN DCE_GetVisRgn( HWND hwnd, WORD flags )
|
||||
{
|
||||
HRGN hrgnVis = 0;
|
||||
RECT rect;
|
||||
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
||||
|
||||
/* Get visible rectangle and create a region with it. */
|
||||
|
||||
if (wndPtr && DCE_GetVisRect(wndPtr, !(flags & DCX_WINDOW), &rect))
|
||||
{
|
||||
if((hrgnVis = CreateRectRgnIndirect( &rect )))
|
||||
{
|
||||
HRGN hrgnClip = CreateRectRgn( 0, 0, 0, 0 );
|
||||
INT xoffset, yoffset;
|
||||
|
||||
if( hrgnClip )
|
||||
{
|
||||
/* Compute obscured region for the visible rectangle by
|
||||
* clipping children, siblings, and ancestors. Note that
|
||||
* DCE_GetVisRect() returns a rectangle either in client
|
||||
* or in window coordinates (for DCX_WINDOW request). */
|
||||
|
||||
if( (flags & DCX_CLIPCHILDREN) && wndPtr->child )
|
||||
{
|
||||
if( flags & DCX_WINDOW )
|
||||
{
|
||||
/* adjust offsets since child window rectangles are
|
||||
* in client coordinates */
|
||||
|
||||
xoffset = wndPtr->rectClient.left - wndPtr->rectWindow.left;
|
||||
yoffset = wndPtr->rectClient.top - wndPtr->rectWindow.top;
|
||||
}
|
||||
else
|
||||
xoffset = yoffset = 0;
|
||||
|
||||
DCE_AddClipRects( wndPtr->child, NULL, hrgnClip,
|
||||
&rect, xoffset, yoffset );
|
||||
}
|
||||
|
||||
/* sibling window rectangles are in client
|
||||
* coordinates of the parent window */
|
||||
|
||||
if (flags & DCX_WINDOW)
|
||||
{
|
||||
xoffset = -wndPtr->rectWindow.left;
|
||||
yoffset = -wndPtr->rectWindow.top;
|
||||
}
|
||||
else
|
||||
{
|
||||
xoffset = -wndPtr->rectClient.left;
|
||||
yoffset = -wndPtr->rectClient.top;
|
||||
}
|
||||
|
||||
if (flags & DCX_CLIPSIBLINGS && wndPtr->parent )
|
||||
DCE_AddClipRects( wndPtr->parent->child,
|
||||
wndPtr, hrgnClip, &rect, xoffset, yoffset );
|
||||
|
||||
/* Clip siblings of all ancestors that have the
|
||||
* WS_CLIPSIBLINGS style
|
||||
*/
|
||||
|
||||
while (wndPtr->dwStyle & WS_CHILD)
|
||||
{
|
||||
wndPtr = wndPtr->parent;
|
||||
xoffset -= wndPtr->rectClient.left;
|
||||
yoffset -= wndPtr->rectClient.top;
|
||||
if(wndPtr->dwStyle & WS_CLIPSIBLINGS && wndPtr->parent)
|
||||
{
|
||||
DCE_AddClipRects( wndPtr->parent->child, wndPtr,
|
||||
hrgnClip, &rect, xoffset, yoffset );
|
||||
}
|
||||
}
|
||||
|
||||
/* Now once we've got a jumbo clip region we have
|
||||
* to substract it from the visible rectangle.
|
||||
*/
|
||||
|
||||
CombineRgn( hrgnVis, hrgnVis, hrgnClip, RGN_DIFF );
|
||||
DeleteObject( hrgnClip );
|
||||
}
|
||||
else
|
||||
{
|
||||
DeleteObject( hrgnVis );
|
||||
hrgnVis = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
hrgnVis = CreateRectRgn(0, 0, 0, 0); /* empty */
|
||||
return hrgnVis;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DCE_OffsetVisRgn
|
||||
*
|
||||
* Change region from DC-origin relative coordinates to screen coords.
|
||||
*/
|
||||
|
||||
void DCE_OffsetVisRgn( HDC hDC, HRGN hVisRgn )
|
||||
{
|
||||
/*
|
||||
DC *dc;
|
||||
if (!(dc = (DC *) GDI_GetObjPtr( hDC, DC_MAGIC ))) return;
|
||||
|
||||
OffsetRgn( hVisRgn, dc->w.DCOrgX, dc->w.DCOrgY );
|
||||
|
||||
GDI_HEAP_UNLOCK( hDC );
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DCE_ExcludeRgn
|
||||
*
|
||||
* Translate given region from the wnd client to the DC coordinates
|
||||
* and add it to the clipping region.
|
||||
*/
|
||||
INT DCE_ExcludeRgn( HDC hDC, WND* wnd, HRGN hRgn )
|
||||
{
|
||||
POINT pt = {0, 0};
|
||||
DCE *dce = firstDCE;
|
||||
|
||||
while (dce && (dce->hDC != hDC)) dce = dce->next;
|
||||
if( dce )
|
||||
{
|
||||
MapWindowPoints( wnd->hwndSelf, dce->hwndCurrent, &pt, 1);
|
||||
if( dce->DCXflags & DCX_WINDOW )
|
||||
{
|
||||
wnd = WIN_FindWndPtr(dce->hwndCurrent);
|
||||
pt.x += wnd->rectClient.left - wnd->rectWindow.left;
|
||||
pt.y += wnd->rectClient.top - wnd->rectWindow.top;
|
||||
}
|
||||
}
|
||||
else return ERROR;
|
||||
OffsetRgn(hRgn, pt.x, pt.y);
|
||||
|
||||
return ExtSelectClipRgn( hDC, hRgn, RGN_DIFF );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DCE_InvalidateDCE
|
||||
*
|
||||
* It is called from SetWindowPos() - we have to mark as dirty all busy
|
||||
* DCE's for windows that have pWnd->parent as an ansector and whose client
|
||||
* rect intersects with specified update rectangle.
|
||||
*/
|
||||
WINBOOL DCE_InvalidateDCE(WND* pWnd, const RECT* pRectUpdate)
|
||||
{
|
||||
WND* wndScope = pWnd->parent;
|
||||
WINBOOL bRet = FALSE;
|
||||
|
||||
if( wndScope )
|
||||
{
|
||||
DCE *dce;
|
||||
|
||||
DPRINT("scope hwnd = %04x, (%i,%i - %i,%i)\n",
|
||||
wndScope->hwndSelf, pRectUpdate->left,pRectUpdate->top,
|
||||
pRectUpdate->right,pRectUpdate->bottom);
|
||||
// if(TRACE_ON(dc))
|
||||
// DCE_DumpCache();
|
||||
|
||||
/* walk all DCEs and fixup non-empty entries */
|
||||
|
||||
for (dce = firstDCE; (dce); dce = dce->next)
|
||||
{
|
||||
if( !(dce->DCXflags & DCX_DCEEMPTY) )
|
||||
{
|
||||
WND* wndCurrent = WIN_FindWndPtr(dce->hwndCurrent);
|
||||
|
||||
if( wndCurrent && wndCurrent != WIN_GetDesktop() )
|
||||
{
|
||||
WND* wnd = wndCurrent;
|
||||
INT xoffset = 0, yoffset = 0;
|
||||
|
||||
if( (wndCurrent == wndScope) && !(dce->DCXflags & DCX_CLIPCHILDREN) ) continue;
|
||||
|
||||
/* check if DCE window is within the z-order scope */
|
||||
|
||||
for( wnd = wndCurrent; wnd; wnd = wnd->parent )
|
||||
{
|
||||
if( wnd == wndScope )
|
||||
{
|
||||
RECT wndRect;
|
||||
|
||||
wndRect = wndCurrent->rectWindow;
|
||||
|
||||
OffsetRect( &wndRect, xoffset - wndCurrent->rectClient.left,
|
||||
yoffset - wndCurrent->rectClient.top);
|
||||
|
||||
if (pWnd == wndCurrent ||
|
||||
IntersectRect( &wndRect, &wndRect, pRectUpdate ))
|
||||
{
|
||||
if( !(dce->DCXflags & DCX_DCEBUSY) )
|
||||
{
|
||||
/* Don't bother with visible regions of unused DCEs */
|
||||
|
||||
DPRINT("\tpurged %08x dce [%04x]\n",
|
||||
(unsigned)dce, wndCurrent->hwndSelf);
|
||||
|
||||
dce->hwndCurrent = 0;
|
||||
dce->DCXflags &= DCX_CACHE;
|
||||
dce->DCXflags |= DCX_DCEEMPTY;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set dirty bits in the hDC and DCE structs */
|
||||
|
||||
DPRINT("\tfixed up %08x dce [%04x]\n",
|
||||
(unsigned)dce, wndCurrent->hwndSelf);
|
||||
|
||||
dce->DCXflags |= DCX_DCEDIRTY;
|
||||
//SetHookFlags(dce->hDC, DCHF_INVALIDATEVISRGN);
|
||||
bRet = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
xoffset += wnd->rectClient.left;
|
||||
yoffset += wnd->rectClient.top;
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* dce list */
|
||||
}
|
||||
return bRet;
|
||||
}
|
|
@ -1,435 +0,0 @@
|
|||
/*
|
||||
* Default window procedure
|
||||
*
|
||||
* Copyright 1993, 1996 Alexandre Julliard
|
||||
* 1995 Alex Korobka
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/nc.h>
|
||||
#include <user32/heapdup.h>
|
||||
#include <user32/winpos.h>
|
||||
#include <user32/dce.h>
|
||||
#include <user32/sysmetr.h>
|
||||
#include <user32/paint.h>
|
||||
#include <user32/defwnd.h>
|
||||
#include <user32/debug.h>
|
||||
|
||||
|
||||
|
||||
#define WM_CTLCOLOR 0x0019
|
||||
#define WM_ISACTIVEICON 0x0035
|
||||
#define WM_DROPOBJECT 0x022A
|
||||
#define WM_QUERYDROPOBJECT 0x022B
|
||||
|
||||
#define DRAG_FILE 0x454C4946
|
||||
|
||||
/* Last COLOR id */
|
||||
#define COLOR_MAX COLOR_BTNHIGHLIGHT
|
||||
|
||||
/* bits in the dwKeyData */
|
||||
#define KEYDATA_ALT 0x2000
|
||||
#define KEYDATA_PREVSTATE 0x4000
|
||||
|
||||
static short iF10Key = 0;
|
||||
static short iMenuSysKey = 0;
|
||||
|
||||
/***********************************************************************
|
||||
* DEFWND_HandleWindowPosChanged
|
||||
*
|
||||
* Handle the WM_WINDOWPOSCHANGED message.
|
||||
*/
|
||||
void DEFWND_HandleWindowPosChanged( WND *wndPtr, UINT flags )
|
||||
{
|
||||
WPARAM wp = SIZE_RESTORED;
|
||||
|
||||
if (!(flags & SWP_NOCLIENTMOVE))
|
||||
SendMessage( wndPtr->hwndSelf, WM_MOVE, 0,
|
||||
MAKELONG(wndPtr->rectClient.left, wndPtr->rectClient.top));
|
||||
if (!(flags & SWP_NOCLIENTSIZE))
|
||||
{
|
||||
if (wndPtr->dwStyle & WS_MAXIMIZE) wp = SIZE_MAXIMIZED;
|
||||
else if (wndPtr->dwStyle & WS_MINIMIZE) wp = SIZE_MINIMIZED;
|
||||
|
||||
SendMessage( wndPtr->hwndSelf, WM_SIZE, wp,
|
||||
MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left,
|
||||
wndPtr->rectClient.bottom-wndPtr->rectClient.top));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DEFWND_SetText
|
||||
*
|
||||
* Set the window text.
|
||||
*/
|
||||
|
||||
void DEFWND_SetText( WND *wndPtr,const void *text )
|
||||
{
|
||||
if ( wndPtr->class->bUnicode )
|
||||
DEFWND_SetTextW( wndPtr, (LPCWSTR) text );
|
||||
else
|
||||
DEFWND_SetTextA( wndPtr, (LPCSTR) text );
|
||||
|
||||
}
|
||||
|
||||
void DEFWND_SetTextA( WND *wndPtr, LPCSTR text )
|
||||
{
|
||||
if (!text) text = "";
|
||||
if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text );
|
||||
wndPtr->text = (void *)HEAP_strdupA( GetProcessHeap(), 0, text );
|
||||
if ( wndPtr->dwStyle & WS_CAPTION )
|
||||
NC_HandleNCPaint( wndPtr->hwndSelf , (HRGN)1 ); /* Repaint caption */
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DEFWND_SetTextW( WND *wndPtr, LPCWSTR text )
|
||||
{
|
||||
if (!text) text = L"";
|
||||
if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text );
|
||||
wndPtr->text = (void *)HEAP_strdupW( GetProcessHeap(), 0, text );
|
||||
if ( wndPtr->dwStyle & WS_CAPTION )
|
||||
NC_HandleNCPaint( wndPtr->hwndSelf , (HRGN)1 ); /* Repaint caption */
|
||||
|
||||
}
|
||||
/***********************************************************************
|
||||
* DEFWND_ControlColor
|
||||
*
|
||||
* Default colors for control painting.
|
||||
*/
|
||||
HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType )
|
||||
{
|
||||
if( ctlType == CTLCOLOR_SCROLLBAR)
|
||||
{
|
||||
HBRUSH hb = GetSysColorBrush(COLOR_SCROLLBAR);
|
||||
SetBkColor( hDC, RGB(255, 255, 255) );
|
||||
SetTextColor( hDC, RGB(0, 0, 0) );
|
||||
UnrealizeObject( hb );
|
||||
return hb;
|
||||
}
|
||||
|
||||
SetTextColor( hDC, GetSysColor(COLOR_WINDOWTEXT));
|
||||
|
||||
if (TWEAK_WineLook > WIN31_LOOK) {
|
||||
if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX))
|
||||
SetBkColor( hDC, GetSysColor(COLOR_WINDOW) );
|
||||
else {
|
||||
SetBkColor( hDC, GetSysColor(COLOR_3DFACE) );
|
||||
return GetSysColorBrush(COLOR_3DFACE);
|
||||
}
|
||||
}
|
||||
else
|
||||
SetBkColor( hDC, GetSysColor(COLOR_WINDOW) );
|
||||
return GetSysColorBrush(COLOR_WINDOW);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DEFWND_SetRedraw
|
||||
*/
|
||||
void DEFWND_SetRedraw( WND* wndPtr, WPARAM wParam )
|
||||
{
|
||||
WINBOOL bVisible = wndPtr->dwStyle & WS_VISIBLE;
|
||||
|
||||
DPRINT("%04x %i\n", (UINT)wndPtr->hwndSelf, (wParam!=0) );
|
||||
|
||||
if( wParam )
|
||||
{
|
||||
if( !bVisible )
|
||||
{
|
||||
//wndPtr->dwStyle |= WS_VISIBLE;
|
||||
DCE_InvalidateDCE( wndPtr, &wndPtr->rectWindow );
|
||||
}
|
||||
}
|
||||
else if( bVisible )
|
||||
{
|
||||
if( wndPtr->dwStyle & WS_MINIMIZE ) wParam = RDW_VALIDATE;
|
||||
else wParam = RDW_ALLCHILDREN | RDW_VALIDATE;
|
||||
|
||||
PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, 0, wParam, 0 );
|
||||
DCE_InvalidateDCE( wndPtr, &wndPtr->rectWindow );
|
||||
// wndPtr->dwStyle &= ~WS_VISIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DEFWND_DefWinProc
|
||||
*
|
||||
* Default window procedure for messages that are the same in Win and Win.
|
||||
*/
|
||||
LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
POINT pt;
|
||||
switch(msg)
|
||||
{
|
||||
case WM_NCPAINT:
|
||||
return NC_HandleNCPaint( wndPtr->hwndSelf, (HRGN)wParam );
|
||||
|
||||
case WM_NCHITTEST:
|
||||
pt.x = LOWORD(lParam);
|
||||
pt.y = HIWORD(lParam);
|
||||
return NC_HandleNCHitTest( wndPtr->hwndSelf, pt);
|
||||
|
||||
case WM_NCLBUTTONDOWN:
|
||||
return NC_HandleNCLButtonDown( wndPtr, wParam, lParam );
|
||||
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_NCLBUTTONDBLCLK:
|
||||
return NC_HandleNCLButtonDblClk( wndPtr, wParam, lParam );
|
||||
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_NCRBUTTONDOWN:
|
||||
if ((wndPtr->flags & WIN_ISWIN) || (TWEAK_WineLook > WIN31_LOOK))
|
||||
{
|
||||
ClientToScreen(wndPtr->hwndSelf, (LPPOINT)&lParam);
|
||||
MSG_SendMessage( wndPtr, WM_CONTEXTMENU,
|
||||
(WPARAM)wndPtr->hwndSelf,(LPARAM) lParam);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CONTEXTMENU:
|
||||
if( wndPtr->dwStyle & WS_CHILD )
|
||||
SendMessageA( wndPtr->parent->hwndSelf, msg, wParam, lParam );
|
||||
else
|
||||
if (wndPtr->hSysMenu)
|
||||
{ /*
|
||||
TrackPopupMenu(wndPtr->hSysMenu,TPM_LEFTALIGN | TPM_RETURNCMD,LOWORD(lParam),HIWORD(lParam),0,wndPtr->hwndSelf,NULL);
|
||||
DestroyMenu(wndPtr->hSysMenu);
|
||||
*/
|
||||
DPRINT("Fixme Display default popup menu\n");
|
||||
/* Track system popup if click was in the caption area. */
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NCACTIVATE:
|
||||
return NC_HandleNCActivate( wndPtr, wParam );
|
||||
|
||||
case WM_NCDESTROY:
|
||||
if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text );
|
||||
wndPtr->text = NULL;
|
||||
if (wndPtr->pVScroll) HeapFree( GetProcessHeap(), 0, wndPtr->pVScroll );
|
||||
if (wndPtr->pHScroll) HeapFree( GetProcessHeap(), 0, wndPtr->pHScroll );
|
||||
wndPtr->pVScroll = wndPtr->pHScroll = NULL;
|
||||
return 0;
|
||||
|
||||
case WM_PAINTICON:
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc = BeginPaint( wndPtr->hwndSelf, &ps );
|
||||
if( hdc )
|
||||
{
|
||||
if( (wndPtr->dwStyle & WS_MINIMIZE) && wndPtr->class->hIcon )
|
||||
{
|
||||
int x = (wndPtr->rectWindow.right - wndPtr->rectWindow.left -
|
||||
SYSMETRICS_CXICON)/2;
|
||||
int y = (wndPtr->rectWindow.bottom - wndPtr->rectWindow.top -
|
||||
SYSMETRICS_CYICON)/2;
|
||||
DPRINT("Painting class icon: vis rect=(%i,%i - %i,%i)\n",
|
||||
ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom );
|
||||
DrawIcon( hdc, x, y, wndPtr->class->hIcon );
|
||||
}
|
||||
EndPaint( wndPtr->hwndSelf, &ps );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_SETREDRAW:
|
||||
DEFWND_SetRedraw( wndPtr, wParam );
|
||||
return 0;
|
||||
|
||||
case WM_CLOSE:
|
||||
DestroyWindow( wndPtr->hwndSelf );
|
||||
return 0;
|
||||
|
||||
case WM_MOUSEACTIVATE:
|
||||
if (wndPtr->dwStyle & WS_CHILD)
|
||||
{
|
||||
LONG ret = SendMessage( wndPtr->parent->hwndSelf,
|
||||
WM_MOUSEACTIVATE, wParam, lParam );
|
||||
if (ret) return ret;
|
||||
}
|
||||
|
||||
/* Caption clicks are handled by the NC_HandleNCLButtonDown() */
|
||||
return (LOWORD(lParam) == HTCAPTION) ? MA_NOACTIVATE : MA_ACTIVATE;
|
||||
|
||||
case WM_ACTIVATE:
|
||||
if (LOWORD(wParam) != WA_INACTIVE)
|
||||
SetWindowPos(wndPtr->hwndSelf, HWND_TOP, 0, 0, 0, 0,
|
||||
SWP_NOMOVE | SWP_NOSIZE);
|
||||
break;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
case WM_ICONERASEBKGND:
|
||||
{
|
||||
if (!wndPtr->class->hbrBackground) return 0;
|
||||
|
||||
if (wndPtr->class->hbrBackground <= (HBRUSH)(COLOR_MAX+1))
|
||||
{
|
||||
HBRUSH hbrush = CreateSolidBrush(
|
||||
GetSysColor(((DWORD)wndPtr->class->hbrBackground)-1));
|
||||
FillWindow( GetParent(wndPtr->hwndSelf), wndPtr->hwndSelf,
|
||||
(HDC)wParam, hbrush);
|
||||
DeleteObject( hbrush );
|
||||
}
|
||||
else FillWindow( GetParent(wndPtr->hwndSelf), wndPtr->hwndSelf,
|
||||
(HDC)wParam, wndPtr->class->hbrBackground );
|
||||
return 1;
|
||||
}
|
||||
|
||||
case WM_GETDLGCODE:
|
||||
return 0;
|
||||
|
||||
case WM_CTLCOLORMSGBOX:
|
||||
case WM_CTLCOLOREDIT:
|
||||
case WM_CTLCOLORLISTBOX:
|
||||
case WM_CTLCOLORBTN:
|
||||
case WM_CTLCOLORDLG:
|
||||
case WM_CTLCOLORSTATIC:
|
||||
case WM_CTLCOLORSCROLLBAR:
|
||||
return (LRESULT)DEFWND_ControlColor( (HDC)wParam, msg - WM_CTLCOLORMSGBOX );
|
||||
|
||||
case WM_CTLCOLOR:
|
||||
return (LRESULT)DEFWND_ControlColor( (HDC)wParam, HIWORD(lParam) );
|
||||
|
||||
case WM_GETTEXTLENGTH:
|
||||
if (wndPtr->text && wndPtr->class->bUnicode == TRUE)
|
||||
return (LRESULT)lstrlenW(wndPtr->text);
|
||||
else if (wndPtr->text && wndPtr->class->bUnicode == FALSE)
|
||||
return (LRESULT)lstrlenA(wndPtr->text);
|
||||
return 0;
|
||||
|
||||
case WM_SETCURSOR:
|
||||
if (wndPtr->dwStyle & WS_CHILD)
|
||||
if (SendMessage(wndPtr->parent->hwndSelf, WM_SETCURSOR,
|
||||
wParam, lParam))
|
||||
return TRUE;
|
||||
return NC_HandleSetCursor( wndPtr->hwndSelf, wParam, lParam );
|
||||
|
||||
case WM_SYSCOMMAND:
|
||||
pt.x = LOWORD(lParam);
|
||||
pt.y = HIWORD(lParam);
|
||||
return NC_HandleSysCommand( wndPtr->hwndSelf, wParam,pt);
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if(wParam == VK_F10) iF10Key = VK_F10;
|
||||
break;
|
||||
|
||||
case WM_SYSKEYDOWN:
|
||||
if( HIWORD(lParam) & KEYDATA_ALT )
|
||||
{
|
||||
/* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
|
||||
if( wParam == VK_MENU && !iMenuSysKey )
|
||||
iMenuSysKey = 1;
|
||||
else
|
||||
iMenuSysKey = 0;
|
||||
|
||||
iF10Key = 0;
|
||||
|
||||
if( wParam == VK_F4 ) /* try to close the window */
|
||||
{
|
||||
HWND hWnd = WIN_GetTopParent( wndPtr->hwndSelf );
|
||||
wndPtr = WIN_FindWndPtr( hWnd );
|
||||
if( wndPtr && !(wndPtr->class->style & CS_NOCLOSE) )
|
||||
PostMessage( hWnd, WM_SYSCOMMAND, SC_CLOSE, 0 );
|
||||
}
|
||||
}
|
||||
else if( wParam == VK_F10 )
|
||||
iF10Key = 1;
|
||||
else
|
||||
if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
|
||||
SendMessage( wndPtr->hwndSelf, WM_SYSCOMMAND,
|
||||
(WPARAM)SC_KEYMENU, (LPARAM)VK_SPACE);
|
||||
break;
|
||||
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
/* Press and release F10 or ALT */
|
||||
if (((wParam == VK_MENU) && iMenuSysKey) ||
|
||||
((wParam == VK_F10) && iF10Key))
|
||||
SendMessage( WIN_GetTopParent(wndPtr->hwndSelf),
|
||||
WM_SYSCOMMAND, SC_KEYMENU, 0L );
|
||||
iMenuSysKey = iF10Key = 0;
|
||||
break;
|
||||
|
||||
case WM_SYSCHAR:
|
||||
iMenuSysKey = 0;
|
||||
if (wParam == VK_RETURN && (wndPtr->dwStyle & WS_MINIMIZE))
|
||||
{
|
||||
PostMessage( wndPtr->hwndSelf, WM_SYSCOMMAND,
|
||||
(WPARAM)SC_RESTORE, 0L );
|
||||
break;
|
||||
}
|
||||
if ((HIWORD(lParam) & KEYDATA_ALT) && wParam)
|
||||
{
|
||||
if (wParam == VK_TAB || wParam == VK_ESCAPE) break;
|
||||
if (wParam == VK_SPACE && (wndPtr->dwStyle & WS_CHILD))
|
||||
SendMessage( wndPtr->parent->hwndSelf, msg, wParam, lParam );
|
||||
else
|
||||
SendMessage( wndPtr->hwndSelf, WM_SYSCOMMAND,
|
||||
(WPARAM)SC_KEYMENU, (LPARAM)(DWORD)wParam );
|
||||
}
|
||||
else /* check for Ctrl-Esc */
|
||||
if (wParam != VK_ESCAPE) MessageBeep(0);
|
||||
break;
|
||||
|
||||
case WM_SHOWWINDOW:
|
||||
if (!lParam) return 0; /* sent from ShowWindow */
|
||||
if (!(wndPtr->dwStyle & WS_POPUP) || !wndPtr->owner) return 0;
|
||||
if ((wndPtr->dwStyle & WS_VISIBLE) && wParam) return 0;
|
||||
else if (!(wndPtr->dwStyle & WS_VISIBLE) && !wParam) return 0;
|
||||
ShowWindow( wndPtr->hwndSelf, wParam ? SW_SHOWNOACTIVATE : SW_HIDE );
|
||||
break;
|
||||
|
||||
case WM_CANCELMODE:
|
||||
//if (wndPtr->parent == WIN_GetDesktop())
|
||||
//EndMenu();
|
||||
if (GetCapture() == wndPtr->hwndSelf) ReleaseCapture();
|
||||
break;
|
||||
|
||||
case WM_VKEYTOITEM:
|
||||
case WM_CHARTOITEM:
|
||||
return -1;
|
||||
|
||||
case WM_DROPOBJECT:
|
||||
return DRAG_FILE;
|
||||
|
||||
case WM_QUERYDROPOBJECT:
|
||||
if (wndPtr->dwExStyle & WS_EX_ACCEPTFILES) return 1;
|
||||
break;
|
||||
|
||||
case WM_QUERYDRAGICON:
|
||||
{
|
||||
#if 0
|
||||
HICON hIcon=0;
|
||||
UINT len;
|
||||
|
||||
if( (hIcon=wndPtr->class->hCursor) ) return (LRESULT)hIcon;
|
||||
for(len=1; len<64; len++)
|
||||
if((hIcon=LoadIcon(wndPtr->hInstance,MAKEINTRESOURCE(len))))
|
||||
return (LRESULT)hIcon;
|
||||
return (LRESULT)LoadIcon(0,IDI_APPLICATION);
|
||||
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case WM_ISACTIVEICON:
|
||||
return ((wndPtr->flags & WIN_NCACTIVATED) != 0);
|
||||
|
||||
case WM_QUERYOPEN:
|
||||
case WM_QUERYENDSESSION:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* X events handling functions
|
||||
*
|
||||
* Copyright 1993 Alexandre Julliard
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/***********************************************************************
|
||||
* EVENT_WaitNetEvent
|
||||
*
|
||||
* Wait for a network event, optionally sleeping until one arrives.
|
||||
* Return TRUE if an event is pending, FALSE on timeout or error
|
||||
* (for instance lost connection with the server).
|
||||
*/
|
||||
WINBOOL EVENT_WaitNetEvent(WINBOOL sleep, WINBOOL peek)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* EVENT_CheckFocus
|
||||
*/
|
||||
WINBOOL EVENT_CheckFocus(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* X11DRV_EVENT_Pending
|
||||
*/
|
||||
WINBOOL EVENT_Pending()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
UINT EVENT_GetCaptureInfo(void)
|
||||
{
|
||||
}
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
#include <windows.h>
|
||||
#include <user32/heapdup.h>
|
||||
|
||||
LPVOID HEAP_strdupAtoW(HANDLE hHeap,DWORD dwFlags, LPCSTR lpszAsciiString )
|
||||
{
|
||||
int i;
|
||||
INT len = lstrlenA(lpszAsciiString);
|
||||
LPWSTR lpszUnicodeString = HeapAlloc(hHeap, dwFlags, (len + 1)*2 );
|
||||
for(i=0;i<len;i++)
|
||||
lpszUnicodeString[i] = lpszAsciiString[i];
|
||||
lpszUnicodeString[i] = 0;
|
||||
return lpszUnicodeString;
|
||||
}
|
||||
|
||||
|
||||
//FIXME should use multi byte strings instead
|
||||
|
||||
LPVOID HEAP_strdupWtoA(HANDLE hHeap,DWORD dwFlags, LPCWSTR lpszUnicodeString )
|
||||
{
|
||||
int i;
|
||||
INT len = lstrlenW(lpszUnicodeString);
|
||||
LPSTR lpszAsciiString = HeapAlloc(hHeap, dwFlags, (len + 1) );
|
||||
for(i=0;i<len;i++)
|
||||
lpszAsciiString[i] = lpszUnicodeString[i];
|
||||
lpszAsciiString[i] = 0;
|
||||
return lpszAsciiString;
|
||||
}
|
||||
|
||||
//FIXME should use multi byte strings instead
|
||||
|
||||
|
||||
|
||||
int lstrcpynWtoA( LPSTR ptr1, LPWSTR ptr2, int n )
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<n;i++) {
|
||||
ptr1[i] = ptr2[i];
|
||||
if ( ptr1[i] == 0 )
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
int lstrcpynAtoW( LPWSTR ptr1, LPSTR ptr2, int n )
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<n;i++) {
|
||||
ptr1[i] = ptr2[i];
|
||||
if ( ptr1[i] == 0 )
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
int lstrcpyWtoA( LPSTR ptr1, LPWSTR ptr2 )
|
||||
{
|
||||
int n = lstrlenW(ptr2);
|
||||
return lstrcpynWtoA(ptr1,ptr2,n);
|
||||
}
|
||||
|
||||
int lstrcpyAtoW( LPWSTR ptr1, LPSTR ptr2 )
|
||||
{
|
||||
int n = lstrlenA(ptr2);
|
||||
return lstrcpynAtoW(ptr1,ptr2,n);
|
||||
}
|
||||
|
||||
int lpstrncpyA( LPSTR ptr1,LPSTR ptr2, int n)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<n;i++) {
|
||||
ptr1[i] = ptr2[i];
|
||||
if ( ptr1[i] == 0 )
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
int lpstrncpyW( LPWSTR ptr1,LPWSTR ptr2, int n)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<n;i++) {
|
||||
ptr1[i] = ptr2[i];
|
||||
if ( ptr1[i] == 0 )
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
LPSTR HEAP_strdupA(HANDLE hHeap,DWORD dwFlags,LPCSTR ptr)
|
||||
{
|
||||
INT len;
|
||||
LPSTR lpszString;
|
||||
if ( ptr == NULL )
|
||||
return NULL;
|
||||
len = lstrlenA(ptr);
|
||||
lpszString = HeapAlloc(hHeap, dwFlags, (len + 1) );
|
||||
if ( lpszString != NULL )
|
||||
lstrcpyA(lpszString,ptr);
|
||||
|
||||
return lpszString;
|
||||
}
|
||||
LPWSTR HEAP_strdupW(HANDLE hHeap,DWORD dwFlags,LPCWSTR ptr)
|
||||
{
|
||||
INT len = lstrlenW(ptr);
|
||||
LPWSTR lpszString = HeapAlloc(hHeap, dwFlags, (len + 1)*2 );
|
||||
if ( lpszString != NULL )
|
||||
lstrcpyW(lpszString,ptr);
|
||||
|
||||
return lpszString;
|
||||
}
|
||||
|
||||
int HEAP_memset( void *d,int c ,int count)
|
||||
{
|
||||
return memset(d,c,count);
|
||||
}
|
||||
|
||||
int HEAP_memcpy( void *d,void *s,int c)
|
||||
{
|
||||
return memcpy(d,s,c);
|
||||
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,283 +0,0 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include <user32/paint.h>
|
||||
|
||||
/*
|
||||
* Window painting functions
|
||||
*
|
||||
* Copyright 1993, 1994, 1995 Alexandre Julliard
|
||||
*
|
||||
* FIXME: Do not repaint full nonclient area all the time. Instead, compute
|
||||
* intersection with hrgnUpdate (which should be moved from client to
|
||||
* window coords as well, lookup 'the pain' comment in the winpos.c).
|
||||
*/
|
||||
|
||||
/* Last CTLCOLOR id */
|
||||
//#define CTLCOLOR_MAX CTLCOLOR_STATIC
|
||||
|
||||
HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType );
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PAINT_RedrawWindow
|
||||
*
|
||||
* FIXME: Windows uses WM_SYNCPAINT to cut down the number of intertask
|
||||
* SendMessage() calls. This is a comment inside DefWindowProc() source
|
||||
* from 16-bit SDK:
|
||||
*
|
||||
* This message avoids lots of inter-app message traffic
|
||||
* by switching to the other task and continuing the
|
||||
* recursion there.
|
||||
*
|
||||
* wParam = flags
|
||||
* LOWORD(lParam) = hrgnClip
|
||||
* HIWORD(lParam) = hwndSkip (not used; always NULL)
|
||||
*
|
||||
* All in all, a prime candidate for a rewrite.
|
||||
*/
|
||||
WINBOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
|
||||
HRGN hrgnUpdate, UINT flags, UINT control )
|
||||
{
|
||||
WINBOOL bIcon;
|
||||
HRGN hrgn;
|
||||
RECT rectClient;
|
||||
WND* wndPtr;
|
||||
WND **list, **ppWnd;
|
||||
|
||||
if (!hwnd) hwnd = GetDesktopWindow();
|
||||
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
|
||||
|
||||
#ifdef OPTIMIZE
|
||||
if (!WIN_IsWindowDrawable( wndPtr, !(flags & RDW_FRAME) ) )
|
||||
return TRUE; /* No redraw needed */
|
||||
#endif
|
||||
|
||||
bIcon = (wndPtr->dwStyle & WS_MINIMIZE && wndPtr->class->hIcon);
|
||||
|
||||
GetClientRect( hwnd, &rectClient );
|
||||
|
||||
OffsetRect(&rectClient,5,16);
|
||||
|
||||
if (flags & RDW_INVALIDATE) /* Invalidate */
|
||||
{
|
||||
int rgnNotEmpty = COMPLEXREGION;
|
||||
|
||||
if (wndPtr->hrgnUpdate > (HRGN)1) /* Is there already an update region? */
|
||||
{
|
||||
if ((hrgn = hrgnUpdate) == 0)
|
||||
hrgn = CreateRectRgnIndirect( rectUpdate ? rectUpdate :
|
||||
&rectClient );
|
||||
rgnNotEmpty = CombineRgn( wndPtr->hrgnUpdate, wndPtr->hrgnUpdate,
|
||||
hrgn, RGN_OR );
|
||||
if (!hrgnUpdate) DeleteObject( hrgn );
|
||||
}
|
||||
else /* No update region yet */
|
||||
{
|
||||
if (!(wndPtr->flags & WIN_INTERNAL_PAINT))
|
||||
QUEUE_IncPaintCount( wndPtr->hmemTaskQ );
|
||||
if (hrgnUpdate)
|
||||
{
|
||||
wndPtr->hrgnUpdate = CreateRectRgn( 0, 0, 0, 0 );
|
||||
rgnNotEmpty = CombineRgn( wndPtr->hrgnUpdate, hrgnUpdate,
|
||||
0, RGN_COPY );
|
||||
}
|
||||
else wndPtr->hrgnUpdate = CreateRectRgnIndirect( rectUpdate ?
|
||||
rectUpdate : &rectClient );
|
||||
}
|
||||
|
||||
if (flags & RDW_FRAME) wndPtr->flags |= WIN_NEEDS_NCPAINT;
|
||||
|
||||
/* restrict update region to client area (FIXME: correct?) */
|
||||
if (wndPtr->hrgnUpdate)
|
||||
{
|
||||
HRGN clientRgn = CreateRectRgnIndirect( &rectClient );
|
||||
rgnNotEmpty = CombineRgn( wndPtr->hrgnUpdate, clientRgn,
|
||||
wndPtr->hrgnUpdate, RGN_AND );
|
||||
DeleteObject( clientRgn );
|
||||
}
|
||||
|
||||
/* check for bogus update region */
|
||||
if ( rgnNotEmpty == NULLREGION )
|
||||
{
|
||||
wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
|
||||
DeleteObject( wndPtr->hrgnUpdate );
|
||||
wndPtr->hrgnUpdate=0;
|
||||
if (!(wndPtr->flags & WIN_INTERNAL_PAINT))
|
||||
QUEUE_DecPaintCount( wndPtr->hmemTaskQ );
|
||||
}
|
||||
else
|
||||
if (flags & RDW_ERASE) wndPtr->flags |= WIN_NEEDS_ERASEBKGND;
|
||||
flags |= RDW_FRAME; /* Force children frame invalidation */
|
||||
}
|
||||
else if (flags & RDW_VALIDATE) /* Validate */
|
||||
{
|
||||
/* We need an update region in order to validate anything */
|
||||
if (wndPtr->hrgnUpdate > (HRGN)1)
|
||||
{
|
||||
if (!hrgnUpdate && !rectUpdate)
|
||||
{
|
||||
/* Special case: validate everything */
|
||||
DeleteObject( wndPtr->hrgnUpdate );
|
||||
wndPtr->hrgnUpdate = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((hrgn = hrgnUpdate) == 0)
|
||||
hrgn = CreateRectRgnIndirect( rectUpdate );
|
||||
if (CombineRgn( wndPtr->hrgnUpdate, wndPtr->hrgnUpdate,
|
||||
hrgn, RGN_DIFF ) == NULLREGION)
|
||||
{
|
||||
DeleteObject( wndPtr->hrgnUpdate );
|
||||
wndPtr->hrgnUpdate = 0;
|
||||
}
|
||||
if (!hrgnUpdate) DeleteObject( hrgn );
|
||||
}
|
||||
if (!wndPtr->hrgnUpdate) /* No more update region */
|
||||
if (!(wndPtr->flags & WIN_INTERNAL_PAINT))
|
||||
QUEUE_DecPaintCount( wndPtr->hmemTaskQ );
|
||||
}
|
||||
if (flags & RDW_NOFRAME) wndPtr->flags &= ~WIN_NEEDS_NCPAINT;
|
||||
if (flags & RDW_NOERASE) wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
|
||||
}
|
||||
|
||||
/* Set/clear internal paint flag */
|
||||
|
||||
if (flags & RDW_INTERNALPAINT)
|
||||
{
|
||||
if ( wndPtr->hrgnUpdate <= (HRGN)1 && !(wndPtr->flags & WIN_INTERNAL_PAINT))
|
||||
QUEUE_IncPaintCount( wndPtr->hmemTaskQ );
|
||||
wndPtr->flags |= WIN_INTERNAL_PAINT;
|
||||
}
|
||||
else if (flags & RDW_NOINTERNALPAINT)
|
||||
{
|
||||
if ( wndPtr->hrgnUpdate <= (HRGN)1 && (wndPtr->flags & WIN_INTERNAL_PAINT))
|
||||
QUEUE_DecPaintCount( wndPtr->hmemTaskQ );
|
||||
wndPtr->flags &= ~WIN_INTERNAL_PAINT;
|
||||
}
|
||||
|
||||
/* Erase/update window */
|
||||
|
||||
if (flags & RDW_UPDATENOW)
|
||||
{
|
||||
if (wndPtr->hrgnUpdate) /* wm_painticon wparam is 1 */
|
||||
SendMessageA( hwnd, (bIcon) ? WM_PAINTICON : WM_PAINT, bIcon, 0 );
|
||||
}
|
||||
else
|
||||
//if (flags & RDW_ERASENOW)
|
||||
{
|
||||
//if (wndPtr->flags & WIN_NEEDS_NCPAINT)
|
||||
WIN_UpdateNCArea( wndPtr, FALSE);
|
||||
|
||||
//if (wndPtr->flags & WIN_NEEDS_ERASEBKGND)
|
||||
{
|
||||
HDC hdc = GetDCEx( hwnd, wndPtr->hrgnUpdate,
|
||||
DCX_INTERSECTRGN | DCX_USESTYLE |
|
||||
DCX_KEEPCLIPRGN | DCX_WINDOWPAINT |
|
||||
(bIcon ? DCX_WINDOW : 0) );
|
||||
if (hdc)
|
||||
{
|
||||
if (SendMessageA( hwnd, (bIcon) ? WM_ICONERASEBKGND
|
||||
: WM_ERASEBKGND,
|
||||
(WPARAM)hdc, 0 ))
|
||||
wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
|
||||
ReleaseDC( hwnd, hdc );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Recursively process children */
|
||||
|
||||
if (!(flags & RDW_NOCHILDREN) &&
|
||||
((flags & RDW_ALLCHILDREN) || !(wndPtr->dwStyle & WS_CLIPCHILDREN)) &&
|
||||
!(wndPtr->dwStyle & WS_MINIMIZE) )
|
||||
{
|
||||
if ( hrgnUpdate || rectUpdate )
|
||||
{
|
||||
if (!(hrgn = CreateRectRgn( 0, 0, 0, 0 ))) return TRUE;
|
||||
if( !hrgnUpdate )
|
||||
{
|
||||
control |= (RDW_C_DELETEHRGN | RDW_C_USEHRGN);
|
||||
if( !(hrgnUpdate = CreateRectRgnIndirect( rectUpdate )) )
|
||||
{
|
||||
DeleteObject( hrgn );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if( (list = WIN_BuildWinArray( wndPtr, 0, NULL )) )
|
||||
{
|
||||
for (ppWnd = list; *ppWnd; ppWnd++)
|
||||
{
|
||||
wndPtr = *ppWnd;
|
||||
if (!IsWindow(wndPtr->hwndSelf)) continue;
|
||||
if (wndPtr->dwStyle & WS_VISIBLE)
|
||||
{
|
||||
SetRectRgn( hrgn,
|
||||
wndPtr->rectWindow.left, wndPtr->rectWindow.top,
|
||||
wndPtr->rectWindow.right, wndPtr->rectWindow.bottom );
|
||||
if (CombineRgn( hrgn, hrgn, hrgnUpdate, RGN_AND ))
|
||||
{
|
||||
OffsetRgn( hrgn, -wndPtr->rectClient.left,
|
||||
-wndPtr->rectClient.top );
|
||||
PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, hrgn, flags,
|
||||
RDW_C_USEHRGN );
|
||||
}
|
||||
}
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, list );
|
||||
}
|
||||
DeleteObject( hrgn );
|
||||
if (control & RDW_C_DELETEHRGN) DeleteObject( hrgnUpdate );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( (list = WIN_BuildWinArray( wndPtr, 0, NULL )) )
|
||||
{
|
||||
for (ppWnd = list; *ppWnd; ppWnd++)
|
||||
{
|
||||
wndPtr = *ppWnd;
|
||||
if (IsWindow( wndPtr->hwndSelf ))
|
||||
PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, 0, flags, 0 );
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, list );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetControlBrush Not A Win32 API
|
||||
*/
|
||||
HBRUSH GetControlBrush( HWND hwnd, HDC hdc, UINT ctlType )
|
||||
{
|
||||
WND* wndPtr = WIN_FindWndPtr( hwnd );
|
||||
|
||||
if((ctlType <= CTLCOLOR_MAX) && wndPtr )
|
||||
{
|
||||
WND* parent;
|
||||
if( wndPtr->dwStyle & WS_POPUP ) parent = wndPtr->owner;
|
||||
else parent = wndPtr->parent;
|
||||
if( !parent ) parent = wndPtr;
|
||||
return (HBRUSH)PAINT_GetControlBrush( parent->hwndSelf, hwnd, hdc, ctlType );
|
||||
}
|
||||
return (HBRUSH)0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PAINT_GetControlBrush
|
||||
*/
|
||||
HBRUSH PAINT_GetControlBrush( HWND hParent, HWND hWnd, HDC hDC, UINT ctlType )
|
||||
{
|
||||
LOGBRUSH LogBrush;
|
||||
HBRUSH bkgBrush = (HBRUSH)SendMessageA( hParent, WM_CTLCOLORMSGBOX + ctlType,
|
||||
(WPARAM)hDC, (LPARAM)hWnd );
|
||||
if( !GetObject(bkgBrush,sizeof(LOGBRUSH),&LogBrush) )
|
||||
bkgBrush = DEFWND_ControlColor( hDC, ctlType );
|
||||
return bkgBrush;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,707 +0,0 @@
|
|||
/*
|
||||
* Message queues related functions
|
||||
*
|
||||
* Copyright 1993, 1994 Alexandre Julliard
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/queue.h>
|
||||
#include <user32/debug.h>
|
||||
|
||||
|
||||
HWND GetSysModalWindow(void);
|
||||
|
||||
#define MAX_QUEUE_SIZE 120 /* Max. size of a message queue */
|
||||
|
||||
static HQUEUE hFirstQueue = 0;
|
||||
static HQUEUE hExitingQueue = 0;
|
||||
static HQUEUE hmemSysMsgQueue = 0;
|
||||
static MESSAGEQUEUE *sysMsgQueue = NULL;
|
||||
|
||||
static MESSAGEQUEUE *pMouseQueue = NULL; /* Queue for last mouse message */
|
||||
static MESSAGEQUEUE *pKbdQueue = NULL; /* Queue for last kbd message */
|
||||
|
||||
MESSAGEQUEUE *pCursorQueue = NULL;
|
||||
MESSAGEQUEUE *pActiveQueue = NULL;
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_DumpQueue
|
||||
*/
|
||||
void QUEUE_DumpQueue( HQUEUE hQueue )
|
||||
{
|
||||
MESSAGEQUEUE *pq;
|
||||
|
||||
if (!(pq = (MESSAGEQUEUE*) GlobalLock( hQueue )) ||
|
||||
GlobalSize(hQueue) < sizeof(MESSAGEQUEUE)+pq->queueSize*sizeof(QMSG))
|
||||
{
|
||||
DPRINT( "%04x is not a queue handle\n", hQueue );
|
||||
return;
|
||||
}
|
||||
|
||||
DPRINT( "next: %12.4x Intertask SendMessage:\n"
|
||||
"hTask: %11.4x ----------------------\n"
|
||||
"msgSize: %9.4x hWnd: %10.4x\n"
|
||||
"msgCount: %8.4x msg: %11.4x\n"
|
||||
"msgNext: %9.4x wParam: %8.4x\n"
|
||||
"msgFree: %9.4x lParam: %8.8x\n"
|
||||
"qSize: %11.4x lRet: %10.8x\n"
|
||||
"wWinVer: %9.4x ISMH: %10.4x\n"
|
||||
"paints: %10.4x hSendTask: %5.4x\n"
|
||||
"timers: %10.4x hPrevSend: %5.4x\n"
|
||||
"wakeBits: %8.4x\n"
|
||||
"wakeMask: %8.4x\n"
|
||||
"hCurHook: %8.4x\n",
|
||||
pq->next, pq->hTask, pq->msgSize, pq->hWnd,
|
||||
pq->msgCount, pq->msg, pq->nextMessage, pq->wParam,
|
||||
pq->nextFreeMessage, (unsigned)pq->lParam, pq->queueSize,
|
||||
(unsigned)pq->SendMessageReturn, pq->wWinVersion, pq->InSendMessageHandle,
|
||||
pq->wPaintCount, pq->hSendingTask, pq->wTimerCount,
|
||||
pq->hPrevSendingTask, pq->wakeBits, pq->wakeMask, pq->hCurHook);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_WalkQueues
|
||||
*/
|
||||
void QUEUE_WalkQueues(void)
|
||||
{
|
||||
char module[10];
|
||||
HQUEUE hQueue = hFirstQueue;
|
||||
|
||||
DPRINT( "Queue Size Msgs Task\n" );
|
||||
while (hQueue)
|
||||
{
|
||||
MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock( hQueue );
|
||||
if (!queue)
|
||||
{
|
||||
DPRINT( "Bad queue handle %04x\n", hQueue );
|
||||
return;
|
||||
}
|
||||
// if (!GetModuleFileName( queue->hTask, module, sizeof(module )))
|
||||
// strcpy( module, "???" );
|
||||
// DPRINT( "%04x %5d %4d %04x %s\n", hQueue, queue->msgSize,
|
||||
// queue->msgCount, queue->hTask, module );
|
||||
hQueue = queue->next;
|
||||
}
|
||||
DPRINT( "\n" );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_IsExitingQueue
|
||||
*/
|
||||
WINBOOL QUEUE_IsExitingQueue( HQUEUE hQueue )
|
||||
{
|
||||
return FALSE;
|
||||
// return (hExitingQueue && (hQueue == hExitingQueue));
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_SetExitingQueue
|
||||
*/
|
||||
void QUEUE_SetExitingQueue( HQUEUE hQueue )
|
||||
{
|
||||
hExitingQueue = hQueue;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_CreateMsgQueue
|
||||
*
|
||||
* Creates a message queue. Doesn't link it into queue list!
|
||||
*/
|
||||
HQUEUE QUEUE_CreateMsgQueue( int size )
|
||||
{
|
||||
HQUEUE hQueue;
|
||||
MESSAGEQUEUE * msgQueue;
|
||||
int queueSize;
|
||||
//TDB *pTask = (TDB *)GlobalLock( GetCurrentTask() );
|
||||
|
||||
DPRINT("Creating message queue...\n");
|
||||
|
||||
queueSize = sizeof(MESSAGEQUEUE) + size * sizeof(QMSG);
|
||||
if (!(hQueue = GlobalAlloc( GMEM_FIXED | GMEM_ZEROINIT, queueSize )))
|
||||
return 0;
|
||||
msgQueue = (MESSAGEQUEUE *) GlobalLock( hQueue );
|
||||
msgQueue->self = hQueue;
|
||||
msgQueue->msgSize = sizeof(QMSG);
|
||||
msgQueue->queueSize = size;
|
||||
msgQueue->wakeBits = msgQueue->changeBits = QS_SMPARAMSFREE;
|
||||
//msgQueue->wWinVersion = pTask ? pTask->version : 0;
|
||||
GlobalUnlock( hQueue );
|
||||
return hQueue;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_DeleteMsgQueue
|
||||
*
|
||||
* Unlinks and deletes a message queue.
|
||||
*
|
||||
* Note: We need to mask asynchronous events to make sure PostMessage works
|
||||
* even in the signal handler.
|
||||
*/
|
||||
WINBOOL QUEUE_DeleteMsgQueue( HQUEUE hQueue )
|
||||
{
|
||||
MESSAGEQUEUE * msgQueue = (MESSAGEQUEUE*)GlobalLock(hQueue);
|
||||
HQUEUE senderQ;
|
||||
HQUEUE *pPrev;
|
||||
|
||||
DPRINT("Deleting message queue %04x\n", hQueue);
|
||||
|
||||
if (!hQueue || !msgQueue)
|
||||
{
|
||||
DPRINT( "invalid argument.\n");
|
||||
return 0;
|
||||
}
|
||||
if( pCursorQueue == msgQueue ) pCursorQueue = NULL;
|
||||
if( pActiveQueue == msgQueue ) pActiveQueue = NULL;
|
||||
|
||||
/* flush sent messages */
|
||||
senderQ = msgQueue->hSendingTask;
|
||||
while( senderQ )
|
||||
{
|
||||
MESSAGEQUEUE* sq = (MESSAGEQUEUE*)GlobalLock(senderQ);
|
||||
if( !sq ) break;
|
||||
sq->SendMessageReturn = 0L;
|
||||
QUEUE_SetWakeBit( sq, QS_SMRESULT );
|
||||
senderQ = sq->hPrevSendingTask;
|
||||
}
|
||||
|
||||
SIGNAL_MaskAsyncEvents( TRUE );
|
||||
|
||||
pPrev = &hFirstQueue;
|
||||
while (*pPrev && (*pPrev != hQueue))
|
||||
{
|
||||
MESSAGEQUEUE *msgQ = (MESSAGEQUEUE*)GlobalLock(*pPrev);
|
||||
pPrev = &msgQ->next;
|
||||
}
|
||||
if (*pPrev) *pPrev = msgQueue->next;
|
||||
msgQueue->self = 0;
|
||||
|
||||
SIGNAL_MaskAsyncEvents( FALSE );
|
||||
|
||||
GlobalFree( hQueue );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_CreateSysMsgQueue
|
||||
*
|
||||
* Create the system message queue, and set the double-click speed.
|
||||
* Must be called only once.
|
||||
*/
|
||||
WINBOOL QUEUE_CreateSysMsgQueue( int size )
|
||||
{
|
||||
if (size > MAX_QUEUE_SIZE) size = MAX_QUEUE_SIZE;
|
||||
else if (size <= 0) size = 1;
|
||||
if (!(hmemSysMsgQueue = QUEUE_CreateMsgQueue( size ))) return FALSE;
|
||||
sysMsgQueue = (MESSAGEQUEUE *) GlobalLock( hmemSysMsgQueue );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_GetSysQueue
|
||||
*/
|
||||
MESSAGEQUEUE *QUEUE_GetSysQueue(void)
|
||||
{
|
||||
return sysMsgQueue;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_Signal
|
||||
*/
|
||||
|
||||
void QUEUE_Signal( HTASK hTask )
|
||||
{
|
||||
#if 0
|
||||
PDB32 *pdb;
|
||||
THREAD_ENTRY *entry;
|
||||
|
||||
TDB *pTask = (TDB *)GlobalLock( hTask );
|
||||
if ( !pTask ) return;
|
||||
|
||||
/* Wake up thread waiting for message */
|
||||
SetEvent( pTask->thdb->event );
|
||||
|
||||
PostEvent( hTask );
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_Wait
|
||||
*/
|
||||
static void QUEUE_Wait( DWORD wait_mask )
|
||||
{
|
||||
#if 0
|
||||
if ( THREAD_IsWin16( THREAD_Current() ) )
|
||||
WaitEvent( 0 );
|
||||
else
|
||||
{
|
||||
DPRINT( "current task is 32-bit, calling SYNC_DoWait\n");
|
||||
MsgWaitForMultipleObjects( 0, NULL, FALSE, INFINITE32, wait_mask );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_SetWakeBit
|
||||
*
|
||||
* See "Windows Internals", p.449
|
||||
*/
|
||||
void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit )
|
||||
{
|
||||
DPRINT("queue = %04x (wm=%04x), bit = %04x\n",
|
||||
queue->self, queue->wakeMask, bit );
|
||||
|
||||
if (bit & QS_MOUSE) pMouseQueue = queue;
|
||||
if (bit & QS_KEY) pKbdQueue = queue;
|
||||
queue->changeBits |= bit;
|
||||
queue->wakeBits |= bit;
|
||||
if (queue->wakeMask & bit)
|
||||
{
|
||||
queue->wakeMask = 0;
|
||||
QUEUE_Signal( queue->hTask );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_ClearWakeBit
|
||||
*/
|
||||
void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit )
|
||||
{
|
||||
queue->changeBits &= ~bit;
|
||||
queue->wakeBits &= ~bit;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_WaitBits
|
||||
*
|
||||
* See "Windows Internals", p.447
|
||||
*/
|
||||
void QUEUE_WaitBits( WORD bits )
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
|
||||
DPRINT("q %04x waiting for %04x\n", GetFastQueue(), bits);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (!(queue = (MESSAGEQUEUE *)( GetFastQueue() ))) return;
|
||||
|
||||
if (queue->changeBits & bits)
|
||||
{
|
||||
/* One of the bits is set; we can return */
|
||||
queue->wakeMask = 0;
|
||||
return;
|
||||
}
|
||||
if (queue->wakeBits & QS_SENDMESSAGE)
|
||||
{
|
||||
/* Process the sent message immediately */
|
||||
|
||||
queue->wakeMask = 0;
|
||||
QUEUE_ReceiveMessage( queue );
|
||||
continue; /* nested sm crux */
|
||||
}
|
||||
|
||||
queue->wakeMask = bits | QS_SENDMESSAGE;
|
||||
if(queue->changeBits & bits) continue;
|
||||
|
||||
DPRINT("%04x) wakeMask is %04x, waiting\n", queue->self, queue->wakeMask);
|
||||
|
||||
QUEUE_Wait( queue->wakeMask );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_ReceiveMessage
|
||||
*
|
||||
* This routine is called when a sent message is waiting for the queue.
|
||||
*/
|
||||
void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue )
|
||||
{
|
||||
MESSAGEQUEUE *senderQ = NULL;
|
||||
HQUEUE prevSender = 0;
|
||||
QSMCTRL* prevCtrlPtr = NULL;
|
||||
LRESULT result = 0;
|
||||
|
||||
DPRINT( "ReceiveMessage, queue %04x\n", queue->self );
|
||||
if (!(queue->wakeBits & QS_SENDMESSAGE) ||
|
||||
!(senderQ = (MESSAGEQUEUE*)GlobalLock( queue->hSendingTask)))
|
||||
{ DPRINT("\trcm: nothing to do\n"); return; }
|
||||
|
||||
if( !senderQ->hPrevSendingTask )
|
||||
QUEUE_ClearWakeBit( queue, QS_SENDMESSAGE ); /* no more sent messages */
|
||||
|
||||
/* Save current state on stack */
|
||||
prevSender = queue->InSendMessageHandle;
|
||||
prevCtrlPtr = queue->smResultCurrent;
|
||||
|
||||
/* Remove sending queue from the list */
|
||||
queue->InSendMessageHandle = queue->hSendingTask;
|
||||
queue->smResultCurrent = senderQ->smResultInit;
|
||||
queue->hSendingTask = senderQ->hPrevSendingTask;
|
||||
|
||||
DPRINT( "\trcm: smResultCurrent = %08x, prevCtrl = %08x\n",
|
||||
(unsigned)queue->smResultCurrent, (unsigned)prevCtrlPtr );
|
||||
QUEUE_SetWakeBit( senderQ, QS_SMPARAMSFREE );
|
||||
|
||||
DPRINT( "\trcm: calling wndproc - %04x %04x %04x%04x %08x\n",
|
||||
senderQ->hWnd, senderQ->msg, senderQ->wParamHigh,
|
||||
senderQ->wParam, (unsigned)senderQ->lParam );
|
||||
|
||||
if (IsWindow( senderQ->hWnd ))
|
||||
{
|
||||
WND *wndPtr = WIN_FindWndPtr( senderQ->hWnd );
|
||||
DWORD extraInfo = queue->GetMessageExtraInfoVal;
|
||||
queue->GetMessageExtraInfoVal = senderQ->GetMessageExtraInfoVal;
|
||||
|
||||
if (senderQ->flags & QUEUE_SM_ASCII)
|
||||
{
|
||||
WPARAM wParam = MAKELONG( senderQ->wParam, senderQ->wParamHigh );
|
||||
DPRINT( "\trcm: msg is Win32\n" );
|
||||
if (senderQ->flags & QUEUE_SM_UNICODE)
|
||||
result = CallWindowProcW( wndPtr->winproc,
|
||||
senderQ->hWnd, senderQ->msg,
|
||||
wParam, senderQ->lParam );
|
||||
else
|
||||
result = CallWindowProcA( wndPtr->winproc,
|
||||
senderQ->hWnd, senderQ->msg,
|
||||
wParam, senderQ->lParam );
|
||||
}
|
||||
else /* Win16 message */
|
||||
result = CallWindowProc( (WNDPROC)wndPtr->winproc,
|
||||
senderQ->hWnd, senderQ->msg,
|
||||
senderQ->wParam, senderQ->lParam );
|
||||
|
||||
queue->GetMessageExtraInfoVal = extraInfo; /* Restore extra info */
|
||||
DPRINT("\trcm: result = %08x\n", (unsigned)result );
|
||||
}
|
||||
else DPRINT( "\trcm: bad hWnd\n");
|
||||
|
||||
/* Return the result to the sender task */
|
||||
ReplyMessage( result );
|
||||
|
||||
queue->InSendMessageHandle = prevSender;
|
||||
queue->smResultCurrent = prevCtrlPtr;
|
||||
|
||||
DPRINT("done!\n");
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_FlushMessage
|
||||
*
|
||||
* Try to reply to all pending sent messages on exit.
|
||||
*/
|
||||
void QUEUE_FlushMessages( HQUEUE hQueue )
|
||||
{
|
||||
MESSAGEQUEUE *queue = (MESSAGEQUEUE*)GlobalLock( hQueue );
|
||||
|
||||
if( queue )
|
||||
{
|
||||
MESSAGEQUEUE *senderQ = (MESSAGEQUEUE*)GlobalLock( queue->hSendingTask);
|
||||
QSMCTRL* CtrlPtr = queue->smResultCurrent;
|
||||
|
||||
DPRINT("Flushing queue %04x:\n", hQueue );
|
||||
|
||||
while( senderQ )
|
||||
{
|
||||
if( !CtrlPtr )
|
||||
CtrlPtr = senderQ->smResultInit;
|
||||
|
||||
DPRINT("\tfrom queue %04x, smResult %08x\n", queue->hSendingTask, (unsigned)CtrlPtr );
|
||||
|
||||
if( !(queue->hSendingTask = senderQ->hPrevSendingTask) )
|
||||
QUEUE_ClearWakeBit( queue, QS_SENDMESSAGE );
|
||||
|
||||
QUEUE_SetWakeBit( senderQ, QS_SMPARAMSFREE );
|
||||
|
||||
queue->smResultCurrent = CtrlPtr;
|
||||
// while( senderQ->wakeBits & QS_SMRESULT ) OldYield();
|
||||
|
||||
while( senderQ->wakeBits & QS_SMRESULT ) Sleep(100);
|
||||
|
||||
senderQ->SendMessageReturn = 0;
|
||||
senderQ->smResult = queue->smResultCurrent;
|
||||
QUEUE_SetWakeBit( senderQ, QS_SMRESULT);
|
||||
|
||||
senderQ = (MESSAGEQUEUE*)GlobalLock( queue->hSendingTask);
|
||||
CtrlPtr = NULL;
|
||||
}
|
||||
queue->InSendMessageHandle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_AddMsg
|
||||
*
|
||||
* Add a message to the queue. Return FALSE if queue is full.
|
||||
*/
|
||||
WINBOOL QUEUE_AddMsg( HQUEUE hQueue, MSG * msg, DWORD extraInfo )
|
||||
{
|
||||
int pos;
|
||||
MESSAGEQUEUE *msgQueue;
|
||||
|
||||
SIGNAL_MaskAsyncEvents( TRUE );
|
||||
|
||||
if (!(msgQueue = (MESSAGEQUEUE *)GlobalLock( hQueue ))) return FALSE;
|
||||
pos = msgQueue->nextFreeMessage;
|
||||
|
||||
/* Check if queue is full */
|
||||
if ((pos == msgQueue->nextMessage) && (msgQueue->msgCount > 0))
|
||||
{
|
||||
SIGNAL_MaskAsyncEvents( FALSE );
|
||||
DPRINT("Queue is full!\n" );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Store message */
|
||||
msgQueue->messages[pos].msg = *msg;
|
||||
msgQueue->messages[pos].extraInfo = extraInfo;
|
||||
if (pos < msgQueue->queueSize-1) pos++;
|
||||
else pos = 0;
|
||||
msgQueue->nextFreeMessage = pos;
|
||||
msgQueue->msgCount++;
|
||||
|
||||
SIGNAL_MaskAsyncEvents( FALSE );
|
||||
|
||||
QUEUE_SetWakeBit( msgQueue, QS_POSTMESSAGE );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_FindMsg
|
||||
*
|
||||
* Find a message matching the given parameters. Return -1 if none available.
|
||||
*/
|
||||
int QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND hwnd, int first, int last )
|
||||
{
|
||||
int i, pos = msgQueue->nextMessage;
|
||||
|
||||
DPRINT("hwnd=%04x pos=%d\n", hwnd, pos );
|
||||
|
||||
if (!msgQueue->msgCount) return -1;
|
||||
if (!hwnd && !first && !last) return pos;
|
||||
|
||||
for (i = 0; i < msgQueue->msgCount; i++)
|
||||
{
|
||||
MSG * msg = &msgQueue->messages[pos].msg;
|
||||
|
||||
if (!hwnd || (msg->hwnd == hwnd))
|
||||
{
|
||||
if (!first && !last) return pos;
|
||||
if ((msg->message >= first) && (msg->message <= last)) return pos;
|
||||
}
|
||||
if (pos < msgQueue->queueSize-1) pos++;
|
||||
else pos = 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_RemoveMsg
|
||||
*
|
||||
* Remove a message from the queue (pos must be a valid position).
|
||||
*/
|
||||
void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos )
|
||||
{
|
||||
SIGNAL_MaskAsyncEvents( TRUE );
|
||||
|
||||
if (pos >= msgQueue->nextMessage)
|
||||
{
|
||||
for ( ; pos > msgQueue->nextMessage; pos--)
|
||||
msgQueue->messages[pos] = msgQueue->messages[pos-1];
|
||||
msgQueue->nextMessage++;
|
||||
if (msgQueue->nextMessage >= msgQueue->queueSize)
|
||||
msgQueue->nextMessage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( ; pos < msgQueue->nextFreeMessage; pos++)
|
||||
msgQueue->messages[pos] = msgQueue->messages[pos+1];
|
||||
if (msgQueue->nextFreeMessage) msgQueue->nextFreeMessage--;
|
||||
else msgQueue->nextFreeMessage = msgQueue->queueSize-1;
|
||||
}
|
||||
msgQueue->msgCount--;
|
||||
if (!msgQueue->msgCount) msgQueue->wakeBits &= ~QS_POSTMESSAGE;
|
||||
|
||||
SIGNAL_MaskAsyncEvents( FALSE );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_WakeSomeone
|
||||
*
|
||||
* Wake a queue upon reception of a hardware event.
|
||||
*/
|
||||
static void QUEUE_WakeSomeone( UINT message )
|
||||
{
|
||||
WND* wndPtr = NULL;
|
||||
WORD wakeBit;
|
||||
HWND hwnd;
|
||||
MESSAGEQUEUE *queue = pCursorQueue;
|
||||
|
||||
if( (message >= WM_KEYFIRST) && (message <= WM_KEYLAST) )
|
||||
{
|
||||
wakeBit = QS_KEY;
|
||||
if( pActiveQueue ) queue = pActiveQueue;
|
||||
}
|
||||
else
|
||||
{
|
||||
wakeBit = (message == WM_MOUSEMOVE) ? QS_MOUSEMOVE : QS_MOUSEBUTTON;
|
||||
if( (hwnd = GetCapture()) )
|
||||
if( (wndPtr = WIN_FindWndPtr( hwnd )) )
|
||||
queue = (MESSAGEQUEUE *)GlobalLock( wndPtr->hmemTaskQ );
|
||||
}
|
||||
|
||||
if( (hwnd = GetSysModalWindow()) )
|
||||
if( (wndPtr = WIN_FindWndPtr( hwnd )) )
|
||||
queue = (MESSAGEQUEUE *)GlobalLock( wndPtr->hmemTaskQ );
|
||||
|
||||
if( !queue )
|
||||
{
|
||||
queue = GlobalLock( hFirstQueue );
|
||||
while( queue )
|
||||
{
|
||||
if (queue->wakeMask & wakeBit) break;
|
||||
queue = GlobalLock( queue->next );
|
||||
}
|
||||
if( !queue )
|
||||
{
|
||||
DPRINT( "couldn't find queue\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QUEUE_SetWakeBit( queue, wakeBit );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* hardware_event
|
||||
*
|
||||
* Add an event to the system message queue.
|
||||
* Note: the position is relative to the desktop window.
|
||||
*/
|
||||
void hardware_event( WORD message, WORD wParam, LONG lParam,
|
||||
int xPos, int yPos, DWORD time, DWORD extraInfo )
|
||||
{
|
||||
MSG *msg;
|
||||
int pos;
|
||||
|
||||
if (!sysMsgQueue) return;
|
||||
pos = sysMsgQueue->nextFreeMessage;
|
||||
|
||||
/* Merge with previous event if possible */
|
||||
|
||||
if ((message == WM_MOUSEMOVE) && sysMsgQueue->msgCount)
|
||||
{
|
||||
if (pos > 0) pos--;
|
||||
else pos = sysMsgQueue->queueSize - 1;
|
||||
msg = &sysMsgQueue->messages[pos].msg;
|
||||
if ((msg->message == message) && (msg->wParam == wParam))
|
||||
sysMsgQueue->msgCount--; /* Merge events */
|
||||
else
|
||||
pos = sysMsgQueue->nextFreeMessage; /* Don't merge */
|
||||
}
|
||||
|
||||
/* Check if queue is full */
|
||||
|
||||
if ((pos == sysMsgQueue->nextMessage) && sysMsgQueue->msgCount)
|
||||
{
|
||||
/* Queue is full, beep (but not on every mouse motion...) */
|
||||
if (message != WM_MOUSEMOVE) MessageBeep(0);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Store message */
|
||||
|
||||
msg = &sysMsgQueue->messages[pos].msg;
|
||||
msg->hwnd = 0;
|
||||
msg->message = message;
|
||||
msg->wParam = wParam;
|
||||
msg->lParam = lParam;
|
||||
msg->time = time;
|
||||
msg->pt.x = xPos & 0xffff;
|
||||
msg->pt.y = yPos & 0xffff;
|
||||
sysMsgQueue->messages[pos].extraInfo = extraInfo;
|
||||
if (pos < sysMsgQueue->queueSize - 1) pos++;
|
||||
else pos = 0;
|
||||
sysMsgQueue->nextFreeMessage = pos;
|
||||
sysMsgQueue->msgCount++;
|
||||
QUEUE_WakeSomeone( message );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_GetQueueTask
|
||||
*/
|
||||
HTASK QUEUE_GetQueueTask( HQUEUE hQueue )
|
||||
{
|
||||
MESSAGEQUEUE *queue = GlobalLock( hQueue );
|
||||
return (queue) ? queue->hTask : 0 ;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_IncPaintCount
|
||||
*/
|
||||
void QUEUE_IncPaintCount( HQUEUE hQueue )
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
|
||||
if (!(queue = (MESSAGEQUEUE *)GlobalLock( hQueue ))) return;
|
||||
queue->wPaintCount++;
|
||||
QUEUE_SetWakeBit( queue, QS_PAINT );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_DecPaintCount
|
||||
*/
|
||||
void QUEUE_DecPaintCount( HQUEUE hQueue )
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
|
||||
if (!(queue = (MESSAGEQUEUE *)GlobalLock( hQueue ))) return;
|
||||
queue->wPaintCount--;
|
||||
if (!queue->wPaintCount) queue->wakeBits &= ~QS_PAINT;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_IncTimerCount
|
||||
*/
|
||||
void QUEUE_IncTimerCount( HQUEUE hQueue )
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
|
||||
if (!(queue = (MESSAGEQUEUE *)GlobalLock( hQueue ))) return;
|
||||
queue->wTimerCount++;
|
||||
QUEUE_SetWakeBit( queue, QS_TIMER );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_DecTimerCount
|
||||
*/
|
||||
void QUEUE_DecTimerCount( HQUEUE hQueue )
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
|
||||
if (!(queue = (MESSAGEQUEUE *)GlobalLock( hQueue ))) return;
|
||||
queue->wTimerCount--;
|
||||
if (!queue->wTimerCount) queue->wakeBits &= ~QS_TIMER;
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#include <windows.h>
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +0,0 @@
|
|||
#include <windows.h>
|
||||
|
||||
void SIGNAL_MaskAsyncEvents( WINBOOL flag )
|
||||
{
|
||||
// sigprocmask( (flag) ? SIG_BLOCK : SIG_UNBLOCK , &async_signal_set, NULL);
|
||||
}
|
|
@ -1,720 +0,0 @@
|
|||
/*
|
||||
* text functions
|
||||
*
|
||||
* Copyright 1993, 1994 Alexandre Julliard
|
||||
*
|
||||
*/
|
||||
|
||||
//#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <user32/text.h>
|
||||
|
||||
|
||||
|
||||
|
||||
int tabstop;
|
||||
int tabwidth;
|
||||
int spacewidth;
|
||||
int prefix_offset;
|
||||
/*
|
||||
typedef struct {
|
||||
UINT cbSize;
|
||||
int iTabLength;
|
||||
int iLeftMargin;
|
||||
int iRightMargin;
|
||||
UINT uiLengthDrawn;
|
||||
} DRAWTEXTPARAMS, FAR *LPDRAWTEXTPARAMS;
|
||||
*/
|
||||
|
||||
int TEXT_DrawTextEx(HDC hDC,void *strPtr,int nCount,LPRECT lpRect,UINT uFormat,LPDRAWTEXTPARAMS dtp,WINBOOL Unicode )
|
||||
{
|
||||
SIZE size;
|
||||
int line[1024];
|
||||
int len, lh, count=nCount;
|
||||
int prefix_x = 0;
|
||||
int prefix_end = 0;
|
||||
TEXTMETRIC tm;
|
||||
int x = lpRect->left, y = lpRect->top;
|
||||
int width = lpRect->right - lpRect->left;
|
||||
int max_width = 0;
|
||||
|
||||
//TRACE(text,"%s, %d , [(%d,%d),(%d,%d)]\n",
|
||||
// debugstr_an (lpString, count), count,
|
||||
// lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
|
||||
|
||||
if (count == -1) {
|
||||
if ( Unicode )
|
||||
count = lstrlenW(strPtr);
|
||||
else
|
||||
count = lstrlenA(strPtr);
|
||||
}
|
||||
if ( Unicode )
|
||||
GetTextMetricsW(hDC, &tm);
|
||||
else
|
||||
GetTextMetricsA(hDC, &tm);
|
||||
|
||||
if (uFormat & DT_EXTERNALLEADING)
|
||||
lh = tm.tmHeight + tm.tmExternalLeading;
|
||||
else
|
||||
lh = tm.tmHeight;
|
||||
|
||||
if (uFormat & DT_TABSTOP)
|
||||
tabstop = uFormat >> 8;
|
||||
|
||||
|
||||
if (uFormat & DT_EXPANDTABS)
|
||||
{
|
||||
GetTextExtentPointA(hDC, " ", 1, &size);
|
||||
spacewidth = size.cx;
|
||||
if ( dtp->iTabLength == 0 ) {
|
||||
GetTextExtentPointA(hDC, "o", 1, &size);
|
||||
tabwidth = size.cx * tabstop;
|
||||
}
|
||||
else
|
||||
tabwidth = tabstop * dtp->iTabLength;
|
||||
|
||||
}
|
||||
|
||||
if (uFormat & DT_CALCRECT) uFormat |= DT_NOCLIP;
|
||||
|
||||
do
|
||||
{
|
||||
prefix_offset = -1;
|
||||
if ( Unicode )
|
||||
strPtr = TEXT_NextLineW(hDC, strPtr, &count, (LPWSTR)line, &len, width, uFormat);
|
||||
else
|
||||
strPtr = TEXT_NextLineA(hDC, strPtr, &count, (LPSTR)line, &len, width, uFormat);
|
||||
|
||||
if ( Unicode ) {
|
||||
if (prefix_offset != -1)
|
||||
{
|
||||
GetTextExtentPointW(hDC, (LPWSTR)line, prefix_offset, &size);
|
||||
prefix_x = size.cx;
|
||||
GetTextExtentPointW(hDC, (LPWSTR)line, prefix_offset + 1, &size);
|
||||
prefix_end = size.cx - 1;
|
||||
}
|
||||
if (!GetTextExtentPointW(hDC, (LPWSTR)line, len, &size))
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if (prefix_offset != -1)
|
||||
{
|
||||
GetTextExtentPointA(hDC, (LPSTR)line, prefix_offset, &size);
|
||||
prefix_x = size.cx;
|
||||
GetTextExtentPointA(hDC, (LPSTR)line, prefix_offset + 1, &size);
|
||||
prefix_end = size.cx - 1;
|
||||
}
|
||||
if (!GetTextExtentPointA(hDC, (LPSTR)line, len, &size))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (uFormat & DT_CENTER)
|
||||
x = (lpRect->left + lpRect->right - size.cx) / 2;
|
||||
else if (uFormat & DT_RIGHT)
|
||||
x = lpRect->right - size.cx;
|
||||
|
||||
if (uFormat & DT_SINGLELINE)
|
||||
{
|
||||
if (uFormat & DT_VCENTER) y = lpRect->top +
|
||||
(lpRect->bottom - lpRect->top) / 2 - size.cy / 2;
|
||||
else if (uFormat & DT_BOTTOM) y = lpRect->bottom - size.cy;
|
||||
}
|
||||
if (!(uFormat & DT_CALCRECT))
|
||||
{
|
||||
if ( Unicode ) {
|
||||
if (!ExtTextOutW(hDC, x, y, (uFormat & DT_NOCLIP) ? 0 : ETO_CLIPPED,lpRect, (LPWSTR)line, len, NULL ))
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if (!ExtTextOutA(hDC, x, y, (uFormat & DT_NOCLIP) ? 0 : ETO_CLIPPED,lpRect, (LPSTR)line, len, NULL ))
|
||||
return 0;
|
||||
}
|
||||
if (prefix_offset != -1)
|
||||
{
|
||||
HPEN hpen = CreatePen( PS_SOLID, 1, GetTextColor(hDC) );
|
||||
HPEN oldPen = SelectObject( hDC, hpen );
|
||||
MoveToEx(hDC, x + prefix_x, y + tm.tmAscent + 1,NULL );
|
||||
LineTo(hDC, x + prefix_end + 1, y + tm.tmAscent + 1 );
|
||||
SelectObject( hDC, oldPen );
|
||||
DeleteObject( hpen );
|
||||
}
|
||||
}
|
||||
else if (size.cx > max_width)
|
||||
max_width = size.cx;
|
||||
|
||||
y += lh;
|
||||
if (strPtr)
|
||||
{
|
||||
if (!(uFormat & DT_NOCLIP))
|
||||
{
|
||||
if (y > lpRect->bottom - lh)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (strPtr);
|
||||
if (uFormat & DT_CALCRECT)
|
||||
{
|
||||
lpRect->right = lpRect->left + max_width;
|
||||
lpRect->bottom = y;
|
||||
}
|
||||
return y - lpRect->top;
|
||||
}
|
||||
|
||||
|
||||
LPCSTR TEXT_NextLineA( HDC hdc, LPCSTR str, INT *count,
|
||||
LPSTR dest, INT *len, INT width, WORD format)
|
||||
{
|
||||
/* Return next line of text from a string.
|
||||
*
|
||||
* hdc - handle to DC.
|
||||
* str - string to parse into lines.
|
||||
* count - length of str.
|
||||
* dest - destination in which to return line.
|
||||
* len - length of resultant line in dest in chars.
|
||||
* width - maximum width of line in pixels.
|
||||
* format - format type passed to DrawText.
|
||||
*
|
||||
* Returns pointer to next char in str after end of the line
|
||||
* or NULL if end of str reached.
|
||||
*/
|
||||
|
||||
int i = 0, j = 0, k;
|
||||
int plen = 0;
|
||||
int numspaces;
|
||||
SIZE size;
|
||||
int lasttab = 0;
|
||||
int wb_i = 0, wb_j = 0, wb_count = 0;
|
||||
|
||||
while (*count)
|
||||
{
|
||||
switch (str[i])
|
||||
{
|
||||
case CR:
|
||||
case LF:
|
||||
if (!(format & DT_SINGLELINE))
|
||||
{
|
||||
if ((*count > 1) && (str[i] == CR) && (str[i+1] == LF))
|
||||
{
|
||||
(*count)--;
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
*len = j;
|
||||
(*count)--;
|
||||
return (&str[i]);
|
||||
}
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
|
||||
(format & DT_WORDBREAK))
|
||||
{
|
||||
if (!GetTextExtentPointA(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
break;
|
||||
|
||||
case PREFIX:
|
||||
if (!(format & DT_NOPREFIX) && *count > 1)
|
||||
{
|
||||
if (str[++i] == PREFIX)
|
||||
(*count)--;
|
||||
else {
|
||||
prefix_offset = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
|
||||
(format & DT_WORDBREAK))
|
||||
{
|
||||
if (!GetTextExtentPointA(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
break;
|
||||
|
||||
case TAB:
|
||||
if (format & DT_EXPANDTABS)
|
||||
{
|
||||
wb_i = ++i;
|
||||
wb_j = j;
|
||||
wb_count = *count;
|
||||
|
||||
if (!GetTextExtentPointA(hdc, &dest[lasttab], j - lasttab,
|
||||
&size))
|
||||
return NULL;
|
||||
|
||||
numspaces = (tabwidth - size.cx) / spacewidth;
|
||||
for (k = 0; k < numspaces; k++)
|
||||
dest[j++] = SPACE;
|
||||
plen += tabwidth - size.cx;
|
||||
lasttab = wb_j + numspaces;
|
||||
}
|
||||
else
|
||||
{
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
|
||||
(format & DT_WORDBREAK))
|
||||
{
|
||||
if (!GetTextExtentPointA(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SPACE:
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
|
||||
(format & DT_WORDBREAK))
|
||||
{
|
||||
wb_i = i;
|
||||
wb_j = j - 1;
|
||||
wb_count = *count;
|
||||
if (!GetTextExtentPointA(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
|
||||
(format & DT_WORDBREAK))
|
||||
{
|
||||
if (!GetTextExtentPointA(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
}
|
||||
|
||||
(*count)--;
|
||||
if (!(format & DT_NOCLIP) || (format & DT_WORDBREAK))
|
||||
{
|
||||
if (plen > width)
|
||||
{
|
||||
if (format & DT_WORDBREAK)
|
||||
{
|
||||
if (wb_j)
|
||||
{
|
||||
*len = wb_j;
|
||||
*count = wb_count - 1;
|
||||
return (&str[wb_i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*len = j;
|
||||
return (&str[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*len = j;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LPCWSTR TEXT_NextLineW( HDC hdc, LPCWSTR str, INT *count,
|
||||
LPWSTR dest, INT *len, INT width, WORD format)
|
||||
{
|
||||
/* Return next line of text from a string.
|
||||
*
|
||||
* hdc - handle to DC.
|
||||
* str - string to parse into lines.
|
||||
* count - length of str.
|
||||
* dest - destination in which to return line.
|
||||
* len - length of resultant line in dest in chars.
|
||||
* width - maximum width of line in pixels.
|
||||
* format - format type passed to DrawText.
|
||||
*
|
||||
* Returns pointer to next char in str after end of the line
|
||||
* or NULL if end of str reached.
|
||||
*/
|
||||
|
||||
int i = 0, j = 0, k;
|
||||
int plen = 0;
|
||||
int numspaces;
|
||||
SIZE size;
|
||||
int lasttab = 0;
|
||||
int wb_i = 0, wb_j = 0, wb_count = 0;
|
||||
|
||||
while (*count)
|
||||
{
|
||||
switch (str[i])
|
||||
{
|
||||
case CR:
|
||||
case LF:
|
||||
if (!(format & DT_SINGLELINE))
|
||||
{
|
||||
if ((*count > 1) && (str[i] == CR) && (str[i+1] == LF))
|
||||
{
|
||||
(*count)--;
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
*len = j;
|
||||
(*count)--;
|
||||
return (&str[i]);
|
||||
}
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
|
||||
(format & DT_WORDBREAK))
|
||||
{
|
||||
if (!GetTextExtentPointW(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
break;
|
||||
|
||||
case PREFIX:
|
||||
if (!(format & DT_NOPREFIX) && *count > 1)
|
||||
{
|
||||
if (str[++i] == PREFIX)
|
||||
(*count)--;
|
||||
else {
|
||||
prefix_offset = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
|
||||
(format & DT_WORDBREAK))
|
||||
{
|
||||
if (!GetTextExtentPointW(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
break;
|
||||
|
||||
case TAB:
|
||||
if (format & DT_EXPANDTABS)
|
||||
{
|
||||
wb_i = ++i;
|
||||
wb_j = j;
|
||||
wb_count = *count;
|
||||
|
||||
if (!GetTextExtentPointW(hdc, &dest[lasttab], j - lasttab,
|
||||
&size))
|
||||
return NULL;
|
||||
|
||||
numspaces = (tabwidth - size.cx) / spacewidth;
|
||||
for (k = 0; k < numspaces; k++)
|
||||
dest[j++] = SPACE;
|
||||
plen += tabwidth - size.cx;
|
||||
lasttab = wb_j + numspaces;
|
||||
}
|
||||
else
|
||||
{
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
|
||||
(format & DT_WORDBREAK))
|
||||
{
|
||||
if (!GetTextExtentPointW(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SPACE:
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
|
||||
(format & DT_WORDBREAK))
|
||||
{
|
||||
wb_i = i;
|
||||
wb_j = j - 1;
|
||||
wb_count = *count;
|
||||
if (!GetTextExtentPointW(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
dest[j++] = str[i++];
|
||||
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
|
||||
(format & DT_WORDBREAK))
|
||||
{
|
||||
if (!GetTextExtentPointW(hdc, &dest[j-1], 1, &size))
|
||||
return NULL;
|
||||
plen += size.cx;
|
||||
}
|
||||
}
|
||||
|
||||
(*count)--;
|
||||
if (!(format & DT_NOCLIP) || (format & DT_WORDBREAK))
|
||||
{
|
||||
if (plen > width)
|
||||
{
|
||||
if (format & DT_WORDBREAK)
|
||||
{
|
||||
if (wb_j)
|
||||
{
|
||||
*len = wb_j;
|
||||
*count = wb_count - 1;
|
||||
return (&str[wb_i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*len = j;
|
||||
return (&str[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*len = j;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
WINBOOL TEXT_GrayString(HDC hdc, HBRUSH hb,
|
||||
GRAYSTRINGPROC fn, LPARAM lp, INT len,
|
||||
INT x, INT y, INT cx, INT cy, WINBOOL Unicode)
|
||||
{
|
||||
HBITMAP hbm, hbmsave;
|
||||
HBRUSH hbsave;
|
||||
HFONT hfsave;
|
||||
HDC memdc = CreateCompatibleDC(hdc);
|
||||
int slen = len;
|
||||
WINBOOL retval = TRUE;
|
||||
RECT r;
|
||||
COLORREF fg, bg;
|
||||
|
||||
if(!hdc) return FALSE;
|
||||
|
||||
if(len == 0)
|
||||
{
|
||||
if ( Unicode )
|
||||
slen = lstrlenW((LPCWSTR)lp);
|
||||
else
|
||||
slen = lstrlenA((LPCSTR)lp);
|
||||
|
||||
}
|
||||
|
||||
if((cx == 0 || cy == 0) && slen != -1)
|
||||
{
|
||||
SIZE s;
|
||||
if ( Unicode )
|
||||
GetTextExtentPointW(hdc, (LPCWSTR)lp, slen, &s);
|
||||
else
|
||||
GetTextExtentPointA(hdc, (LPCSTR)lp, slen, &s);
|
||||
|
||||
if(cx == 0) cx = s.cx;
|
||||
if(cy == 0) cy = s.cy;
|
||||
}
|
||||
|
||||
r.left = r.top = 0;
|
||||
r.right = cx;
|
||||
r.bottom = cy;
|
||||
|
||||
hbm = CreateBitmap(cx, cy, 1, 1, NULL);
|
||||
hbmsave = (HBITMAP)SelectObject(memdc, hbm);
|
||||
FillRect(memdc, &r, (HBRUSH)GetStockObject(BLACK_BRUSH));
|
||||
SetTextColor(memdc, RGB(255, 255, 255));
|
||||
SetBkColor(memdc, RGB(0, 0, 0));
|
||||
hfsave = (HFONT)SelectObject(memdc, GetCurrentObject(hdc, OBJ_FONT));
|
||||
|
||||
if(fn)
|
||||
retval = fn(memdc, lp, slen);
|
||||
else {
|
||||
if (Unicode )
|
||||
TextOutW(memdc, 0, 0, (LPCWSTR)lp, slen);
|
||||
else
|
||||
TextOutA(memdc, 0, 0, (LPCSTR)lp, slen);
|
||||
}
|
||||
|
||||
|
||||
SelectObject(memdc, hfsave);
|
||||
|
||||
/*
|
||||
* Windows doc says that the bitmap isn't grayed when len == -1 and
|
||||
* the callback function returns FALSE. However, testing this on
|
||||
* win95 showed otherwise...
|
||||
*/
|
||||
#ifdef GRAYSTRING_USING_DOCUMENTED_BEHAVIOUR
|
||||
if(retval || len != -1)
|
||||
#endif
|
||||
{
|
||||
hbsave = (HBRUSH)SelectObject(memdc, CACHE_GetPattern55AABrush());
|
||||
PatBlt(memdc, 0, 0, cx, cy, 0x000A0329);
|
||||
SelectObject(memdc, hbsave);
|
||||
}
|
||||
|
||||
if(hb) hbsave = (HBRUSH)SelectObject(hdc, hb);
|
||||
fg = SetTextColor(hdc, RGB(0, 0, 0));
|
||||
bg = SetBkColor(hdc, RGB(255, 255, 255));
|
||||
BitBlt(hdc, x, y, cx, cy, memdc, 0, 0, 0x00E20746);
|
||||
SetTextColor(hdc, fg);
|
||||
SetBkColor(hdc, bg);
|
||||
if(hb) SelectObject(hdc, hbsave);
|
||||
|
||||
SelectObject(memdc, hbmsave);
|
||||
DeleteObject(hbm);
|
||||
DeleteDC(memdc);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
* TEXT_TabbedTextOut
|
||||
*
|
||||
* Helper function for TabbedTextOut() and GetTabbedTextExtent().
|
||||
* Note: this doesn't work too well for text-alignment modes other
|
||||
* than TA_LEFT|TA_TOP. But we want bug-for-bug compatibility :-)
|
||||
*/
|
||||
LONG TEXT_TabbedTextOutA( HDC hdc, INT x, INT y, LPCSTR lpstr,
|
||||
INT count, INT cTabStops, const INT *lpTabPos,
|
||||
INT nTabOrg, WINBOOL fDisplayText )
|
||||
{
|
||||
INT defWidth;
|
||||
DWORD extent = 0;
|
||||
int i, tabPos = x;
|
||||
int start = x;
|
||||
SIZE szSize;
|
||||
|
||||
if (cTabStops == 1)
|
||||
{
|
||||
defWidth = lpTabPos ? *lpTabPos : 0;
|
||||
cTabStops = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
TEXTMETRIC tm;
|
||||
GetTextMetricsA( hdc, &tm );
|
||||
defWidth = 8 * tm.tmAveCharWidth;
|
||||
}
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
for (i = 0; i < count; i++)
|
||||
if (lpstr[i] == '\t') break;
|
||||
GetTextExtentPoint32A( hdc, lpstr, i, &szSize );
|
||||
extent = szSize.cx;
|
||||
if (lpTabPos)
|
||||
{
|
||||
while ((cTabStops > 0) &&
|
||||
(nTabOrg + *lpTabPos <= x + LOWORD(extent)))
|
||||
{
|
||||
lpTabPos++;
|
||||
cTabStops--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((cTabStops > 0) &&
|
||||
(nTabOrg + *lpTabPos <= x + LOWORD(extent)))
|
||||
{
|
||||
lpTabPos++;
|
||||
cTabStops--;
|
||||
}
|
||||
}
|
||||
if (i == count)
|
||||
tabPos = x + LOWORD(extent);
|
||||
else if (cTabStops > 0)
|
||||
tabPos = nTabOrg + (lpTabPos ? *lpTabPos : 0);
|
||||
else
|
||||
tabPos = nTabOrg + ((x + LOWORD(extent) - nTabOrg) / defWidth + 1) * defWidth;
|
||||
if (fDisplayText)
|
||||
{
|
||||
RECT r;
|
||||
SetRect( &r, x, y, tabPos, y+HIWORD(extent) );
|
||||
ExtTextOutA( hdc, x, y,
|
||||
GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0,
|
||||
&r, lpstr, i, NULL );
|
||||
}
|
||||
x = tabPos;
|
||||
count -= i+1;
|
||||
lpstr += i+1;
|
||||
}
|
||||
return MAKELONG(tabPos - start, HIWORD(extent));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* TEXT_TabbedTextOut
|
||||
*
|
||||
* Helper function for TabbedTextOut() and GetTabbedTextExtent().
|
||||
* Note: this doesn't work too well for text-alignment modes other
|
||||
* than TA_LEFT|TA_TOP. But we want bug-for-bug compatibility :-)
|
||||
*/
|
||||
LONG TEXT_TabbedTextOutW( HDC hdc, INT x, INT y, LPCWSTR lpstr,
|
||||
INT count, INT cTabStops, const INT *lpTabPos,
|
||||
INT nTabOrg, WINBOOL fDisplayText )
|
||||
{
|
||||
INT defWidth;
|
||||
DWORD extent = 0;
|
||||
int i, tabPos = x;
|
||||
int start = x;
|
||||
SIZE szSize;
|
||||
|
||||
if (cTabStops == 1)
|
||||
{
|
||||
defWidth = lpTabPos ? *lpTabPos : 0;
|
||||
cTabStops = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
TEXTMETRIC tm;
|
||||
GetTextMetricsW( hdc, &tm );
|
||||
defWidth = 8 * tm.tmAveCharWidth;
|
||||
}
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
for (i = 0; i < count; i++)
|
||||
if (lpstr[i] == '\t') break;
|
||||
GetTextExtentPoint32W( hdc, lpstr, i, &szSize );
|
||||
extent = szSize.cx;
|
||||
if (lpTabPos)
|
||||
{
|
||||
while ((cTabStops > 0) &&
|
||||
(nTabOrg + *lpTabPos <= x + LOWORD(extent)))
|
||||
{
|
||||
lpTabPos++;
|
||||
cTabStops--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((cTabStops > 0) &&
|
||||
(nTabOrg + *lpTabPos <= x + LOWORD(extent)))
|
||||
{
|
||||
lpTabPos++;
|
||||
cTabStops--;
|
||||
}
|
||||
}
|
||||
if (i == count)
|
||||
tabPos = x + LOWORD(extent);
|
||||
else if (cTabStops > 0)
|
||||
tabPos = nTabOrg + (lpTabPos ? *lpTabPos : 0);
|
||||
else
|
||||
tabPos = nTabOrg + ((x + LOWORD(extent) - nTabOrg) / defWidth + 1) * defWidth;
|
||||
if (fDisplayText)
|
||||
{
|
||||
RECT r;
|
||||
SetRect( &r, x, y, tabPos, y+HIWORD(extent) );
|
||||
ExtTextOutW( hdc, x, y,
|
||||
GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0,
|
||||
&r, lpstr, i, NULL );
|
||||
}
|
||||
x = tabPos;
|
||||
count -= i+1;
|
||||
lpstr += i+1;
|
||||
}
|
||||
return MAKELONG(tabPos - start, HIWORD(extent));
|
||||
}
|
||||
#if 0
|
||||
int _alloca(int x)
|
||||
{
|
||||
return malloc(x);
|
||||
}
|
||||
#endif
|
|
@ -1,293 +0,0 @@
|
|||
/*
|
||||
* Timer functions
|
||||
*
|
||||
* Copyright 1993 Alexandre Julliard
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/timer.h>
|
||||
#include <user32/debug.h>
|
||||
|
||||
|
||||
|
||||
|
||||
static TIMER TimersArray[NB_TIMERS];
|
||||
|
||||
static TIMER * pNextTimer = NULL; /* Next timer to expire */
|
||||
|
||||
/* Duration from 'time' until expiration of the timer */
|
||||
#define EXPIRE_TIME(pTimer,time) \
|
||||
(((pTimer)->expires <= (time)) ? 0 : (pTimer)->expires - (time))
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIMER_InsertTimer
|
||||
*
|
||||
* Insert the timer at its place in the chain.
|
||||
*/
|
||||
void TIMER_InsertTimer( TIMER * pTimer )
|
||||
{
|
||||
if (!pNextTimer || (pTimer->expires < pNextTimer->expires))
|
||||
{
|
||||
pTimer->next = pNextTimer;
|
||||
pNextTimer = pTimer;
|
||||
}
|
||||
else
|
||||
{
|
||||
TIMER * ptr = pNextTimer;
|
||||
while (ptr->next && (pTimer->expires >= ptr->next->expires))
|
||||
ptr = ptr->next;
|
||||
pTimer->next = ptr->next;
|
||||
ptr->next = pTimer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIMER_RemoveTimer
|
||||
*
|
||||
* Remove the timer from the chain.
|
||||
*/
|
||||
void TIMER_RemoveTimer( TIMER * pTimer )
|
||||
{
|
||||
TIMER **ppTimer = &pNextTimer;
|
||||
|
||||
while (*ppTimer && (*ppTimer != pTimer)) ppTimer = &(*ppTimer)->next;
|
||||
if (*ppTimer) *ppTimer = pTimer->next;
|
||||
pTimer->next = NULL;
|
||||
if (!pTimer->expires) QUEUE_DecTimerCount( pTimer->hq );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIMER_ClearTimer
|
||||
*
|
||||
* Clear and remove a timer.
|
||||
*/
|
||||
void TIMER_ClearTimer( TIMER * pTimer )
|
||||
{
|
||||
TIMER_RemoveTimer( pTimer );
|
||||
pTimer->hwnd = 0;
|
||||
pTimer->msg = 0;
|
||||
pTimer->id = 0;
|
||||
pTimer->timeout = 0;
|
||||
//WINPROC_FreeProc( pTimer->proc, WIN_PROC_TIMER );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIMER_SwitchQueue
|
||||
*/
|
||||
void TIMER_SwitchQueue( HQUEUE old, HQUEUE newQ )
|
||||
{
|
||||
TIMER * pT = pNextTimer;
|
||||
|
||||
while (pT)
|
||||
{
|
||||
if (pT->hq == old) pT->hq = newQ;
|
||||
pT = pT->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIMER_RemoveWindowTimers
|
||||
*
|
||||
* Remove all timers for a given window.
|
||||
*/
|
||||
void TIMER_RemoveWindowTimers( HWND hwnd )
|
||||
{
|
||||
int i;
|
||||
TIMER *pTimer;
|
||||
|
||||
for (i = NB_TIMERS, pTimer = TimersArray; i > 0; i--, pTimer++)
|
||||
if ((pTimer->hwnd == hwnd) && pTimer->timeout)
|
||||
TIMER_ClearTimer( pTimer );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIMER_RemoveQueueTimers
|
||||
*
|
||||
* Remove all timers for a given queue.
|
||||
*/
|
||||
void TIMER_RemoveQueueTimers( HQUEUE hqueue )
|
||||
{
|
||||
int i;
|
||||
TIMER *pTimer;
|
||||
|
||||
for (i = NB_TIMERS, pTimer = TimersArray; i > 0; i--, pTimer++)
|
||||
if ((pTimer->hq == hqueue) && pTimer->timeout)
|
||||
TIMER_ClearTimer( pTimer );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIMER_RestartTimers
|
||||
*
|
||||
* Restart an expired timer.
|
||||
*/
|
||||
void TIMER_RestartTimer( TIMER * pTimer, DWORD curTime )
|
||||
{
|
||||
TIMER_RemoveTimer( pTimer );
|
||||
pTimer->expires = curTime + pTimer->timeout;
|
||||
TIMER_InsertTimer( pTimer );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIMER_GetNextExpiration
|
||||
*
|
||||
* Return next timer expiration time, or -1 if none.
|
||||
*/
|
||||
LONG TIMER_GetNextExpiration(void)
|
||||
{
|
||||
return pNextTimer ? EXPIRE_TIME( pNextTimer, GetTickCount() ) : -1;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIMER_ExpireTimers
|
||||
*
|
||||
* Mark expired timers and wake the appropriate queues.
|
||||
*/
|
||||
void TIMER_ExpireTimers(void)
|
||||
{
|
||||
TIMER *pTimer = pNextTimer;
|
||||
DWORD curTime = GetTickCount();
|
||||
|
||||
while (pTimer && !pTimer->expires) /* Skip already expired timers */
|
||||
pTimer = pTimer->next;
|
||||
while (pTimer && (pTimer->expires <= curTime))
|
||||
{
|
||||
pTimer->expires = 0;
|
||||
QUEUE_IncTimerCount( pTimer->hq );
|
||||
pTimer = pTimer->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIMER_GetTimerMsg
|
||||
*
|
||||
* Build a message for an expired timer.
|
||||
*/
|
||||
WINBOOL TIMER_GetTimerMsg( MSG *msg, HWND hwnd,
|
||||
HQUEUE hQueue,WINBOOL remove )
|
||||
{
|
||||
TIMER *pTimer = pNextTimer;
|
||||
DWORD curTime = GetTickCount();
|
||||
|
||||
if (hwnd) /* Find first timer for this window */
|
||||
while (pTimer && (pTimer->hwnd != hwnd)) pTimer = pTimer->next;
|
||||
else /* Find first timer for this queue */
|
||||
while (pTimer && (pTimer->hq != hQueue)) pTimer = pTimer->next;
|
||||
|
||||
if (!pTimer || (pTimer->expires > curTime)) return FALSE; /* No timer */
|
||||
if (remove) TIMER_RestartTimer( pTimer, curTime ); /* Restart it */
|
||||
|
||||
DPRINT( "Timer expired: %04x, %04x, %04x, %08lx\n",
|
||||
pTimer->hwnd, pTimer->msg, pTimer->id, (DWORD)pTimer->proc);
|
||||
|
||||
/* Build the message */
|
||||
msg->hwnd = (HWND)pTimer->hwnd;
|
||||
msg->message = pTimer->msg;
|
||||
msg->wParam = (UINT)pTimer->id;
|
||||
msg->lParam = (LONG)pTimer->proc;
|
||||
msg->time = curTime;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIMER_SetTimer
|
||||
*/
|
||||
UINT TIMER_SetTimer( HWND hwnd, UINT id, UINT timeout,
|
||||
TIMERPROC proc, WINBOOL sys )
|
||||
{
|
||||
int i;
|
||||
TIMER * pTimer;
|
||||
|
||||
int type = 0;
|
||||
|
||||
if (!timeout) return 0;
|
||||
|
||||
/* Check if there's already a timer with the same hwnd and id */
|
||||
|
||||
for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++)
|
||||
if ((pTimer->hwnd == hwnd) && (pTimer->id == id) &&
|
||||
(pTimer->timeout != 0))
|
||||
{
|
||||
/* Got one: set new values and return */
|
||||
TIMER_RemoveTimer( pTimer );
|
||||
pTimer->timeout = timeout;
|
||||
// WINPROC_FreeProc( pTimer->proc, WIN_PROC_TIMER );
|
||||
pTimer->proc = (HWINDOWPROC)0;
|
||||
if (proc) {
|
||||
pTimer->proc = proc;
|
||||
//WINPROC_SetProc( &pTimer->proc, proc, type,WIN_PROC_TIMER );
|
||||
}
|
||||
pTimer->expires = GetTickCount() + timeout;
|
||||
TIMER_InsertTimer( pTimer );
|
||||
return id;
|
||||
}
|
||||
|
||||
/* Find a free timer */
|
||||
|
||||
for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++)
|
||||
if (!pTimer->timeout) break;
|
||||
|
||||
if (i >= NB_TIMERS) return 0;
|
||||
if (!sys && (i >= NB_TIMERS-NB_RESERVED_TIMERS)) return 0;
|
||||
if (!hwnd) id = i + 1;
|
||||
|
||||
/* Add the timer */
|
||||
|
||||
pTimer->hwnd = hwnd;
|
||||
pTimer->hq = (hwnd) ? GetThreadQueue( GetWindowThreadProcessId( hwnd, NULL ) )
|
||||
: GetFastQueue( );
|
||||
pTimer->msg = sys ? WM_SYSTIMER : WM_TIMER;
|
||||
pTimer->id = id;
|
||||
pTimer->timeout = timeout;
|
||||
pTimer->expires = GetTickCount() + timeout;
|
||||
pTimer->proc = (HWINDOWPROC)0;
|
||||
if (proc) {
|
||||
pTimer->proc = proc;
|
||||
// WINPROC_SetProc( &pTimer->proc, proc, type, WIN_PROC_TIMER );
|
||||
}
|
||||
DPRINT( "Timer added: %p, %04x, %04x, %04x, %08lx\n",
|
||||
pTimer, pTimer->hwnd, pTimer->msg, pTimer->id,
|
||||
(DWORD)pTimer->proc );
|
||||
TIMER_InsertTimer( pTimer );
|
||||
if (!id) return TRUE;
|
||||
else return id;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIMER_KillTimer
|
||||
*/
|
||||
WINBOOL TIMER_KillTimer( HWND hwnd, UINT id,WINBOOL sys )
|
||||
{
|
||||
int i;
|
||||
TIMER * pTimer;
|
||||
|
||||
/* Find the timer */
|
||||
|
||||
for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++)
|
||||
if ((pTimer->hwnd == hwnd) && (pTimer->id == id) &&
|
||||
(pTimer->timeout != 0)) break;
|
||||
if (i >= NB_TIMERS) return FALSE;
|
||||
if (!sys && (i >= NB_TIMERS-NB_RESERVED_TIMERS)) return FALSE;
|
||||
if (!sys && (pTimer->msg != WM_TIMER)) return FALSE;
|
||||
else if (sys && (pTimer->msg != WM_SYSTIMER)) return FALSE;
|
||||
|
||||
/* Delete the timer */
|
||||
|
||||
TIMER_ClearTimer( pTimer );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile_rex,v 1.16 2001/05/07 22:03:27 chorns Exp $
|
||||
# $Id: makefile_rex,v 1.17 2001/06/12 17:35:43 chorns Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
|
@ -6,19 +6,27 @@
|
|||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
CFLAGS = -I../../include -DDBG
|
||||
CFLAGS = -I./include -DUNICODE -DDBG
|
||||
|
||||
TARGET=user32
|
||||
|
||||
MISC_OBJECTS = \
|
||||
misc/desktop.o \
|
||||
misc/dllmain.o \
|
||||
misc/sprintf.o \
|
||||
misc/stubs.o \
|
||||
misc/win32k.o
|
||||
misc/win32k.o \
|
||||
misc/winsta.o
|
||||
|
||||
WINDOWS_OBJECTS = \
|
||||
windows/class.o \
|
||||
windows/message.o \
|
||||
windows/window.o
|
||||
|
||||
RESOURCE_OBJECT = $(TARGET).coff
|
||||
|
||||
OBJECTS = $(MISC_OBJECTS) $(RESOURCE_OBJECT)
|
||||
OBJECTS = $(MISC_OBJECTS) $(WINDOWS_OBJECTS) \
|
||||
$(RESOURCE_OBJECT)
|
||||
|
||||
LIBS = ../ntdll/ntdll.a \
|
||||
../kernel32/kernel32.a \
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
#include <windows.h>
|
||||
|
||||
HBITMAP BITMAP_LoadBitmapW(HINSTANCE instance,LPCWSTR name, UINT loadflags);
|
||||
|
||||
|
||||
|
||||
HBITMAP
|
||||
STDCALL
|
||||
LoadBitmapW(HINSTANCE hInstance, LPCWSTR lpBitmapName)
|
||||
{
|
||||
return BITMAP_LoadBitmapW(hInstance, lpBitmapName, 0);
|
||||
}
|
||||
|
||||
HBITMAP
|
||||
STDCALL
|
||||
LoadBitmapA(HINSTANCE hInstance, LPCSTR lpBitmapName)
|
||||
{
|
||||
return CreateBitmap(GetSystemMetrics(SM_CXSMICON),
|
||||
GetSystemMetrics(SM_CXSMICON),
|
||||
1,1, NULL );
|
||||
return NULL;
|
||||
// return BITMAP_LoadBitmap32W(hInstance, lpBitmapName, 0);
|
||||
}
|
||||
|
||||
HBITMAP BITMAP_LoadBitmapW(HINSTANCE instance,LPCWSTR name,
|
||||
UINT loadflags)
|
||||
{
|
||||
return CreateBitmap(GetSystemMetrics(SM_CXSMICON),
|
||||
GetSystemMetrics(SM_CXSMICON),
|
||||
1,1, NULL );
|
||||
#if 0
|
||||
HBITMAP hbitmap = 0;
|
||||
HDC hdc;
|
||||
HRSRC hRsrc;
|
||||
HGLOBAL handle;
|
||||
char *ptr = NULL;
|
||||
BITMAPINFO *info, *fix_info=NULL;
|
||||
HGLOBAL hFix;
|
||||
int size;
|
||||
|
||||
if (!(loadflags & LR_LOADFROMFILE)) {
|
||||
if (!instance) /* OEM bitmap */
|
||||
{
|
||||
HDC hdc;
|
||||
DC *dc;
|
||||
|
||||
if (HIWORD((int)name)) return 0;
|
||||
hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
|
||||
dc = DC_GetDCPtr( hdc );
|
||||
if(dc->funcs->pLoadOEMResource)
|
||||
hbitmap = dc->funcs->pLoadOEMResource( LOWORD((int)name),
|
||||
OEM_BITMAP );
|
||||
GDI_HEAP_UNLOCK( hdc );
|
||||
DeleteDC( hdc );
|
||||
return hbitmap;
|
||||
}
|
||||
|
||||
if (!(hRsrc = FindResourceW( instance, name, RT_BITMAPW ))) return 0;
|
||||
if (!(handle = LoadResource( instance, hRsrc ))) return 0;
|
||||
|
||||
if ((info = (BITMAPINFO *)LockResource( handle )) == NULL) return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(ptr = (char *)VIRTUAL_MapFileW( name ))) return 0;
|
||||
info = (BITMAPINFO *)(ptr + sizeof(BITMAPFILEHEADER));
|
||||
}
|
||||
size = DIB_BitmapInfoSize(info, DIB_RGB_COLORS);
|
||||
if ((hFix = GlobalAlloc(0, size))) fix_info=GlobalLock(hFix);
|
||||
if (fix_info) {
|
||||
BYTE pix;
|
||||
|
||||
memcpy(fix_info, info, size);
|
||||
pix = *((LPBYTE)info+DIB_BitmapInfoSize(info, DIB_RGB_COLORS));
|
||||
DIB_FixColorsToLoadflags(fix_info, loadflags, pix);
|
||||
if ((hdc = GetDC(0)) != 0) {
|
||||
if (loadflags & LR_CREATEDIBSECTION)
|
||||
hbitmap = CreateDIBSection(hdc, fix_info, DIB_RGB_COLORS, NULL, 0, 0);
|
||||
else {
|
||||
char *bits = (char *)info + size;;
|
||||
hbitmap = CreateDIBitmap( hdc, &fix_info->bmiHeader, CBM_INIT,
|
||||
bits, fix_info, DIB_RGB_COLORS );
|
||||
}
|
||||
ReleaseDC( 0, hdc );
|
||||
}
|
||||
GlobalUnlock(hFix);
|
||||
GlobalFree(hFix);
|
||||
}
|
||||
if (loadflags & LR_LOADFROMFILE) UnmapViewOfFile( ptr );
|
||||
return hbitmap;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
#include <windows.h>
|
||||
|
||||
/***********************************************************************
|
||||
* SetCursor (USER32.472)
|
||||
* RETURNS:
|
||||
* A handle to the previous cursor shape.
|
||||
*/
|
||||
HCURSOR STDCALL SetCursor( HCURSOR hCursor )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int STDCALL ShowCursor(WINBOOL bShow )
|
||||
{
|
||||
}
|
||||
|
||||
WINBOOL STDCALL SetCursorPos(int x, int y )
|
||||
{
|
||||
}
|
||||
|
||||
HCURSOR STDCALL LoadCursorA(HINSTANCE hInstance, LPCSTR lpCursorName )
|
||||
{
|
||||
}
|
||||
|
||||
HCURSOR STDCALL LoadCursorW(HINSTANCE hInstance, LPCWSTR lpCursorName )
|
||||
{
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DestroyCursor(
|
||||
HCURSOR hCursor)
|
||||
{
|
||||
}
|
|
@ -1,4 +1,45 @@
|
|||
#include <windows.h>
|
||||
#include <debug.h>
|
||||
|
||||
#ifdef DBG
|
||||
|
||||
/* See debug.h for debug/trace constants */
|
||||
DWORD DebugTraceLevel = MIN_TRACE;
|
||||
|
||||
#endif /* DBG */
|
||||
|
||||
/* To make the linker happy */
|
||||
VOID STDCALL KeBugCheck (ULONG BugCheckCode) {}
|
||||
|
||||
HANDLE ProcessHeap;
|
||||
HWINSTA ProcessWindowStation;
|
||||
|
||||
DWORD
|
||||
Init(VOID)
|
||||
{
|
||||
DWORD Status;
|
||||
|
||||
ProcessHeap = RtlGetProcessHeap();
|
||||
|
||||
//ProcessWindowStation = CreateWindowStationW(L"WinStaName",0,GENERIC_ALL,NULL);
|
||||
//Desktop = CreateDesktopA(NULL,NULL,NULL,0,0,NULL);
|
||||
|
||||
//GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
DWORD
|
||||
Cleanup(VOID)
|
||||
{
|
||||
DWORD Status;
|
||||
|
||||
//CloseWindowStation(ProcessWindowStation);
|
||||
|
||||
//GdiDllInitialize(NULL, DLL_PROCESS_DETACH, NULL);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
INT
|
||||
STDCALL
|
||||
|
@ -8,17 +49,19 @@ DllMain(
|
|||
PVOID reserved
|
||||
)
|
||||
{
|
||||
D(MAX_TRACE, ("hinstDll (0x%X) dwReason (0x%X)\n", hinstDll, dwReason));
|
||||
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
//WinStation = CreateWindowStationA(NULL,0,GENERIC_ALL,NULL);
|
||||
//Desktop = CreateDesktopA(NULL,NULL,NULL,0,0,NULL);
|
||||
Init();
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
Cleanup();
|
||||
break;
|
||||
}
|
||||
return(1);
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
/* $Id: exitwin.c,v 1.2 1999/05/15 13:48:38 ea Exp $
|
||||
*
|
||||
* exitwin.c
|
||||
*
|
||||
* Copyright (c) 1999 Emanuele Aliberti
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* This software is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this software; see the file COPYING.LIB. If
|
||||
* not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
* Cambridge, MA 02139, USA.
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* ReactOS user32.dll ExitWindows functions.
|
||||
*
|
||||
* 19990515 EA Naive implementation.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* ExitWindowsEx
|
||||
*
|
||||
* ARGUMENTS
|
||||
* uFlags shutdown operation
|
||||
* EWX_FORCE Processes are killed.
|
||||
*
|
||||
* EWX_LOGOFF Caller owned processed are killed.
|
||||
*
|
||||
* EWX_POWEROFF Turns off the power.
|
||||
*
|
||||
* EWX_REBOOT Restart the system.
|
||||
* SE_SHUTDOWN_NAME privilege reqired.
|
||||
*
|
||||
* EWX_SHUTDOWN Same as EWX_REBOOT, but rebooting.
|
||||
* SE_SHUTDOWN_NAME privilege reqired.
|
||||
*
|
||||
* dwReserved reserved
|
||||
*
|
||||
* REVISIONS
|
||||
* 1999-05-15 EA
|
||||
*/
|
||||
BOOL
|
||||
__stdcall
|
||||
ExitWindowsEx(
|
||||
UINT uFlags,
|
||||
DWORD dwReserved
|
||||
)
|
||||
{
|
||||
NTSTATUS rv;
|
||||
|
||||
if (uFlags & (
|
||||
EWX_FORCE |
|
||||
EWX_LOGOFF |
|
||||
EWX_POWEROFF |
|
||||
EWX_REBOOT |
|
||||
EWX_SHUTDOWN
|
||||
)
|
||||
) {
|
||||
/* Unknown flag! */
|
||||
SetLastError(ERROR_INVALID_FLAG_NUMBER);
|
||||
return FALSE;
|
||||
}
|
||||
/* FIXME: call csrss.exe;
|
||||
*
|
||||
* Naive implementation: call the kernel directly.
|
||||
* This code will be moved in csrss.exe when
|
||||
* available.
|
||||
*/
|
||||
if (EWX_POWEROFF & uFlags)
|
||||
{
|
||||
rv = NtShutdownSystem(ShutdownPowerOff);
|
||||
}
|
||||
else if (EWX_REBOOT & uFlags)
|
||||
{
|
||||
rv = NtShutdownSystem(ShutdownReboot);
|
||||
}
|
||||
else if (EWX_SHUTDOWN & uFlags)
|
||||
{
|
||||
rv = NtShutdownSystem(ShutdownNoReboot);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* How to implement others flags semantics? */
|
||||
SetLastError(ERROR_INVALID_FLAG_NUMBER);
|
||||
rv = (NTSTATUS) -1;
|
||||
}
|
||||
return NT_SUCCESS(rv)
|
||||
? TRUE
|
||||
: FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
|
@ -1,43 +0,0 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
LRESULT CALLBACK WindowFunc(HWND,UINT,WPARAM, LPARAM);
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
|
||||
WINPOS_CreateInternalPosAtom();
|
||||
SYSCOLOR_Init();
|
||||
WIDGETS_Init();
|
||||
ICONTITLE_Init();
|
||||
DIALOG_Init();
|
||||
COMBO_Init();
|
||||
MENU_Init();
|
||||
|
||||
MessageBox(NULL,"xxx","yyyy",MB_OK);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LRESULT CALLBACK WindowFunc(HWND hwnd,UINT message,WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch(message)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -1,814 +0,0 @@
|
|||
/*
|
||||
* String functions
|
||||
*
|
||||
* Copyright 1993 Yngvi Sigurjonsson (yngvi@hafro.is)
|
||||
* Copyright 1996 Marcus Meissner
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
/* Funny to divide them between user and kernel. */
|
||||
|
||||
/* be careful: always use functions from wctype.h if character > 255 */
|
||||
|
||||
/*
|
||||
* Unicode case conversion routines ... these should be used where
|
||||
* toupper/tolower are used for ASCII.
|
||||
*/
|
||||
|
||||
// bugfix: mutual exclusiveness of
|
||||
// FORMAT_MESSAGE_FROM_STRING, FORMAT_MESSAGE_FROM_SYSTEM and FORMAT_MESSAGE_FROM_HMODULE
|
||||
// in FormatMessage
|
||||
|
||||
#define IsDBCSLeadByte(c) FALSE
|
||||
#define IsDBCSLeadByteEx(c,n) FALSE
|
||||
#define CopyMemory memcpy
|
||||
#define lstrlenA strlen
|
||||
#define lstrlenW wcslen
|
||||
|
||||
DWORD LoadMessageA(HMODULE hModule,DWORD dwMessageId,
|
||||
DWORD dwLanguageId,LPSTR Buffer,UINT BufSize);
|
||||
DWORD LoadMessageW(HMODULE hModule,DWORD dwMessageId,
|
||||
DWORD dwLanguageId,LPWSTR Buffer,UINT BufSize);
|
||||
|
||||
|
||||
LPWSTR lstrchrW(LPCWSTR s, INT c);
|
||||
LPSTR lstrchrA(LPCSTR s, INT c);
|
||||
|
||||
|
||||
|
||||
LPSTR STDCALL CharNextA(LPCSTR lpsz)
|
||||
{
|
||||
LPSTR next = (LPSTR)lpsz;
|
||||
if (!*lpsz)
|
||||
return next;
|
||||
if (IsDBCSLeadByte( *next ))
|
||||
next++;
|
||||
next++;
|
||||
return next;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CharNextExA (USER.30)
|
||||
*/
|
||||
LPSTR STDCALL CharNextExA( WORD codepage, LPCSTR ptr, DWORD flags )
|
||||
{
|
||||
LPSTR next = (LPSTR)ptr;
|
||||
if (!*ptr)
|
||||
return next;
|
||||
if (IsDBCSLeadByteEx( codepage, *next ))
|
||||
return next++;
|
||||
next++;
|
||||
return next;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LPWSTR
|
||||
STDCALL
|
||||
CharNextW(LPCWSTR lpsz)
|
||||
{
|
||||
LPWSTR next = (LPWSTR)lpsz;
|
||||
if (!*lpsz)
|
||||
return next;
|
||||
next++;
|
||||
return next;
|
||||
}
|
||||
|
||||
|
||||
LPSTR STDCALL CharPrevA( LPCSTR start, LPCSTR ptr )
|
||||
{
|
||||
LPCSTR next;
|
||||
while (*start && (start < ptr))
|
||||
{
|
||||
next = CharNextA( start );
|
||||
if (next >= ptr)
|
||||
break;
|
||||
start = next;
|
||||
}
|
||||
return (LPSTR)start;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LPSTR STDCALL CharPrevExA( WORD codepage, LPCSTR start, LPCSTR ptr, DWORD flags )
|
||||
{
|
||||
|
||||
LPCSTR next;
|
||||
while (*start && (start < ptr))
|
||||
{
|
||||
next = CharNextExA( codepage, start, flags );
|
||||
if (next > ptr)
|
||||
break;
|
||||
start = next;
|
||||
}
|
||||
return (LPSTR)start;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LPWSTR STDCALL CharPrevW(LPCWSTR start,LPCWSTR x)
|
||||
{
|
||||
LPWSTR prev = (LPWSTR)x;
|
||||
if (x<=start)
|
||||
return prev;
|
||||
prev--;
|
||||
return prev;
|
||||
}
|
||||
|
||||
|
||||
LPSTR STDCALL CharLowerA(LPSTR x)
|
||||
{
|
||||
LPSTR s;
|
||||
UINT s2;
|
||||
if (!HIWORD(x)) {
|
||||
s2 = (UINT)x;
|
||||
|
||||
if (!IsDBCSLeadByte( s2 )) {
|
||||
if (!IsCharLowerA(s2))
|
||||
s2 = s2 - ( 'A' - 'a' );
|
||||
return (LPSTR)s2;
|
||||
}
|
||||
else {
|
||||
// should do a multibyte toupper
|
||||
if (s2 >= 'A' && s2 <= 'Z')
|
||||
s2 = s2 - ( 'A' - 'a' );
|
||||
return (LPSTR)s2;
|
||||
}
|
||||
return (LPSTR)x;
|
||||
}
|
||||
|
||||
s=x;
|
||||
while (*s)
|
||||
{
|
||||
if (!IsDBCSLeadByte( *s )) {
|
||||
if (!IsCharLowerA(*s))
|
||||
*s = *s - ( 'A' - 'a' );
|
||||
}
|
||||
else {
|
||||
// should do a multibyte toupper
|
||||
s++;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
return x;
|
||||
|
||||
}
|
||||
|
||||
|
||||
DWORD STDCALL CharLowerBuffA(LPSTR s,DWORD buflen)
|
||||
{
|
||||
DWORD done=0;
|
||||
|
||||
if (!s)
|
||||
return 0; /* YES */
|
||||
while (*s && (buflen--))
|
||||
{
|
||||
if (!IsDBCSLeadByte( *s )) {
|
||||
if (!IsCharLowerA(*s))
|
||||
*s = *s - ( 'A' - 'a' );
|
||||
}
|
||||
else {
|
||||
// should do a multibyte toupper
|
||||
s++;
|
||||
}
|
||||
s++;
|
||||
done++;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
|
||||
DWORD STDCALL CharLowerBuffW(LPWSTR s,DWORD buflen)
|
||||
{
|
||||
DWORD done=0;
|
||||
|
||||
if (!s)
|
||||
return 0; /* YES */
|
||||
while (*s && (buflen--))
|
||||
{
|
||||
if (!IsCharLowerW(*s))
|
||||
*s = *s - ( L'A' - L'a' );
|
||||
s++;
|
||||
done++;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
|
||||
LPWSTR STDCALL CharLowerW(LPWSTR x)
|
||||
{
|
||||
LPWSTR s;
|
||||
UINT s2;
|
||||
if (!HIWORD(x)) {
|
||||
s2 = (UINT)x;
|
||||
if (!IsCharLowerW(s2))
|
||||
s2 = s2 - ( L'A' - L'a' );
|
||||
return (LPWSTR)s2;
|
||||
}
|
||||
s = x;
|
||||
while (*s)
|
||||
{
|
||||
if (!IsCharLowerW(*s))
|
||||
*s = *s - ( L'A' - L'a' );
|
||||
s++;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LPSTR STDCALL CharUpperA(LPSTR x)
|
||||
{
|
||||
LPSTR s;
|
||||
UINT s2;
|
||||
if (!HIWORD(x)) {
|
||||
s2 = (UINT)x;
|
||||
|
||||
|
||||
if (!IsDBCSLeadByte( s2 )) {
|
||||
if (!IsCharUpperW(s2))
|
||||
s2 = s2 + ( 'A' - 'a' );
|
||||
return (LPSTR)s2;
|
||||
}
|
||||
else {
|
||||
// should do a multibyte toupper
|
||||
if (s2 >= 'a' && s2 <= 'z')
|
||||
s2 = s2 + ( 'A' - 'a' );
|
||||
return (LPSTR)s2;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
s=x;
|
||||
while (*s)
|
||||
{
|
||||
if (!IsDBCSLeadByte( *s )) {
|
||||
if (!IsCharUpperW(*s))
|
||||
*s = *s + ( 'A' - 'a' );
|
||||
}
|
||||
else {
|
||||
// should do a multibyte toupper
|
||||
s++;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
return x;
|
||||
|
||||
}
|
||||
|
||||
|
||||
DWORD STDCALL CharUpperBuffA(LPSTR s,DWORD buflen)
|
||||
{
|
||||
DWORD done=0;
|
||||
|
||||
if (!s)
|
||||
return 0; /* YES */
|
||||
while (*s && (buflen--))
|
||||
{
|
||||
if (!IsDBCSLeadByte( *s )) {
|
||||
if (!IsCharUpperW(*s))
|
||||
*s = *s + ( 'A' - 'a' );
|
||||
}
|
||||
else {
|
||||
// should do a multibyte toupper
|
||||
s++;
|
||||
}
|
||||
s++;
|
||||
done++;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
|
||||
DWORD STDCALL CharUpperBuffW(LPWSTR s,DWORD buflen)
|
||||
{
|
||||
DWORD done=0;
|
||||
|
||||
if (!s)
|
||||
return 0; /* YES */
|
||||
while (*s && (buflen--))
|
||||
{
|
||||
if (!IsCharUpperW(*s))
|
||||
*s = *s + ( L'A' - L'a' );
|
||||
s++;
|
||||
done++;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
|
||||
LPWSTR STDCALL CharUpperW(LPWSTR x)
|
||||
{
|
||||
LPWSTR s;
|
||||
UINT s2;
|
||||
if (!HIWORD(x)) {
|
||||
s2 = (UINT)x;
|
||||
if (!IsCharUpperW(s2))
|
||||
s2 = s2 + ( L'A' - L'a' );
|
||||
return (LPWSTR)s2;
|
||||
}
|
||||
s = x;
|
||||
while (*s)
|
||||
{
|
||||
if (!IsCharUpperW(*s))
|
||||
*s = *s + ( L'A' - L'a' );
|
||||
s++;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WINBOOL STDCALL IsCharAlphaNumericA(CHAR c)
|
||||
{
|
||||
return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'));
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL IsCharAlphaNumericW(WCHAR c)
|
||||
{
|
||||
return ((c >= L'A' && c <= L'Z') || (c >= L'a' && c <= L'z') || (c >= L'0' && c <= L'9'));
|
||||
}
|
||||
WINBOOL STDCALL IsCharAlphaA(CHAR c)
|
||||
{
|
||||
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
WINBOOL STDCALL IsCharAlphaW(WCHAR c)
|
||||
{
|
||||
return (c >= L'A' && c <= L'Z') || (c >= L'a' && c <= L'z');
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL IsCharLowerA(CHAR c)
|
||||
{
|
||||
return (c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL IsCharLowerW(WCHAR c)
|
||||
{
|
||||
return (c >= L'a' && c <= L'z');
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL IsCharUpperA(CHAR c)
|
||||
{
|
||||
return (c >= 'A' && c <= 'Z' );
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL IsCharUpperW(WCHAR c)
|
||||
{
|
||||
return (c >= L'A' && c <= L'Z' );
|
||||
}
|
||||
|
||||
|
||||
DWORD STDCALL FormatMessageA(
|
||||
DWORD dwFlags,
|
||||
LPCVOID lpSource,
|
||||
DWORD dwMessageId,
|
||||
DWORD dwLanguageId,
|
||||
LPSTR lpBuffer,
|
||||
DWORD nSize,
|
||||
va_list *Arguments
|
||||
) {
|
||||
LPSTR target,t;
|
||||
DWORD talloced;
|
||||
LPSTR from,f;
|
||||
//DWORD width = dwFlags & FORMAT_MESSAGE_MAX_WIDTH_MASK;
|
||||
DWORD nolinefeed = 0;
|
||||
DWORD len;
|
||||
|
||||
////TRACE(resource, "(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)\n",
|
||||
// dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,Arguments);
|
||||
//if (width)
|
||||
// FIXME(resource,"line wrapping not supported.\n");
|
||||
from = NULL;
|
||||
if (dwFlags & FORMAT_MESSAGE_FROM_STRING) {
|
||||
len = lstrlenA((LPSTR)lpSource);
|
||||
from = HeapAlloc( GetProcessHeap(),0, len+1 );
|
||||
CopyMemory(from,lpSource,len+1);
|
||||
}
|
||||
else if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) {
|
||||
len = 200;
|
||||
from = HeapAlloc( GetProcessHeap(),0,200 );
|
||||
wsprintfA(from,"Systemmessage, messageid = 0x%08lx\n",dwMessageId);
|
||||
}
|
||||
else if (dwFlags & FORMAT_MESSAGE_FROM_HMODULE) {
|
||||
INT bufsize;
|
||||
|
||||
dwMessageId &= 0xFFFF;
|
||||
bufsize=LoadMessageA((HMODULE)lpSource,dwMessageId,dwLanguageId,NULL,100);
|
||||
if (bufsize) {
|
||||
from = HeapAlloc( GetProcessHeap(), 0, bufsize + 1 );
|
||||
LoadMessageA((HMODULE)lpSource,dwMessageId,dwLanguageId,from,bufsize+1);
|
||||
}
|
||||
}
|
||||
target = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 100);
|
||||
t = target;
|
||||
talloced= 100;
|
||||
|
||||
#define ADD_TO_T(c) \
|
||||
*t++=c;\
|
||||
if (t-target == talloced) {\
|
||||
target = (char*)HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,talloced*2);\
|
||||
t = target+talloced;\
|
||||
talloced*=2;\
|
||||
}
|
||||
|
||||
if (from) {
|
||||
f=from;
|
||||
while (*f && !nolinefeed) {
|
||||
if (*f=='%') {
|
||||
int insertnr;
|
||||
char *fmtstr,*sprintfbuf,*x,*lastf;
|
||||
DWORD *argliststart;
|
||||
|
||||
fmtstr = NULL;
|
||||
lastf = f;
|
||||
f++;
|
||||
if (!*f) {
|
||||
ADD_TO_T('%');
|
||||
continue;
|
||||
}
|
||||
switch (*f) {
|
||||
case '1':case '2':case '3':case '4':case '5':
|
||||
case '6':case '7':case '8':case '9':
|
||||
insertnr=*f-'0';
|
||||
switch (f[1]) {
|
||||
case '0':case '1':case '2':case '3':
|
||||
case '4':case '5':case '6':case '7':
|
||||
case '8':case '9':
|
||||
f++;
|
||||
insertnr=insertnr*10+*f-'0';
|
||||
f++;
|
||||
break;
|
||||
default:
|
||||
f++;
|
||||
break;
|
||||
}
|
||||
if (*f=='!') {
|
||||
f++;
|
||||
if (NULL!=(x=lstrchrA(f,'!'))) {
|
||||
*x='\0';
|
||||
fmtstr=HeapAlloc(GetProcessHeap(),0,lstrlenA(f)+2);
|
||||
wsprintfA(fmtstr,"%%%s",f);
|
||||
f=x+1;
|
||||
} else {
|
||||
len = lstrlenA(f);
|
||||
fmtstr=HeapAlloc(GetProcessHeap(),0,len + 1);
|
||||
wsprintfA(fmtstr,"%%%s",f);
|
||||
f+=lstrlenA(f); /*at \0*/
|
||||
}
|
||||
} else
|
||||
if(!Arguments)
|
||||
break;
|
||||
else {
|
||||
fmtstr = HeapAlloc( GetProcessHeap(),0, 3 );
|
||||
fmtstr[0] = '%';
|
||||
fmtstr[1] = 's';
|
||||
fmtstr[2] = 0;
|
||||
}
|
||||
if (Arguments) {
|
||||
if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY)
|
||||
argliststart=Arguments+insertnr-1;
|
||||
else
|
||||
argliststart=(*(DWORD**)Arguments)+insertnr-1;
|
||||
|
||||
if (fmtstr[lstrlenA(fmtstr)-1]=='s')
|
||||
sprintfbuf=HeapAlloc(GetProcessHeap(),0,lstrlenA((LPSTR)argliststart[0])+1);
|
||||
else
|
||||
sprintfbuf=HeapAlloc(GetProcessHeap(),0,100);
|
||||
|
||||
/* CMF - This makes a BIG assumption about va_list */
|
||||
wvsprintfA(sprintfbuf, fmtstr, (va_list) argliststart);
|
||||
x=sprintfbuf;
|
||||
while (*x) {
|
||||
ADD_TO_T(*x++);
|
||||
}
|
||||
HeapFree(GetProcessHeap(),0,sprintfbuf);
|
||||
} else {
|
||||
/* NULL Arguments - copy formatstr
|
||||
* (probably wrong)
|
||||
*/
|
||||
while ((lastf<f)&&(*lastf)) {
|
||||
ADD_TO_T(*lastf++);
|
||||
}
|
||||
}
|
||||
HeapFree(GetProcessHeap(),0,fmtstr);
|
||||
break;
|
||||
case 'n':
|
||||
/* FIXME: perhaps add \r too? */
|
||||
ADD_TO_T('\n');
|
||||
f++;
|
||||
break;
|
||||
case '0':
|
||||
nolinefeed=1;
|
||||
f++;
|
||||
break;
|
||||
default:ADD_TO_T(*f++)
|
||||
break;
|
||||
|
||||
}
|
||||
} else {
|
||||
ADD_TO_T(*f++)
|
||||
}
|
||||
}
|
||||
*t='\0';
|
||||
}
|
||||
if (!nolinefeed) {
|
||||
/* add linefeed */
|
||||
if(t==target || t[-1]!='\n')
|
||||
ADD_TO_T('\n'); /* FIXME: perhaps add \r too? */
|
||||
}
|
||||
talloced = lstrlenA(target)+1;
|
||||
if (nSize && talloced<nSize) {
|
||||
target = (char*)HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,nSize);
|
||||
}
|
||||
// //TRACE(resource,"-- %s\n",debugstr_a(target));
|
||||
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
|
||||
/* nSize is the MINIMUM size */
|
||||
*((LPVOID*)lpBuffer) = (LPVOID)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,talloced);
|
||||
CopyMemory(*(LPSTR*)lpBuffer,target,talloced);
|
||||
} else
|
||||
strncpy(lpBuffer,target,nSize);
|
||||
HeapFree(GetProcessHeap(),0,target);
|
||||
if (from) HeapFree(GetProcessHeap(),0,from);
|
||||
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
|
||||
lstrlenA(*(LPSTR*)lpBuffer):
|
||||
lstrlenA(lpBuffer);
|
||||
}
|
||||
#undef ADD_TO_T
|
||||
|
||||
|
||||
DWORD STDCALL FormatMessageW(
|
||||
DWORD dwFlags,
|
||||
LPCVOID lpSource,
|
||||
DWORD dwMessageId,
|
||||
DWORD dwLanguageId,
|
||||
LPWSTR lpBuffer,
|
||||
DWORD nSize,
|
||||
va_list *Arguments
|
||||
) {
|
||||
LPWSTR target,t;
|
||||
DWORD talloced;
|
||||
LPWSTR from,f;
|
||||
//DWORD width = dwFlags & FORMAT_MESSAGE_MAX_WIDTH_MASK;
|
||||
DWORD nolinefeed = 0;
|
||||
DWORD len;
|
||||
////TRACE(resource, "(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)\n",
|
||||
// dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,Arguments);
|
||||
//if (width)
|
||||
// FIXME(resource,"line wrapping not supported.\n");
|
||||
from = NULL;
|
||||
if (dwFlags & FORMAT_MESSAGE_FROM_STRING) {
|
||||
len = lstrlenW((LPWSTR)lpSource);
|
||||
from = HeapAlloc( GetProcessHeap(),0, (len+1)*2 );
|
||||
CopyMemory(from,lpSource,(len+1)*2);
|
||||
}
|
||||
else if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) {
|
||||
from = HeapAlloc( GetProcessHeap(),0,200 );
|
||||
wsprintfW(from,L"Systemmessage, messageid = 0x%08lx\n",dwMessageId);
|
||||
}
|
||||
else if (dwFlags & FORMAT_MESSAGE_FROM_HMODULE) {
|
||||
INT bufsize;
|
||||
|
||||
dwMessageId &= 0xFFFF;
|
||||
bufsize=LoadMessageW((HMODULE)lpSource,dwMessageId,dwLanguageId,NULL,100);
|
||||
if (bufsize) {
|
||||
from = HeapAlloc( GetProcessHeap(), 0, (bufsize + 1)*sizeof(WCHAR) );
|
||||
LoadMessageW((HMODULE)lpSource,dwMessageId,dwLanguageId,from,(bufsize + 1)*sizeof(WCHAR));
|
||||
}
|
||||
}
|
||||
target = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 100);
|
||||
t = target;
|
||||
talloced= 100;
|
||||
|
||||
#define ADD_TO_T(c) \
|
||||
*t++=c;\
|
||||
if (t-target == talloced) {\
|
||||
target = (WCHAR *)HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,talloced*2);\
|
||||
t = target+talloced;\
|
||||
talloced*=2;\
|
||||
}
|
||||
|
||||
if (from) {
|
||||
f=from;
|
||||
while (*f && !nolinefeed) {
|
||||
if (*f=='%') {
|
||||
int insertnr;
|
||||
wchar_t *fmtstr,*sprintfbuf,*x,*lastf;
|
||||
DWORD *argliststart;
|
||||
|
||||
fmtstr = NULL;
|
||||
lastf = f;
|
||||
f++;
|
||||
if (!*f) {
|
||||
ADD_TO_T('%');
|
||||
continue;
|
||||
}
|
||||
switch (*f) {
|
||||
case '1':case '2':case '3':case '4':case '5':
|
||||
case '6':case '7':case '8':case '9':
|
||||
insertnr=*f-'0';
|
||||
switch (f[1]) {
|
||||
case '0':case '1':case '2':case '3':
|
||||
case '4':case '5':case '6':case '7':
|
||||
case '8':case '9':
|
||||
f++;
|
||||
insertnr=insertnr*10+*f-'0';
|
||||
f++;
|
||||
break;
|
||||
default:
|
||||
f++;
|
||||
break;
|
||||
}
|
||||
if (*f=='!') {
|
||||
f++;
|
||||
if (NULL!=(x=lstrchrW(f,'!'))) {
|
||||
*x='\0';
|
||||
len = lstrlenW(f);
|
||||
fmtstr=HeapAlloc(GetProcessHeap(),0,(len+1)*2);
|
||||
wsprintfW(fmtstr,L"%%%s",f);
|
||||
f=x+1;
|
||||
} else {
|
||||
len = lstrlenW(f);
|
||||
fmtstr=HeapAlloc(GetProcessHeap(),0,(len+1)*2);
|
||||
wsprintfW(fmtstr,L"%%%s",f);
|
||||
f+=len; /*at \0*/
|
||||
}
|
||||
} else
|
||||
if(!Arguments)
|
||||
break;
|
||||
else {
|
||||
fmtstr = HeapAlloc( GetProcessHeap(),0, 6 );
|
||||
fmtstr[0] = '%';
|
||||
fmtstr[1] = 's';
|
||||
fmtstr[2] = 0;
|
||||
}
|
||||
if (Arguments) {
|
||||
if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY)
|
||||
argliststart=Arguments+insertnr-1;
|
||||
else
|
||||
argliststart=(*(DWORD**)Arguments)+insertnr-1;
|
||||
|
||||
if (fmtstr[lstrlenW(fmtstr)-1]=='s')
|
||||
sprintfbuf=HeapAlloc(GetProcessHeap(),0,lstrlenW((LPWSTR)argliststart[0])+1);
|
||||
else
|
||||
sprintfbuf=HeapAlloc(GetProcessHeap(),0,100);
|
||||
|
||||
/* CMF - This makes a BIG assumption about va_list */
|
||||
wvsprintfW(sprintfbuf, fmtstr, (va_list) argliststart);
|
||||
x=sprintfbuf;
|
||||
while (*x) {
|
||||
ADD_TO_T(*x++);
|
||||
}
|
||||
HeapFree(GetProcessHeap(),0,sprintfbuf);
|
||||
} else {
|
||||
/* NULL Arguments - copy formatstr
|
||||
* (probably wrong)
|
||||
*/
|
||||
while ((lastf<f)&&(*lastf)) {
|
||||
ADD_TO_T(*lastf++);
|
||||
}
|
||||
}
|
||||
HeapFree(GetProcessHeap(),0,fmtstr);
|
||||
break;
|
||||
case 'n':
|
||||
/* FIXME: perhaps add \r too? */
|
||||
ADD_TO_T('\n');
|
||||
f++;
|
||||
break;
|
||||
case '0':
|
||||
nolinefeed=1;
|
||||
f++;
|
||||
break;
|
||||
default:ADD_TO_T(*f++)
|
||||
break;
|
||||
|
||||
}
|
||||
} else {
|
||||
ADD_TO_T(*f++)
|
||||
}
|
||||
}
|
||||
*t='\0';
|
||||
}
|
||||
if (!nolinefeed) {
|
||||
/* add linefeed */
|
||||
if(t==target || t[-1]!='\n')
|
||||
ADD_TO_T('\n'); /* FIXME: perhaps add \r too? */
|
||||
}
|
||||
talloced = (lstrlenW(target)+1)*sizeof(WCHAR);
|
||||
if (nSize && talloced<nSize) {
|
||||
target = (LPWSTR)HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,nSize);
|
||||
}
|
||||
////TRACE(resource,"-- %s\n",debugstr_a(target));
|
||||
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
|
||||
/* nSize is the MINIMUM size */
|
||||
*((LPVOID*)lpBuffer) = (LPVOID)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,talloced);
|
||||
CopyMemory(*(LPSTR*)lpBuffer,target,talloced);
|
||||
} else
|
||||
wcsncpy(lpBuffer,target,nSize);
|
||||
HeapFree(GetProcessHeap(),0,target);
|
||||
if (from) HeapFree(GetProcessHeap(),0,from);
|
||||
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
|
||||
lstrlenW(*(LPWSTR*)lpBuffer):
|
||||
lstrlenW(lpBuffer);
|
||||
}
|
||||
#undef ADD_TO_T
|
||||
|
||||
DWORD LoadMessageA(HMODULE hModule,DWORD dwMessageId,DWORD dwLanguageId,LPSTR Buffer,UINT BufSize)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD LoadMessageW(HMODULE hModule,DWORD dwMessageId,DWORD dwLanguageId,LPWSTR Buffer,UINT BufSize)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LPSTR lstrchrA(LPCSTR s, INT c)
|
||||
{
|
||||
char cc = c;
|
||||
while (*s)
|
||||
{
|
||||
if (*s == cc)
|
||||
return (char *)s;
|
||||
s++;
|
||||
}
|
||||
if (cc == 0)
|
||||
return (char *)s;
|
||||
return 0;
|
||||
}
|
||||
|
||||
LPWSTR lstrchrW(LPCWSTR s, int c)
|
||||
{
|
||||
WCHAR cc = c;
|
||||
while (*s)
|
||||
{
|
||||
if (*s == cc)
|
||||
return (LPWSTR)s;
|
||||
s++;
|
||||
}
|
||||
if (cc == 0)
|
||||
return (LPWSTR)s;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
VOID STDCALL OutputDebugStringA(LPCSTR lpOutputString)
|
||||
{
|
||||
|
||||
WCHAR DebugStringW[161];
|
||||
int i,j;
|
||||
i = 0;
|
||||
j = 0;
|
||||
while ( lpOutputString[i] != 0 )
|
||||
{
|
||||
while ( j < 160 && lpOutputString[i] != 0 )
|
||||
{
|
||||
DebugStringW[j] = (WCHAR)lpOutputString[i];
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
DebugStringW[j] = 0;
|
||||
OutputDebugStringW(DebugStringW);
|
||||
j = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
OutputDebugStringW(
|
||||
LPCWSTR lpOutputString
|
||||
)
|
||||
{
|
||||
UNICODE_STRING UnicodeOutput;
|
||||
|
||||
UnicodeOutput.Buffer = (WCHAR *)lpOutputString;
|
||||
UnicodeOutput.Length = lstrlenW(lpOutputString)*sizeof(WCHAR);
|
||||
UnicodeOutput.MaximumLength = UnicodeOutput.Length;
|
||||
|
||||
NtDisplayString(&UnicodeOutput);
|
||||
}
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
|
@ -1,309 +0,0 @@
|
|||
#include <windows.h>
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetUserObjectInformationA(
|
||||
HANDLE hObj,
|
||||
int nIndex,
|
||||
PVOID pvInfo,
|
||||
DWORD nLength,
|
||||
LPDWORD lpnLengthNeeded)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetUserObjectInformationA(
|
||||
HANDLE hObj,
|
||||
int nIndex,
|
||||
PVOID pvInfo,
|
||||
DWORD nLength)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
HKL
|
||||
STDCALL
|
||||
LoadKeyboardLayoutA(
|
||||
LPCSTR pwszKLID,
|
||||
UINT Flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetKeyboardLayoutNameA(
|
||||
LPSTR pwszKLID)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HHOOK
|
||||
STDCALL
|
||||
SetWindowsHookA(
|
||||
int nFilterType,
|
||||
HOOKPROC lpfn)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
DrawTextExA(HDC HDC, LPSTR str, int i, LPRECT r, UINT u, LPDRAWTEXTPARAMS x) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GrayStringA(
|
||||
HDC hDC,
|
||||
HBRUSH hBrush,
|
||||
GRAYSTRINGPROC lpOutputFunc,
|
||||
LPARAM lpData,
|
||||
int nCount,
|
||||
int X,
|
||||
int Y,
|
||||
int nWidth,
|
||||
int nHeight) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DrawStateA(HDC hDC, HBRUSH hBrush, DRAWSTATEPROC p, LPARAM lParam, WPARAM wParam, int i, int j, int k, int l, UINT u) { return 0; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HWND
|
||||
STDCALL
|
||||
FindWindowA(
|
||||
LPCSTR lpClassName ,
|
||||
LPCSTR lpWindowName) { return 0; }
|
||||
|
||||
HWND
|
||||
STDCALL
|
||||
FindWindowExA(HWND hWnd, HWND hWnd2, LPCSTR str, LPCSTR s) { return 0; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
GetClipboardFormatNameA(
|
||||
UINT format,
|
||||
LPSTR lpszFormatName,
|
||||
int cchMaxCount) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
CharToOemA(
|
||||
LPCSTR lpszSrc,
|
||||
LPSTR lpszDst) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
OemToCharA(
|
||||
LPCSTR lpszSrc,
|
||||
LPSTR lpszDst) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
CharToOemBuffA(
|
||||
LPCSTR lpszSrc,
|
||||
LPSTR lpszDst,
|
||||
DWORD cchDstLength) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
OemToCharBuffA(
|
||||
LPCSTR lpszSrc,
|
||||
LPSTR lpszDst,
|
||||
DWORD cchDstLength) { return 0; }
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
GetKeyNameTextA(
|
||||
LONG lParam,
|
||||
LPSTR lpString,
|
||||
int nSize
|
||||
) { return 0; }
|
||||
|
||||
SHORT
|
||||
STDCALL
|
||||
VkKeyScanA(
|
||||
CHAR ch) { return 0; }
|
||||
|
||||
SHORT
|
||||
STDCALL VkKeyScanExA(
|
||||
CHAR ch,
|
||||
HKL dwhkl) { return 0; }
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
MapVirtualKeyA(
|
||||
UINT uCode,
|
||||
UINT uMapType) { return 0; }
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
MapVirtualKeyExA(
|
||||
UINT uCode,
|
||||
UINT uMapType,
|
||||
HKL dwhkl) { return 0; }
|
||||
|
||||
HACCEL
|
||||
STDCALL
|
||||
LoadAcceleratorsA(
|
||||
HINSTANCE hInstance,
|
||||
LPCSTR lpTableName) { return 0; }
|
||||
|
||||
HACCEL
|
||||
STDCALL
|
||||
CreateAcceleratorTableA(
|
||||
LPACCEL l, int i) { return 0; }
|
||||
|
||||
int
|
||||
STDCALL
|
||||
CopyAcceleratorTableA(
|
||||
HACCEL hAccelSrc,
|
||||
LPACCEL lpAccelDst,
|
||||
int cAccelEntries) { return 0; }
|
||||
|
||||
int
|
||||
STDCALL
|
||||
TranslateAcceleratorA(
|
||||
HWND hWnd,
|
||||
HACCEL hAccTable,
|
||||
LPMSG lpMsg) { return 0; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HCURSOR
|
||||
STDCALL
|
||||
LoadCursorFromFileA(
|
||||
LPCSTR lpFileName) { return 0; }
|
||||
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
LoadImageA(
|
||||
HINSTANCE hInst,
|
||||
LPCSTR str,
|
||||
UINT u,
|
||||
int i,
|
||||
int j,
|
||||
UINT k) { return 0; }
|
||||
|
||||
int
|
||||
STDCALL
|
||||
DlgDirListA(
|
||||
HWND hDlg,
|
||||
LPSTR lpPathSpec,
|
||||
int nIDListBox,
|
||||
int nIDStaticPath,
|
||||
UINT uFileType) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DlgDirSelectExA(
|
||||
HWND hDlg,
|
||||
LPSTR lpString,
|
||||
int nCount,
|
||||
int nIDListBox) { return 0; }
|
||||
|
||||
int
|
||||
STDCALL
|
||||
DlgDirListComboBoxA(
|
||||
HWND hDlg,
|
||||
LPSTR lpPathSpec,
|
||||
int nIDComboBox,
|
||||
int nIDStaticPath,
|
||||
UINT uFiletype) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DlgDirSelectComboBoxExA(
|
||||
HWND hDlg,
|
||||
LPSTR lpString,
|
||||
int nCount,
|
||||
int nIDComboBox) { return 0; }
|
||||
|
||||
LRESULT
|
||||
STDCALL
|
||||
DefFrameProcA(
|
||||
HWND hWnd,
|
||||
HWND hWndMDIClient ,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam) { return 0; }
|
||||
|
||||
LRESULT
|
||||
STDCALL
|
||||
DefMDIChildProcA(
|
||||
HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam) { return 0; }
|
||||
|
||||
HWND
|
||||
STDCALL
|
||||
CreateMDIWindowA(
|
||||
LPSTR lpClassName,
|
||||
LPSTR lpWindowName,
|
||||
DWORD dwStyle,
|
||||
int X,
|
||||
int Y,
|
||||
int nWidth,
|
||||
int nHeight,
|
||||
HWND hWndParent,
|
||||
HINSTANCE hInstance,
|
||||
LPARAM lParam
|
||||
) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
WinHelpA(
|
||||
HWND hWndMain,
|
||||
LPCSTR lpszHelp,
|
||||
UINT uCommand,
|
||||
DWORD dwData
|
||||
) { return 0; }
|
||||
|
||||
LONG
|
||||
STDCALL
|
||||
ChangeDisplaySettingsA(
|
||||
LPDEVMODE lpDevMode,
|
||||
DWORD dwFlags) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
EnumDisplaySettingsA(
|
||||
LPCSTR lpszDeviceName,
|
||||
DWORD iModeNum,
|
||||
LPDEVMODE lpDevMode) { return 0; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HSZ WINAPI
|
||||
DdeCreateStringHandleA (DWORD dw, LPSTR str, int i) { return 0; }
|
||||
|
||||
UINT WINAPI
|
||||
DdeInitializeA (DWORD *dw, CALLB c, DWORD x, DWORD y) { return 0; }
|
||||
|
||||
DWORD WINAPI
|
||||
DdeQueryStringA (DWORD dw, HSZ h, LPSTR str, DWORD t, int i) { return 0; }
|
|
@ -1,321 +0,0 @@
|
|||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetUserObjectInformationW(
|
||||
HANDLE hObj,
|
||||
int nIndex,
|
||||
PVOID pvInfo,
|
||||
DWORD nLength,
|
||||
LPDWORD lpnLengthNeeded)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetUserObjectInformationW(
|
||||
HANDLE hObj,
|
||||
int nIndex,
|
||||
PVOID pvInfo,
|
||||
DWORD nLength)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HKL
|
||||
STDCALL
|
||||
LoadKeyboardLayoutW(
|
||||
LPCWSTR pwszKLID,
|
||||
UINT Flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetKeyboardLayoutNameW(
|
||||
LPWSTR pwszKLID)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
HHOOK
|
||||
STDCALL
|
||||
SetWindowsHookW(
|
||||
int nFilterType,
|
||||
HOOKPROC lpfn)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
DrawTextExW(HDC hDC, LPWSTR str, int i, LPRECT r, UINT u, LPDRAWTEXTPARAMS p) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GrayStringW(
|
||||
HDC hDC,
|
||||
HBRUSH hBrush,
|
||||
GRAYSTRINGPROC lpOutputFunc,
|
||||
LPARAM lpData,
|
||||
int nCount,
|
||||
int X,
|
||||
int Y,
|
||||
int nWidth,
|
||||
int nHeight) { return 0; }
|
||||
|
||||
WINBOOL STDCALL DrawStateW(HDC hDC, HBRUSH hBrush, DRAWSTATEPROC d, LPARAM lParam, WPARAM wParam, int i, int j, int k, int l, UINT u) { return 0; }
|
||||
|
||||
|
||||
|
||||
|
||||
HWND
|
||||
STDCALL
|
||||
FindWindowW(
|
||||
LPCWSTR lpClassName ,
|
||||
LPCWSTR lpWindowName) { return 0; }
|
||||
|
||||
HWND
|
||||
STDCALL
|
||||
FindWindowExW(HWND hWnd, HWND hWnd2, LPCWSTR str, LPCWSTR s) { return 0; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
GetClipboardFormatNameW(
|
||||
UINT format,
|
||||
LPWSTR lpszFormatName,
|
||||
int cchMaxCount) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
CharToOemW(
|
||||
LPCWSTR lpszSrc,
|
||||
LPSTR lpszDst) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
OemToCharW(
|
||||
LPCSTR lpszSrc,
|
||||
LPWSTR lpszDst) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
CharToOemBuffW(
|
||||
LPCWSTR lpszSrc,
|
||||
LPSTR lpszDst,
|
||||
DWORD cchDstLength) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
OemToCharBuffW(
|
||||
LPCSTR lpszSrc,
|
||||
LPWSTR lpszDst,
|
||||
DWORD cchDstLength) { return 0; }
|
||||
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
GetKeyNameTextW(
|
||||
LONG lParam,
|
||||
LPWSTR lpString,
|
||||
int nSize
|
||||
) { return 0; }
|
||||
|
||||
SHORT
|
||||
STDCALL
|
||||
VkKeyScanW(
|
||||
WCHAR ch) { return 0; }
|
||||
|
||||
SHORT
|
||||
STDCALL VkKeyScanExW(
|
||||
WCHAR ch,
|
||||
HKL dwhkl) { return 0; }
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
MapVirtualKeyW(
|
||||
UINT uCode,
|
||||
UINT uMapType) { return 0; }
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
MapVirtualKeyExW(
|
||||
UINT uCode,
|
||||
UINT uMapType,
|
||||
HKL dwhkl) { return 0; }
|
||||
|
||||
HACCEL
|
||||
STDCALL
|
||||
LoadAcceleratorsW(
|
||||
HINSTANCE hInstance,
|
||||
LPCWSTR lpTableName) { return 0; }
|
||||
|
||||
HACCEL
|
||||
STDCALL
|
||||
CreateAcceleratorTableW(
|
||||
LPACCEL l, int i) { return 0; }
|
||||
|
||||
int
|
||||
STDCALL
|
||||
CopyAcceleratorTableW(
|
||||
HACCEL hAccelSrc,
|
||||
LPACCEL lpAccelDst,
|
||||
int cAccelEntries) { return 0; }
|
||||
|
||||
int
|
||||
STDCALL
|
||||
TranslateAcceleratorW(
|
||||
HWND hWnd,
|
||||
HACCEL hAccTable,
|
||||
LPMSG lpMsg) { return 0; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HCURSOR
|
||||
STDCALL
|
||||
LoadCursorFromFileW(
|
||||
LPCWSTR lpFileName) { return 0; }
|
||||
|
||||
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
LoadImageW(
|
||||
HINSTANCE hInst,
|
||||
LPCWSTR str,
|
||||
UINT u,
|
||||
int i,
|
||||
int j,
|
||||
UINT k) { return 0; }
|
||||
|
||||
int
|
||||
STDCALL
|
||||
LoadStringW(
|
||||
HINSTANCE hInstance,
|
||||
UINT uID,
|
||||
LPWSTR lpBuffer,
|
||||
int nBufferMax) { return 0; }
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
DlgDirListW(
|
||||
HWND hDlg,
|
||||
LPWSTR lpPathSpec,
|
||||
int nIDListBox,
|
||||
int nIDStaticPath,
|
||||
UINT uFileType) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DlgDirSelectExW(
|
||||
HWND hDlg,
|
||||
LPWSTR lpString,
|
||||
int nCount,
|
||||
int nIDListBox) { return 0; }
|
||||
|
||||
int
|
||||
STDCALL
|
||||
DlgDirListComboBoxW(
|
||||
HWND hDlg,
|
||||
LPWSTR lpPathSpec,
|
||||
int nIDComboBox,
|
||||
int nIDStaticPath,
|
||||
UINT uFiletype) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DlgDirSelectComboBoxExW(
|
||||
HWND hDlg,
|
||||
LPWSTR lpString,
|
||||
int nCount,
|
||||
int nIDComboBox) { return 0; }
|
||||
|
||||
LRESULT
|
||||
STDCALL
|
||||
DefFrameProcW(
|
||||
HWND hWnd,
|
||||
HWND hWndMDIClient ,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam) { return 0; }
|
||||
|
||||
LRESULT
|
||||
STDCALL
|
||||
DefMDIChildProcW(
|
||||
HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam) { return 0; }
|
||||
|
||||
HWND
|
||||
STDCALL
|
||||
CreateMDIWindowW(
|
||||
LPWSTR lpClassName,
|
||||
LPWSTR lpWindowName,
|
||||
DWORD dwStyle,
|
||||
int X,
|
||||
int Y,
|
||||
int nWidth,
|
||||
int nHeight,
|
||||
HWND hWndParent,
|
||||
HINSTANCE hInstance,
|
||||
LPARAM lParam
|
||||
) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
WinHelpW(
|
||||
HWND hWndMain,
|
||||
LPCWSTR lpszHelp,
|
||||
UINT uCommand,
|
||||
DWORD dwData
|
||||
) { return 0; }
|
||||
|
||||
LONG
|
||||
STDCALL
|
||||
ChangeDisplaySettingsW(
|
||||
LPDEVMODE lpDevMode,
|
||||
DWORD dwFlags) { return 0; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
EnumDisplaySettingsW(
|
||||
LPCWSTR lpszDeviceName,
|
||||
DWORD iModeNum,
|
||||
LPDEVMODE lpDevMode) { return 0; }
|
||||
|
||||
|
||||
|
||||
|
||||
HSZ WINAPI
|
||||
DdeCreateStringHandleW (DWORD dw, LPCWSTR str, int i) { return 0; }
|
||||
|
||||
UINT WINAPI
|
||||
DdeInitializeW (DWORD *dw, CALLB c, DWORD x, DWORD y) { return 0; }
|
||||
|
||||
DWORD WINAPI
|
||||
DdeQueryStringW (DWORD dw, HSZ h, LPCWSTR str, DWORD t, int i) { return 0; }
|
|
@ -1,279 +0,0 @@
|
|||
/*
|
||||
* System metrics functions
|
||||
*
|
||||
* Copyright 1994 Alexandre Julliard
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <user32/sysmetr.h>
|
||||
|
||||
#undef SM_CMETRICS
|
||||
#define SM_CMETRICS (83)
|
||||
|
||||
short sysMetrics[SM_CMETRICS+1] = {
|
||||
|
||||
800, // [SM_CXSCREEN] /* 0 */
|
||||
600, // [SM_CYSCREEN] /* 1 */
|
||||
19, // [SM_CXVSCROLL] /* 2 */
|
||||
17, // [SM_CYHSCROLL] /* 3 */
|
||||
19, // [SM_CYCAPTION] /* 4 */
|
||||
1, // [SM_CXBORDER] /* 5 */
|
||||
1, // [SM_CYBORDER] /* 6 */
|
||||
3, // [SM_CXDLGFRAME] /* 7 */
|
||||
3, // [SM_CYDLGFRAME] /* 8 */
|
||||
17, // [SM_CYVTHUMB] /* 9 */ sysMetrics[SM_CXVSCROLL] - 1;
|
||||
17, // [SM_CXHTHUMB] /* 10 */ sysMetrics[SM_CXVSCROLL] - 1;
|
||||
32, // [SM_CXICON] /* 11 */
|
||||
32, // [SM_CYICON] /* 12 */
|
||||
32, // [SM_CXCURSOR] /* 13 */
|
||||
32, // [SM_CYCURSOR] /* 14 */
|
||||
19, // [SM_CYMENU] /* 15 */
|
||||
800, // [SM_CXFULLSCREEN] /* 16 */
|
||||
600, // [SM_CYFULLSCREEN] /* 17 */
|
||||
0, // [SM_CYKANJIWINDOW] /* 18 */
|
||||
0, // [SM_MOUSEPRESENT] /* 19 */
|
||||
0, // [SM_CYVSCROLL] /* 20 */
|
||||
0, // [SM_CXHSCROLL] /* 21 */
|
||||
0, // [SM_DEBUG] /* 22 */
|
||||
0, // [SM_SWAPBUTTON] /* 23 */
|
||||
0, // [SM_RESERVED1] /* 24 */
|
||||
0, // [SM_RESERVED2] /* 25 */
|
||||
0, // [SM_RESERVED3] /* 26 */
|
||||
0, // [SM_RESERVED4] /* 27 */
|
||||
112, // [SM_CXMIN] /* 28 */
|
||||
27, // [SM_CYMIN] /* 29 */
|
||||
17, // [SM_CXSIZE] /* 30 */
|
||||
17, // [SM_CYSIZE] /* 31 */
|
||||
4, // [SM_CXFRAME] /* 32 */
|
||||
4, // [SM_CYFRAME] /* 33 */
|
||||
0, // [SM_CXMINTRACK] /* 34 */
|
||||
0, // [SM_CYMINTRACK] /* 35 */
|
||||
0, // [SM_CXDOUBLECLK] /* 36 */
|
||||
0, // [SM_CYDOUBLECLK] /* 37 */
|
||||
0, // [SM_CXICONSPACING] /* 38 */
|
||||
0, // [SM_CYICONSPACING] /* 39 */
|
||||
0, // [SM_MENUDROPALIGNMENT] /* 40 */
|
||||
0, // [SM_PENWINDOWS] /* 41 */
|
||||
0, // [SM_DBCSENABLED] /* 42 */
|
||||
0, // [SM_CMOUSEBUTTONS] /* 43 */
|
||||
// [SM_CXDLGFRAME] /* win40 name change */
|
||||
// [SM_CYDLGFRAME] /* win40 name change */
|
||||
// [SM_CXFRAME] /* win40 name change */
|
||||
// [SM_CYFRAME] /* win40 name change */
|
||||
0, // [SM_SECURE] /* 44 */
|
||||
2, // [SM_CXEDGE] /* 45 */ // sysMetrics[SM_CXBORDER] + 1;
|
||||
2, // [SM_CYEDGE] /* 46 */
|
||||
0, // [SM_CXMINSPACING] /* 47 */
|
||||
0, // [SM_CYMINSPACING] /* 48 */
|
||||
14, // [SM_CXSMICON] /* 49 */
|
||||
14, // [SM_CYSMICON] /* 50 */
|
||||
0, // [SM_CYSMCAPTION] /* 51 */
|
||||
0, // [SM_CXSMSIZE] /* 52 */
|
||||
0, // [SM_CYSMSIZE] /* 53 */
|
||||
19, // [SM_CXMENUSIZE] /* 54 */
|
||||
19, // [SM_CYMENUSIZE] /* 55 */
|
||||
8, // [SM_ARRANGE] /* 56 */
|
||||
160, // [SM_CXMINIMIZED] /* 57 */
|
||||
24, // [SM_CYMINIMIZED] /* 58 */
|
||||
0, // [SM_CXMAXTRACK] /* 59 */
|
||||
0, // [SM_CYMAXTRACK] /* 60 */
|
||||
0, // [SM_CXMAXIMIZED] /* 61 */
|
||||
0, // [SM_CYMAXIMIZED] /* 62 */
|
||||
3, // [SM_NETWORK] /* 63 */
|
||||
0, // [SM_CLEANBOOT] /* 67 */
|
||||
2, // [SM_CXDRAG] /* 68 */
|
||||
2, // [SM_CYDRAG] /* 69 */
|
||||
0, // [SM_SHOWSOUNDS] /* 70 */
|
||||
2, // [SM_CXMENUCHECK] /* 71 */
|
||||
2, // [SM_CYMENUCHECK] /* 72 */
|
||||
0, // [SM_SLOWMACHINE] /* 73 */
|
||||
0, // [SM_MIDEASTENABLED] /* 74 */
|
||||
0, // [SM_MOUSEWHEELPRESENT] /* 75 */
|
||||
800, // [SM_CXVIRTUALSCREEN] /* 76 */
|
||||
600, // [SM_CYVIRTUALSCREEN] /* 77 */
|
||||
0, // [SM_YVIRTUALSCREEN] /* 78 */
|
||||
0, // [SM_XVIRTUALSCREEN] /* 79 */
|
||||
1, // [SM_CMONITORS] /* 81 */
|
||||
1 // [SM_SAMEDISPLAYFORMAT] /* 82 */
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
int STDCALL GetSystemMetrics(int nIndex)
|
||||
{
|
||||
if ( nIndex >= 0 && nIndex <= SM_CMETRICS+1 )
|
||||
return sysMetrics[nIndex];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL SystemParametersInfoA(UINT uiAction,
|
||||
UINT uiParam, PVOID pvParam, UINT fWinIni )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WINBOOL STDCALL SystemParametersInfoW(UINT uiAction,
|
||||
UINT uiParam, PVOID pvParam, UINT fWinIni )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
#if 0
|
||||
/***********************************************************************
|
||||
* SYSMETRICS_Init
|
||||
*
|
||||
* Initialisation of the system metrics array.
|
||||
*
|
||||
* Differences in return values between 3.1 and 95 apps under Win95 (FIXME ?):
|
||||
* SM_CXVSCROLL x+1 x
|
||||
* SM_CYHSCROLL x+1 x
|
||||
* SM_CXDLGFRAME x-1 x
|
||||
* SM_CYDLGFRAME x-1 x
|
||||
* SM_CYCAPTION x+1 x
|
||||
* SM_CYMENU x-1 x
|
||||
* SM_CYFULLSCREEN x-1 x
|
||||
*
|
||||
* (collides with TWEAK_WineLook sometimes,
|
||||
* so changing anything might be difficult)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
void SYSMETRICS_Init(void)
|
||||
{
|
||||
sysMetrics[SM_CXCURSOR] = 32;
|
||||
sysMetrics[SM_CYCURSOR] = 32;
|
||||
sysMetrics[SM_CXSCREEN] = screenWidth;
|
||||
sysMetrics[SM_CYSCREEN] = screenHeight;
|
||||
sysMetrics[SM_CXVSCROLL] =
|
||||
PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 16) + 1;
|
||||
sysMetrics[SM_CYHSCROLL] = sysMetrics[SM_CXVSCROLL];
|
||||
if (TWEAK_WineLook > WIN31_LOOK)
|
||||
sysMetrics[SM_CYCAPTION] =
|
||||
PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 19);
|
||||
else
|
||||
sysMetrics[SM_CYCAPTION] = 2 +
|
||||
PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 18);
|
||||
sysMetrics[SM_CXBORDER] = 1;
|
||||
sysMetrics[SM_CYBORDER] = sysMetrics[SM_CXBORDER];
|
||||
sysMetrics[SM_CXDLGFRAME] =
|
||||
PROFILE_GetWineIniInt("Tweak.Layout", "DialogFrameWidth",
|
||||
(TWEAK_WineLook > WIN31_LOOK) ? 3 : 4);
|
||||
sysMetrics[SM_CYDLGFRAME] = sysMetrics[SM_CXDLGFRAME];
|
||||
*/ sysMetrics[SM_CYVTHUMB] = sysMetrics[SM_CXVSCROLL] - 1;
|
||||
*/ sysMetrics[SM_CXHTHUMB] = sysMetrics[SM_CYVTHUMB];
|
||||
*/ sysMetrics[SM_CXICON] = 32;
|
||||
*/ sysMetrics[SM_CYICON] = 32;
|
||||
if (TWEAK_WineLook > WIN31_LOOK)
|
||||
sysMetrics[SM_CYMENU] =
|
||||
PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 19);
|
||||
else
|
||||
sysMetrics[SM_CYMENU] =
|
||||
PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 18);
|
||||
sysMetrics[SM_CXFULLSCREEN] = sysMetrics[SM_CXSCREEN];
|
||||
sysMetrics[SM_CYFULLSCREEN] =
|
||||
sysMetrics[SM_CYSCREEN] - sysMetrics[SM_CYCAPTION];
|
||||
sysMetrics[SM_CYKANJIWINDOW] = 0;
|
||||
sysMetrics[SM_MOUSEPRESENT] = 1;
|
||||
sysMetrics[SM_CYVSCROLL] = sysMetrics[SM_CYVTHUMB];
|
||||
sysMetrics[SM_CXHSCROLL] = sysMetrics[SM_CXHTHUMB];
|
||||
sysMetrics[SM_DEBUG] = 0;
|
||||
|
||||
/* FIXME: The following should look for the registry key to see if the
|
||||
buttons should be swapped. */
|
||||
sysMetrics[SM_SWAPBUTTON] = 0;
|
||||
|
||||
sysMetrics[SM_RESERVED1] = 0;
|
||||
sysMetrics[SM_RESERVED2] = 0;
|
||||
sysMetrics[SM_RESERVED3] = 0;
|
||||
sysMetrics[SM_RESERVED4] = 0;
|
||||
|
||||
/* FIXME: The following two are calculated, but how? */
|
||||
sysMetrics[SM_CXMIN] = (TWEAK_WineLook > WIN31_LOOK) ? 112 : 100;
|
||||
sysMetrics[SM_CYMIN] = (TWEAK_WineLook > WIN31_LOOK) ? 27 : 28;
|
||||
|
||||
sysMetrics[SM_CXSIZE] = sysMetrics[SM_CYCAPTION] - 2;
|
||||
sysMetrics[SM_CYSIZE] = sysMetrics[SM_CXSIZE];
|
||||
sysMetrics[SM_CXFRAME] = GetProfileInt32A("Windows", "BorderWidth", 4);
|
||||
sysMetrics[SM_CYFRAME] = sysMetrics[SM_CXFRAME];
|
||||
sysMetrics[SM_CXMINTRACK] = sysMetrics[SM_CXMIN];
|
||||
sysMetrics[SM_CYMINTRACK] = sysMetrics[SM_CYMIN];
|
||||
sysMetrics[SM_CXDOUBLECLK] =
|
||||
(GetProfileInt32A("Windows", "DoubleClickWidth", 4) + 1) & ~1;
|
||||
sysMetrics[SM_CYDOUBLECLK] =
|
||||
(GetProfileInt32A("Windows","DoubleClickHeight", 4) + 1) & ~1;
|
||||
sysMetrics[SM_CXICONSPACING] =
|
||||
GetProfileInt32A("Desktop","IconSpacing", 75);
|
||||
sysMetrics[SM_CYICONSPACING] =
|
||||
GetProfileInt32A("Desktop", "IconVerticalSpacing", 75);
|
||||
sysMetrics[SM_MENUDROPALIGNMENT] =
|
||||
GetProfileInt32A("Windows", "MenuDropAlignment", 0);
|
||||
sysMetrics[SM_PENWINDOWS] = 0;
|
||||
sysMetrics[SM_DBCSENABLED] = 0;
|
||||
|
||||
/* FIXME: Need to query X for the following */
|
||||
sysMetrics[SM_CMOUSEBUTTONS] = 3;
|
||||
|
||||
sysMetrics[SM_SECURE] = 0;
|
||||
sysMetrics[SM_CXEDGE] = sysMetrics[SM_CXBORDER] + 1;
|
||||
sysMetrics[SM_CYEDGE] = sysMetrics[SM_CXEDGE];
|
||||
sysMetrics[SM_CXMINSPACING] = 160;
|
||||
sysMetrics[SM_CYMINSPACING] = 24;
|
||||
sysMetrics[SM_CXSMICON] =
|
||||
sysMetrics[SM_CYSIZE] - (sysMetrics[SM_CYSIZE] % 2) - 2;
|
||||
sysMetrics[SM_CYSMICON] = sysMetrics[SM_CXSMICON];
|
||||
sysMetrics[SM_CYSMCAPTION] = 16;
|
||||
sysMetrics[SM_CXSMSIZE] = 15;
|
||||
sysMetrics[SM_CYSMSIZE] = sysMetrics[SM_CXSMSIZE];
|
||||
sysMetrics[SM_CXMENUSIZE] = sysMetrics[SM_CYMENU];
|
||||
sysMetrics[SM_CYMENUSIZE] = sysMetrics[SM_CXMENUSIZE];
|
||||
|
||||
/* FIXME: What do these mean? */
|
||||
sysMetrics[SM_ARRANGE] = 8;
|
||||
sysMetrics[SM_CXMINIMIZED] = 160;
|
||||
sysMetrics[SM_CYMINIMIZED] = 24;
|
||||
|
||||
/* FIXME: How do I calculate these? */
|
||||
sysMetrics[SM_CXMAXTRACK] =
|
||||
sysMetrics[SM_CXSCREEN] + 4 + 2 * sysMetrics[SM_CXFRAME];
|
||||
sysMetrics[SM_CYMAXTRACK] =
|
||||
sysMetrics[SM_CYSCREEN] + 4 + 2 * sysMetrics[SM_CYFRAME];
|
||||
sysMetrics[SM_CXMAXIMIZED] =
|
||||
sysMetrics[SM_CXSCREEN] + 2 * sysMetrics[SM_CXFRAME];
|
||||
sysMetrics[SM_CYMAXIMIZED] =
|
||||
sysMetrics[SM_CYSCREEN] - 45;
|
||||
sysMetrics[SM_NETWORK] = 3;
|
||||
|
||||
/* For the following: 0 = ok, 1 = failsafe, 2 = failsafe + network */
|
||||
sysMetrics[SM_CLEANBOOT] = 0;
|
||||
|
||||
sysMetrics[SM_CXDRAG] = 2;
|
||||
sysMetrics[SM_CYDRAG] = 2;
|
||||
sysMetrics[SM_SHOWSOUNDS] = 0;
|
||||
sysMetrics[SM_CXMENUCHECK] = 2;
|
||||
sysMetrics[SM_CYMENUCHECK] = 2;
|
||||
|
||||
/* FIXME: Should check the type of processor for the following */
|
||||
sysMetrics[SM_SLOWMACHINE] = 0;
|
||||
|
||||
/* FIXME: Should perform a check */
|
||||
sysMetrics[SM_MIDEASTENABLED] = 0;
|
||||
|
||||
sysMetrics[SM_MOUSEWHEELPRESENT] = 0;
|
||||
|
||||
sysMetrics[SM_CXVIRTUALSCREEN] = sysMetrics[SM_CXSCREEN];
|
||||
sysMetrics[SM_CYVIRTUALSCREEN] = sysMetrics[SM_CYSCREEN];
|
||||
sysMetrics[SM_XVIRTUALSCREEN] = 0;
|
||||
sysMetrics[SM_YVIRTUALSCREEN] = 0;
|
||||
sysMetrics[SM_CMONITORS] = 1;
|
||||
sysMetrics[SM_SAMEDISPLAYFORMAT] = 1;
|
||||
sysMetrics[SM_CMETRICS] = SM_CMETRICS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
#include <windows.h>
|
||||
|
||||
SHORT
|
||||
STDCALL
|
||||
GetKeyState( int nVirtKey )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
GetKBCodePage(
|
||||
VOID)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SHORT
|
||||
STDCALL
|
||||
GetAsyncKeyState(
|
||||
int vKey)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetKeyboardState(
|
||||
PBYTE lpKeyState)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetKeyboardState(
|
||||
LPBYTE lpKeyState)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
GetKeyboardType(
|
||||
int nTypeFlag)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
ToAscii(
|
||||
UINT uVirtKey,
|
||||
UINT uScanCode,
|
||||
PBYTE lpKeyState,
|
||||
LPWORD lpChar,
|
||||
UINT uFlags)
|
||||
{
|
||||
return ToAsciiEx(uVirtKey,uScanCode, lpKeyState, lpChar, uFlags, NULL);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
STDCALL
|
||||
ToAsciiEx(
|
||||
UINT uVirtKey,
|
||||
UINT uScanCode,
|
||||
PBYTE lpKeyState,
|
||||
LPWORD lpChar,
|
||||
UINT uFlags,
|
||||
HKL dwhkl)
|
||||
{
|
||||
}
|
|
@ -1,240 +0,0 @@
|
|||
#include <windows.h>
|
||||
|
||||
|
||||
HWINSTA WinStation = NULL;
|
||||
HDESK Desktop = NULL;
|
||||
|
||||
HWINSTA
|
||||
STDCALL
|
||||
CreateWindowStationA(
|
||||
LPSTR lpwinsta,
|
||||
DWORD dwReserved,
|
||||
DWORD dwDesiredAccess,
|
||||
LPSECURITY_ATTRIBUTES lpsa
|
||||
|
||||
)
|
||||
{
|
||||
return CreateFileA("\\\\.\\WinStat",
|
||||
dwDesiredAccess,
|
||||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
0,
|
||||
NULL);
|
||||
}
|
||||
|
||||
HWINSTA
|
||||
STDCALL
|
||||
CreateWindowStationW(
|
||||
LPWSTR lpwinsta,
|
||||
DWORD dwReserved,
|
||||
DWORD dwDesiredAccess,
|
||||
LPSECURITY_ATTRIBUTES lpsa
|
||||
|
||||
)
|
||||
{
|
||||
return CreateFileW(L"\\\\.\\WinStat",
|
||||
dwDesiredAccess,
|
||||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
0,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
#undef CreateDesktop
|
||||
HDESK
|
||||
STDCALL
|
||||
CreateDesktopA(
|
||||
LPSTR lpszDesktop,
|
||||
LPSTR lpszDevice,
|
||||
LPDEVMODE pDevmode,
|
||||
DWORD dwFlags,
|
||||
DWORD dwDesiredAccess,
|
||||
LPSECURITY_ATTRIBUTES lpsa)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
HDESK
|
||||
STDCALL
|
||||
CreateDesktopW(
|
||||
LPWSTR lpszDesktop,
|
||||
LPWSTR lpszDevice,
|
||||
LPDEVMODE pDevmode,
|
||||
DWORD dwFlags,
|
||||
DWORD dwDesiredAccess,
|
||||
LPSECURITY_ATTRIBUTES lpsa)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
HDESK
|
||||
STDCALL
|
||||
OpenInputDesktop(
|
||||
DWORD dwFlags,
|
||||
WINBOOL fInherit,
|
||||
DWORD dwDesiredAccess)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
EnumDesktopWindows(
|
||||
HDESK hDesktop,
|
||||
ENUMWINDOWSPROC lpfn,
|
||||
LPARAM lParam)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SwitchDesktop(
|
||||
HDESK hDesktop)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetThreadDesktop(
|
||||
HDESK hDesktop)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
HDESK
|
||||
STDCALL
|
||||
OpenDesktopA(
|
||||
LPSTR lpszDesktop,
|
||||
DWORD dwFlags,
|
||||
WINBOOL fInherit,
|
||||
DWORD dwDesiredAccess)
|
||||
{
|
||||
return Desktop;
|
||||
}
|
||||
|
||||
HDESK
|
||||
STDCALL
|
||||
OpenDesktopW(
|
||||
LPWSTR lpszDesktop,
|
||||
DWORD dwFlags,
|
||||
WINBOOL fInherit,
|
||||
DWORD dwDesiredAccess)
|
||||
{
|
||||
return Desktop;
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
CloseDesktop(
|
||||
HDESK hDesktop)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HDESK
|
||||
STDCALL
|
||||
GetThreadDesktop(
|
||||
DWORD dwThreadId)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
CloseWindowStation(
|
||||
HWINSTA hWinSta)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
SetProcessWindowStation(
|
||||
HWINSTA hWinSta)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
HWINSTA
|
||||
STDCALL
|
||||
GetProcessWindowStation(
|
||||
VOID)
|
||||
{
|
||||
return WinStation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
EnumDesktopsA(
|
||||
HWINSTA hwinsta,
|
||||
DESKTOPENUMPROC lpEnumFunc,
|
||||
LPARAM lParam) { return FALSE; }
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
EnumDesktopsW(
|
||||
HWINSTA hwinsta,
|
||||
DESKTOPENUMPROC lpEnumFunc,
|
||||
LPARAM lParam) { return FALSE; }
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
WINAPI
|
||||
EnumWindowStationsA(
|
||||
ENUMWINDOWSTATIONPROC lpEnumFunc,
|
||||
LPARAM lParam)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
EnumWindowStationsW(
|
||||
ENUMWINDOWSTATIONPROC lpEnumFunc,
|
||||
LPARAM lParam)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HWINSTA
|
||||
STDCALL
|
||||
OpenWindowStationA(
|
||||
LPSTR lpszWinSta,
|
||||
WINBOOL fInherit,
|
||||
DWORD dwDesiredAccess)
|
||||
{
|
||||
return WinStation;
|
||||
}
|
||||
|
||||
|
||||
HWINSTA
|
||||
STDCALL
|
||||
OpenWindowStationW(
|
||||
LPWSTR lpszWinSta,
|
||||
WINBOOL fInherit,
|
||||
DWORD dwDesiredAccess)
|
||||
{
|
||||
return WinStation;
|
||||
}
|
||||
|
||||
|
||||
HDESK STDCALL GetInputDesktop(VOID) { return Desktop; }
|
|
@ -1,72 +0,0 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <kernel32/error.h>
|
||||
|
||||
/***********************************************************************
|
||||
* SYSRES_GetResourcePtr
|
||||
*
|
||||
* Return a pointer to a system resource.
|
||||
*/
|
||||
LPCVOID SYSRES_GetResPtr( int id )
|
||||
{
|
||||
// return SYSRES_Resources[Options.language][id]->data;
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
STDCALL
|
||||
LoadStringA( HINSTANCE hInstance,
|
||||
UINT uID,
|
||||
LPSTR lpBuffer,
|
||||
int nBufferMax)
|
||||
{
|
||||
HRSRC rsc;
|
||||
PBYTE ptr;
|
||||
int len;
|
||||
int count, dest = uID % 16;
|
||||
PWSTR pwstr;
|
||||
UNICODE_STRING UString;
|
||||
ANSI_STRING AString;
|
||||
NTSTATUS Status;
|
||||
|
||||
rsc = FindResource( (HMODULE)hInstance,
|
||||
MAKEINTRESOURCE( (uID / 16) + 1 ),
|
||||
RT_STRING );
|
||||
if( rsc == NULL )
|
||||
return 0;
|
||||
// get pointer to string table
|
||||
ptr = (PBYTE)LoadResource( (HMODULE)hInstance, rsc );
|
||||
if( ptr == NULL )
|
||||
return 0;
|
||||
for( count = 0; count <= dest; count++ )
|
||||
{
|
||||
// walk each of the 16 string slots in the string table
|
||||
len = (*(USHORT *)ptr) * 2; // length is in unicode chars, convert to bytes
|
||||
ptr += 2; // first 2 bytes are length, string follows
|
||||
pwstr = (PWSTR)ptr;
|
||||
ptr += len;
|
||||
}
|
||||
if( !len )
|
||||
return 0; // zero means no string is there
|
||||
// convert unitocde to ansi, and copy string to caller buffer
|
||||
UString.Length = UString.MaximumLength = len;
|
||||
UString.Buffer = pwstr;
|
||||
memset( &AString, 0, sizeof AString );
|
||||
Status = RtlUnicodeStringToAnsiString( &AString, &UString, TRUE );
|
||||
if( !NT_SUCCESS( Status ) )
|
||||
{
|
||||
SetLastErrorByStatus( Status );
|
||||
return 0;
|
||||
}
|
||||
nBufferMax--; // save room for the null
|
||||
if( nBufferMax > AString.Length )
|
||||
nBufferMax = AString.Length;
|
||||
memcpy( lpBuffer, AString.Buffer, nBufferMax );
|
||||
lpBuffer[nBufferMax] = 0;
|
||||
RtlFreeAnsiString( &AString );
|
||||
return nBufferMax;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue