Removed a number of direct accesses to the WND structure, replacing
them by API calls.
This commit is contained in:
parent
e5b5af9d66
commit
de42428f23
File diff suppressed because it is too large
Load Diff
290
controls/combo.c
290
controls/combo.c
|
@ -14,7 +14,6 @@
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "wine/winuser16.h"
|
#include "wine/winuser16.h"
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
#include "win.h"
|
|
||||||
#include "spy.h"
|
#include "spy.h"
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
#include "controls.h"
|
#include "controls.h"
|
||||||
|
@ -30,12 +29,14 @@ DEFAULT_DEBUG_CHANNEL(combo);
|
||||||
* Additional combo box definitions
|
* Additional combo box definitions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CB_GETPTR( wnd ) (*(LPHEADCOMBO*)((wnd)->wExtra))
|
|
||||||
#define CB_NOTIFY( lphc, code ) \
|
#define CB_NOTIFY( lphc, code ) \
|
||||||
(SendMessageW((lphc)->owner, WM_COMMAND, \
|
(SendMessageW((lphc)->owner, WM_COMMAND, \
|
||||||
MAKEWPARAM((lphc)->self->wIDmenu, (code)), (lphc)->self->hwndSelf))
|
MAKEWPARAM(GetWindowLongA((lphc)->self,GWL_ID), (code)), (lphc)->self))
|
||||||
#define CB_GETEDITTEXTLENGTH( lphc ) \
|
|
||||||
(SendMessageW((lphc)->hWndEdit, WM_GETTEXTLENGTH, 0, 0 ))
|
#define CB_DISABLED( lphc ) (!IsWindowEnabled((lphc)->self))
|
||||||
|
#define CB_OWNERDRAWN( lphc ) ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
|
||||||
|
#define CB_HASSTRINGS( lphc ) ((lphc)->dwStyle & CBS_HASSTRINGS)
|
||||||
|
#define CB_HWND( lphc ) ((lphc)->self)
|
||||||
|
|
||||||
#define ISWIN31 (LOWORD(GetVersion()) == 0x0a03)
|
#define ISWIN31 (LOWORD(GetVersion()) == 0x0a03)
|
||||||
|
|
||||||
|
@ -113,38 +114,36 @@ static BOOL COMBO_Init()
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* COMBO_NCCreate
|
* COMBO_NCCreate
|
||||||
*/
|
*/
|
||||||
static LRESULT COMBO_NCCreate(WND* wnd, LONG style)
|
static LRESULT COMBO_NCCreate(HWND hwnd, LONG style)
|
||||||
{
|
{
|
||||||
LPHEADCOMBO lphc;
|
LPHEADCOMBO lphc;
|
||||||
|
|
||||||
if ( wnd && COMBO_Init() &&
|
if (COMBO_Init() && (lphc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HEADCOMBO))) )
|
||||||
(lphc = HeapAlloc(GetProcessHeap(), 0, sizeof(HEADCOMBO))) )
|
{
|
||||||
{
|
lphc->self = hwnd;
|
||||||
memset( lphc, 0, sizeof(HEADCOMBO) );
|
SetWindowLongA( hwnd, 0, (LONG)lphc );
|
||||||
*(LPHEADCOMBO*)wnd->wExtra = lphc;
|
|
||||||
|
|
||||||
/* some braindead apps do try to use scrollbar/border flags */
|
/* some braindead apps do try to use scrollbar/border flags */
|
||||||
|
|
||||||
lphc->dwStyle = style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
|
lphc->dwStyle = style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
|
||||||
wnd->dwStyle &= ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
|
SetWindowLongA( hwnd, GWL_STYLE, style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We also have to remove the client edge style to make sure
|
* We also have to remove the client edge style to make sure
|
||||||
* we don't end-up with a non client area.
|
* we don't end-up with a non client area.
|
||||||
*/
|
*/
|
||||||
wnd->dwExStyle &= ~(WS_EX_CLIENTEDGE);
|
SetWindowLongA( hwnd, GWL_EXSTYLE,
|
||||||
|
GetWindowLongA( hwnd, GWL_EXSTYLE ) & ~WS_EX_CLIENTEDGE );
|
||||||
|
|
||||||
if( !(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) )
|
if( !(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) )
|
||||||
lphc->dwStyle |= CBS_HASSTRINGS;
|
lphc->dwStyle |= CBS_HASSTRINGS;
|
||||||
if( !(wnd->dwExStyle & WS_EX_NOPARENTNOTIFY) )
|
if( !(GetWindowLongA( hwnd, GWL_EXSTYLE ) & WS_EX_NOPARENTNOTIFY) )
|
||||||
lphc->wState |= CBF_NOTIFY;
|
lphc->wState |= CBF_NOTIFY;
|
||||||
|
|
||||||
TRACE("[0x%08x], style = %08x\n",
|
TRACE("[0x%p], style = %08x\n", lphc, lphc->dwStyle );
|
||||||
(UINT)lphc, lphc->dwStyle );
|
return TRUE;
|
||||||
|
|
||||||
return (LRESULT)(UINT)wnd->hwndSelf;
|
|
||||||
}
|
}
|
||||||
return (LRESULT)FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -155,15 +154,13 @@ static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc )
|
||||||
|
|
||||||
if( lphc )
|
if( lphc )
|
||||||
{
|
{
|
||||||
WND* wnd = lphc->self;
|
TRACE("[%04x]: freeing storage\n", lphc->self);
|
||||||
|
|
||||||
TRACE("[%04x]: freeing storage\n", CB_HWND(lphc));
|
|
||||||
|
|
||||||
if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
|
if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
|
||||||
DestroyWindow( lphc->hWndLBox );
|
DestroyWindow( lphc->hWndLBox );
|
||||||
|
|
||||||
|
SetWindowLongA( lphc->self, 0, 0 );
|
||||||
HeapFree( GetProcessHeap(), 0, lphc );
|
HeapFree( GetProcessHeap(), 0, lphc );
|
||||||
wnd->wExtra[0] = 0;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +225,8 @@ static INT CBGetTextAreaHeight(
|
||||||
MEASUREITEMSTRUCT measureItem;
|
MEASUREITEMSTRUCT measureItem;
|
||||||
RECT clientRect;
|
RECT clientRect;
|
||||||
INT originalItemHeight = iTextItemHeight;
|
INT originalItemHeight = iTextItemHeight;
|
||||||
|
UINT id = GetWindowLongA( lphc->self, GWL_ID );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We use the client rect for the width of the item.
|
* We use the client rect for the width of the item.
|
||||||
*/
|
*/
|
||||||
|
@ -240,13 +238,12 @@ static INT CBGetTextAreaHeight(
|
||||||
* Send a first one to measure the size of the text area
|
* Send a first one to measure the size of the text area
|
||||||
*/
|
*/
|
||||||
measureItem.CtlType = ODT_COMBOBOX;
|
measureItem.CtlType = ODT_COMBOBOX;
|
||||||
measureItem.CtlID = lphc->self->wIDmenu;
|
measureItem.CtlID = id;
|
||||||
measureItem.itemID = -1;
|
measureItem.itemID = -1;
|
||||||
measureItem.itemWidth = clientRect.right;
|
measureItem.itemWidth = clientRect.right;
|
||||||
measureItem.itemHeight = iTextItemHeight - 6; /* ownerdrawn cb is taller */
|
measureItem.itemHeight = iTextItemHeight - 6; /* ownerdrawn cb is taller */
|
||||||
measureItem.itemData = 0;
|
measureItem.itemData = 0;
|
||||||
SendMessageW(lphc->owner, WM_MEASUREITEM,
|
SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
|
||||||
(WPARAM)measureItem.CtlID, (LPARAM)&measureItem);
|
|
||||||
iTextItemHeight = 6 + measureItem.itemHeight;
|
iTextItemHeight = 6 + measureItem.itemHeight;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -256,13 +253,12 @@ static INT CBGetTextAreaHeight(
|
||||||
if (lphc->dwStyle & CBS_OWNERDRAWFIXED)
|
if (lphc->dwStyle & CBS_OWNERDRAWFIXED)
|
||||||
{
|
{
|
||||||
measureItem.CtlType = ODT_COMBOBOX;
|
measureItem.CtlType = ODT_COMBOBOX;
|
||||||
measureItem.CtlID = lphc->self->wIDmenu;
|
measureItem.CtlID = id;
|
||||||
measureItem.itemID = 0;
|
measureItem.itemID = 0;
|
||||||
measureItem.itemWidth = clientRect.right;
|
measureItem.itemWidth = clientRect.right;
|
||||||
measureItem.itemHeight = originalItemHeight;
|
measureItem.itemHeight = originalItemHeight;
|
||||||
measureItem.itemData = 0;
|
measureItem.itemData = 0;
|
||||||
SendMessageW(lphc->owner, WM_MEASUREITEM,
|
SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
|
||||||
(WPARAM)measureItem.CtlID, (LPARAM)&measureItem);
|
|
||||||
lphc->fixedOwnerDrawHeight = measureItem.itemHeight;
|
lphc->fixedOwnerDrawHeight = measureItem.itemHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,9 +284,9 @@ static void CBForceDummyResize(
|
||||||
RECT windowRect;
|
RECT windowRect;
|
||||||
int newComboHeight;
|
int newComboHeight;
|
||||||
|
|
||||||
newComboHeight = CBGetTextAreaHeight(CB_HWND(lphc),lphc) + 2*COMBO_YBORDERSIZE();
|
newComboHeight = CBGetTextAreaHeight(lphc->self,lphc) + 2*COMBO_YBORDERSIZE();
|
||||||
|
|
||||||
GetWindowRect(CB_HWND(lphc), &windowRect);
|
GetWindowRect(lphc->self, &windowRect);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We have to be careful, resizing a combobox also has the meaning that the
|
* We have to be careful, resizing a combobox also has the meaning that the
|
||||||
|
@ -300,7 +296,7 @@ static void CBForceDummyResize(
|
||||||
* this will cancel-out in the processing of the WM_WINDOWPOSCHANGING
|
* this will cancel-out in the processing of the WM_WINDOWPOSCHANGING
|
||||||
* message.
|
* message.
|
||||||
*/
|
*/
|
||||||
SetWindowPos( CB_HWND(lphc),
|
SetWindowPos( lphc->self,
|
||||||
(HWND)NULL,
|
(HWND)NULL,
|
||||||
0, 0,
|
0, 0,
|
||||||
windowRect.right - windowRect.left,
|
windowRect.right - windowRect.left,
|
||||||
|
@ -427,7 +423,7 @@ static void CBGetDroppedControlRect( LPHEADCOMBO lphc, LPRECT lpRect)
|
||||||
/* In windows, CB_GETDROPPEDCONTROLRECT returns the upper left corner
|
/* In windows, CB_GETDROPPEDCONTROLRECT returns the upper left corner
|
||||||
of the combo box and the lower right corner of the listbox */
|
of the combo box and the lower right corner of the listbox */
|
||||||
|
|
||||||
GetWindowRect(lphc->self->hwndSelf, lpRect);
|
GetWindowRect(lphc->self, lpRect);
|
||||||
|
|
||||||
lpRect->right = lpRect->left + lphc->droppedRect.right - lphc->droppedRect.left;
|
lpRect->right = lpRect->left + lphc->droppedRect.right - lphc->droppedRect.left;
|
||||||
lpRect->bottom = lpRect->top + lphc->droppedRect.bottom - lphc->droppedRect.top;
|
lpRect->bottom = lpRect->top + lphc->droppedRect.bottom - lphc->droppedRect.top;
|
||||||
|
@ -481,15 +477,14 @@ static LRESULT COMBO_WindowPosChanging(
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* COMBO_Create
|
* COMBO_Create
|
||||||
*/
|
*/
|
||||||
static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG style )
|
static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG style )
|
||||||
{
|
{
|
||||||
static const WCHAR clbName[] = {'C','o','m','b','o','L','B','o','x',0};
|
static const WCHAR clbName[] = {'C','o','m','b','o','L','B','o','x',0};
|
||||||
static const WCHAR editName[] = {'E','d','i','t',0};
|
static const WCHAR editName[] = {'E','d','i','t',0};
|
||||||
|
|
||||||
if( !CB_GETTYPE(lphc) ) lphc->dwStyle |= CBS_SIMPLE;
|
if( !CB_GETTYPE(lphc) ) lphc->dwStyle |= CBS_SIMPLE;
|
||||||
if( CB_GETTYPE(lphc) != CBS_DROPDOWNLIST ) lphc->wState |= CBF_EDIT;
|
if( CB_GETTYPE(lphc) != CBS_DROPDOWNLIST ) lphc->wState |= CBF_EDIT;
|
||||||
|
|
||||||
lphc->self = wnd;
|
|
||||||
lphc->owner = hwndParent;
|
lphc->owner = hwndParent;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -515,13 +510,8 @@ static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG s
|
||||||
* control and then, force all the areas of the combobox to be
|
* control and then, force all the areas of the combobox to be
|
||||||
* recalculated.
|
* recalculated.
|
||||||
*/
|
*/
|
||||||
GetClientRect( wnd->hwndSelf, &lphc->droppedRect );
|
GetClientRect( hwnd, &lphc->droppedRect );
|
||||||
|
CBCalcPlacement(hwnd, lphc, &lphc->textRect, &lphc->buttonRect, &lphc->droppedRect );
|
||||||
CBCalcPlacement(wnd->hwndSelf,
|
|
||||||
lphc,
|
|
||||||
&lphc->textRect,
|
|
||||||
&lphc->buttonRect,
|
|
||||||
&lphc->droppedRect );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adjust the position of the popup listbox if it's necessary
|
* Adjust the position of the popup listbox if it's necessary
|
||||||
|
@ -536,8 +526,8 @@ static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG s
|
||||||
if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
|
if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
|
||||||
lphc->droppedRect.left += COMBO_EDITBUTTONSPACE();
|
lphc->droppedRect.left += COMBO_EDITBUTTONSPACE();
|
||||||
|
|
||||||
ClientToScreen(wnd->hwndSelf, (LPPOINT)&lphc->droppedRect);
|
ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect);
|
||||||
ClientToScreen(wnd->hwndSelf, (LPPOINT)&lphc->droppedRect.right);
|
ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect.right);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create listbox popup */
|
/* create listbox popup */
|
||||||
|
@ -577,10 +567,8 @@ static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG s
|
||||||
lphc->droppedRect.top,
|
lphc->droppedRect.top,
|
||||||
lphc->droppedRect.right - lphc->droppedRect.left,
|
lphc->droppedRect.right - lphc->droppedRect.left,
|
||||||
lphc->droppedRect.bottom - lphc->droppedRect.top,
|
lphc->droppedRect.bottom - lphc->droppedRect.top,
|
||||||
lphc->self->hwndSelf,
|
hwnd, (HMENU)ID_CB_LISTBOX,
|
||||||
(HMENU)ID_CB_LISTBOX,
|
GetWindowLongA( hwnd, GWL_HINSTANCE ), lphc );
|
||||||
lphc->self->hInstance,
|
|
||||||
(LPVOID)lphc );
|
|
||||||
|
|
||||||
if( lphc->hWndLBox )
|
if( lphc->hWndLBox )
|
||||||
{
|
{
|
||||||
|
@ -605,7 +593,7 @@ static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG s
|
||||||
else if( lphc->dwStyle & CBS_UPPERCASE )
|
else if( lphc->dwStyle & CBS_UPPERCASE )
|
||||||
lbeStyle |= ES_UPPERCASE;
|
lbeStyle |= ES_UPPERCASE;
|
||||||
|
|
||||||
if (wnd->dwStyle & WS_DISABLED) lbeStyle |= WS_DISABLED;
|
if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED;
|
||||||
|
|
||||||
lphc->hWndEdit = CreateWindowExW(0,
|
lphc->hWndEdit = CreateWindowExW(0,
|
||||||
editName,
|
editName,
|
||||||
|
@ -614,10 +602,8 @@ static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG s
|
||||||
lphc->textRect.left, lphc->textRect.top,
|
lphc->textRect.left, lphc->textRect.top,
|
||||||
lphc->textRect.right - lphc->textRect.left,
|
lphc->textRect.right - lphc->textRect.left,
|
||||||
lphc->textRect.bottom - lphc->textRect.top,
|
lphc->textRect.bottom - lphc->textRect.top,
|
||||||
lphc->self->hwndSelf,
|
hwnd, (HMENU)ID_CB_EDIT,
|
||||||
(HMENU)ID_CB_EDIT,
|
GetWindowLongA( hwnd, GWL_HINSTANCE ), NULL );
|
||||||
lphc->self->hInstance,
|
|
||||||
NULL );
|
|
||||||
|
|
||||||
if( !lphc->hWndEdit )
|
if( !lphc->hWndEdit )
|
||||||
bEdit = FALSE;
|
bEdit = FALSE;
|
||||||
|
@ -639,7 +625,7 @@ static LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, HWND hwndParent, LONG s
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("init done\n");
|
TRACE("init done\n");
|
||||||
return wnd->hwndSelf;
|
return hwnd;
|
||||||
}
|
}
|
||||||
ERR("edit control failure.\n");
|
ERR("edit control failure.\n");
|
||||||
} else ERR("listbox failure.\n");
|
} else ERR("listbox failure.\n");
|
||||||
|
@ -789,7 +775,8 @@ static void CBPaintText(
|
||||||
{
|
{
|
||||||
DRAWITEMSTRUCT dis;
|
DRAWITEMSTRUCT dis;
|
||||||
HRGN clipRegion;
|
HRGN clipRegion;
|
||||||
|
UINT ctlid = GetWindowLongA( lphc->self, GWL_ID );
|
||||||
|
|
||||||
/* setup state for DRAWITEM message. Owner will highlight */
|
/* setup state for DRAWITEM message. Owner will highlight */
|
||||||
if ( (lphc->wState & CBF_FOCUSED) &&
|
if ( (lphc->wState & CBF_FOCUSED) &&
|
||||||
!(lphc->wState & CBF_DROPPED) )
|
!(lphc->wState & CBF_DROPPED) )
|
||||||
|
@ -807,13 +794,12 @@ static void CBPaintText(
|
||||||
DeleteObject(clipRegion);
|
DeleteObject(clipRegion);
|
||||||
clipRegion=(HRGN)NULL;
|
clipRegion=(HRGN)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( lphc->self->dwStyle & WS_DISABLED )
|
if (!IsWindowEnabled(lphc->self) & WS_DISABLED) itemState |= ODS_DISABLED;
|
||||||
itemState |= ODS_DISABLED;
|
|
||||||
|
|
||||||
dis.CtlType = ODT_COMBOBOX;
|
dis.CtlType = ODT_COMBOBOX;
|
||||||
dis.CtlID = lphc->self->wIDmenu;
|
dis.CtlID = ctlid;
|
||||||
dis.hwndItem = lphc->self->hwndSelf;
|
dis.hwndItem = lphc->self;
|
||||||
dis.itemAction = ODA_DRAWENTIRE;
|
dis.itemAction = ODA_DRAWENTIRE;
|
||||||
dis.itemID = id;
|
dis.itemID = id;
|
||||||
dis.itemState = itemState;
|
dis.itemState = itemState;
|
||||||
|
@ -828,10 +814,9 @@ static void CBPaintText(
|
||||||
IntersectClipRect(hdc,
|
IntersectClipRect(hdc,
|
||||||
rectEdit.left, rectEdit.top,
|
rectEdit.left, rectEdit.top,
|
||||||
rectEdit.right, rectEdit.bottom);
|
rectEdit.right, rectEdit.bottom);
|
||||||
|
|
||||||
SendMessageW(lphc->owner, WM_DRAWITEM,
|
SendMessageW(lphc->owner, WM_DRAWITEM, ctlid, (LPARAM)&dis );
|
||||||
lphc->self->wIDmenu, (LPARAM)&dis );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reset the clipping region.
|
* Reset the clipping region.
|
||||||
*/
|
*/
|
||||||
|
@ -912,9 +897,8 @@ static HBRUSH COMBO_PrepareColors(
|
||||||
*/
|
*/
|
||||||
if (CB_DISABLED(lphc))
|
if (CB_DISABLED(lphc))
|
||||||
{
|
{
|
||||||
hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLORSTATIC,
|
hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLORSTATIC, hDC, lphc->self );
|
||||||
hDC, lphc->self->hwndSelf );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We have to change the text color since WM_CTLCOLORSTATIC will
|
* We have to change the text color since WM_CTLCOLORSTATIC will
|
||||||
* set it to the "enabled" color. This is the same behavior as the
|
* set it to the "enabled" color. This is the same behavior as the
|
||||||
|
@ -926,13 +910,11 @@ static HBRUSH COMBO_PrepareColors(
|
||||||
{
|
{
|
||||||
if (lphc->wState & CBF_EDIT)
|
if (lphc->wState & CBF_EDIT)
|
||||||
{
|
{
|
||||||
hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLOREDIT,
|
hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLOREDIT, hDC, lphc->self );
|
||||||
hDC, lphc->self->hwndSelf );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLORLISTBOX,
|
hBkgBrush = SendMessageW(lphc->owner, WM_CTLCOLORLISTBOX, hDC, lphc->self );
|
||||||
hDC, lphc->self->hwndSelf );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -983,7 +965,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
|
|
||||||
hDC = (hParamDC) ? hParamDC
|
hDC = (hParamDC) ? hParamDC
|
||||||
: BeginPaint( lphc->self->hwndSelf, &ps);
|
: BeginPaint( lphc->self, &ps);
|
||||||
|
|
||||||
TRACE("hdc=%04x\n", hDC);
|
TRACE("hdc=%04x\n", hDC);
|
||||||
|
|
||||||
|
@ -1004,7 +986,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
|
||||||
*/
|
*/
|
||||||
if (TWEAK_WineLook != WIN31_LOOK)
|
if (TWEAK_WineLook != WIN31_LOOK)
|
||||||
{
|
{
|
||||||
CBPaintBorder(CB_HWND(lphc), lphc, hDC);
|
CBPaintBorder(lphc->self, lphc, hDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !IsRectEmpty(&lphc->buttonRect) )
|
if( !IsRectEmpty(&lphc->buttonRect) )
|
||||||
|
@ -1046,7 +1028,7 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !hParamDC )
|
if( !hParamDC )
|
||||||
EndPaint(lphc->self->hwndSelf, &ps);
|
EndPaint(lphc->self, &ps);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1062,8 +1044,8 @@ static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect )
|
||||||
LPWSTR pText = NULL;
|
LPWSTR pText = NULL;
|
||||||
|
|
||||||
idx = LB_ERR;
|
idx = LB_ERR;
|
||||||
length = CB_GETEDITTEXTLENGTH( lphc );
|
length = SendMessageW( lphc->hWndEdit, WM_GETTEXTLENGTH, 0, 0 );
|
||||||
|
|
||||||
if( length > 0 )
|
if( length > 0 )
|
||||||
pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
|
pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
|
||||||
|
|
||||||
|
@ -1135,7 +1117,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
|
||||||
int nItems = 0;
|
int nItems = 0;
|
||||||
int nDroppedHeight;
|
int nDroppedHeight;
|
||||||
|
|
||||||
TRACE("[%04x]: drop down\n", CB_HWND(lphc));
|
TRACE("[%04x]: drop down\n", lphc->self);
|
||||||
|
|
||||||
CB_NOTIFY( lphc, CBN_DROPDOWN );
|
CB_NOTIFY( lphc, CBN_DROPDOWN );
|
||||||
|
|
||||||
|
@ -1160,7 +1142,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now set popup position */
|
/* now set popup position */
|
||||||
GetWindowRect( lphc->self->hwndSelf, &rect );
|
GetWindowRect( lphc->self, &rect );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If it's a dropdown, the listbox is offset
|
* If it's a dropdown, the listbox is offset
|
||||||
|
@ -1202,11 +1184,11 @@ static void CBDropDown( LPHEADCOMBO lphc )
|
||||||
|
|
||||||
|
|
||||||
if( !(lphc->wState & CBF_NOREDRAW) )
|
if( !(lphc->wState & CBF_NOREDRAW) )
|
||||||
RedrawWindow( lphc->self->hwndSelf, NULL, 0, RDW_INVALIDATE |
|
RedrawWindow( lphc->self, NULL, 0, RDW_INVALIDATE |
|
||||||
RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );
|
RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );
|
||||||
|
|
||||||
EnableWindow( lphc->hWndLBox, TRUE );
|
EnableWindow( lphc->hWndLBox, TRUE );
|
||||||
if (GetCapture() != lphc->self->hwndSelf)
|
if (GetCapture() != lphc->self)
|
||||||
SetCapture(lphc->hWndLBox);
|
SetCapture(lphc->hWndLBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1217,10 +1199,10 @@ static void CBDropDown( LPHEADCOMBO lphc )
|
||||||
*/
|
*/
|
||||||
static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton )
|
static void CBRollUp( LPHEADCOMBO lphc, BOOL ok, BOOL bButton )
|
||||||
{
|
{
|
||||||
HWND hWnd = lphc->self->hwndSelf;
|
HWND hWnd = lphc->self;
|
||||||
|
|
||||||
TRACE("[%04x]: sel ok? [%i] dropped? [%i]\n",
|
TRACE("[%04x]: sel ok? [%i] dropped? [%i]\n",
|
||||||
CB_HWND(lphc), (INT)ok, (INT)(lphc->wState & CBF_DROPPED));
|
lphc->self, (INT)ok, (INT)(lphc->wState & CBF_DROPPED));
|
||||||
|
|
||||||
CB_NOTIFY( lphc, (ok) ? CBN_SELENDOK : CBN_SELENDCANCEL );
|
CB_NOTIFY( lphc, (ok) ? CBN_SELENDOK : CBN_SELENDCANCEL );
|
||||||
|
|
||||||
|
@ -1287,8 +1269,8 @@ BOOL COMBO_FlipListbox( LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton )
|
||||||
*/
|
*/
|
||||||
static void CBRepaintButton( LPHEADCOMBO lphc )
|
static void CBRepaintButton( LPHEADCOMBO lphc )
|
||||||
{
|
{
|
||||||
InvalidateRect(CB_HWND(lphc), &lphc->buttonRect, TRUE);
|
InvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
|
||||||
UpdateWindow(CB_HWND(lphc));
|
UpdateWindow(lphc->self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -1306,7 +1288,7 @@ static void COMBO_SetFocus( LPHEADCOMBO lphc )
|
||||||
/* lphc->wState |= CBF_FOCUSED; */
|
/* lphc->wState |= CBF_FOCUSED; */
|
||||||
|
|
||||||
if( !(lphc->wState & CBF_EDIT) )
|
if( !(lphc->wState & CBF_EDIT) )
|
||||||
InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
|
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
|
||||||
|
|
||||||
CB_NOTIFY( lphc, CBN_SETFOCUS );
|
CB_NOTIFY( lphc, CBN_SETFOCUS );
|
||||||
lphc->wState |= CBF_FOCUSED;
|
lphc->wState |= CBF_FOCUSED;
|
||||||
|
@ -1318,7 +1300,7 @@ static void COMBO_SetFocus( LPHEADCOMBO lphc )
|
||||||
*/
|
*/
|
||||||
static void COMBO_KillFocus( LPHEADCOMBO lphc )
|
static void COMBO_KillFocus( LPHEADCOMBO lphc )
|
||||||
{
|
{
|
||||||
HWND hWnd = lphc->self->hwndSelf;
|
HWND hWnd = lphc->self;
|
||||||
|
|
||||||
if( lphc->wState & CBF_FOCUSED )
|
if( lphc->wState & CBF_FOCUSED )
|
||||||
{
|
{
|
||||||
|
@ -1332,7 +1314,7 @@ static void COMBO_KillFocus( LPHEADCOMBO lphc )
|
||||||
|
|
||||||
/* redraw text */
|
/* redraw text */
|
||||||
if( !(lphc->wState & CBF_EDIT) )
|
if( !(lphc->wState & CBF_EDIT) )
|
||||||
InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
|
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
|
||||||
|
|
||||||
CB_NOTIFY( lphc, CBN_KILLFOCUS );
|
CB_NOTIFY( lphc, CBN_KILLFOCUS );
|
||||||
}
|
}
|
||||||
|
@ -1353,7 +1335,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
|
||||||
case (EN_SETFOCUS >> 8):
|
case (EN_SETFOCUS >> 8):
|
||||||
|
|
||||||
TRACE("[%04x]: edit [%04x] got focus\n",
|
TRACE("[%04x]: edit [%04x] got focus\n",
|
||||||
CB_HWND(lphc), lphc->hWndEdit );
|
lphc->self, lphc->hWndEdit );
|
||||||
|
|
||||||
COMBO_SetFocus( lphc );
|
COMBO_SetFocus( lphc );
|
||||||
break;
|
break;
|
||||||
|
@ -1361,7 +1343,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
|
||||||
case (EN_KILLFOCUS >> 8):
|
case (EN_KILLFOCUS >> 8):
|
||||||
|
|
||||||
TRACE("[%04x]: edit [%04x] lost focus\n",
|
TRACE("[%04x]: edit [%04x] lost focus\n",
|
||||||
CB_HWND(lphc), lphc->hWndEdit );
|
lphc->self, lphc->hWndEdit );
|
||||||
|
|
||||||
/* NOTE: it seems that Windows' edit control sends an
|
/* NOTE: it seems that Windows' edit control sends an
|
||||||
* undocumented message WM_USER + 0x1B instead of this
|
* undocumented message WM_USER + 0x1B instead of this
|
||||||
|
@ -1419,7 +1401,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
|
||||||
case LBN_SELCANCEL:
|
case LBN_SELCANCEL:
|
||||||
|
|
||||||
TRACE("[%04x]: lbox selection change [%04x]\n",
|
TRACE("[%04x]: lbox selection change [%04x]\n",
|
||||||
CB_HWND(lphc), lphc->wState );
|
lphc->self, lphc->wState );
|
||||||
|
|
||||||
if( HIWORD(wParam) == LBN_SELCHANGE)
|
if( HIWORD(wParam) == LBN_SELCHANGE)
|
||||||
{
|
{
|
||||||
|
@ -1432,7 +1414,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
|
||||||
SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
|
SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
|
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do not roll up if selection is being tracked
|
/* do not roll up if selection is being tracked
|
||||||
|
@ -1464,35 +1446,46 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
|
||||||
*/
|
*/
|
||||||
static LRESULT COMBO_ItemOp( LPHEADCOMBO lphc, UINT msg, LPARAM lParam )
|
static LRESULT COMBO_ItemOp( LPHEADCOMBO lphc, UINT msg, LPARAM lParam )
|
||||||
{
|
{
|
||||||
HWND hWnd = lphc->self->hwndSelf;
|
HWND hWnd = lphc->self;
|
||||||
|
UINT id = GetWindowLongA( hWnd, GWL_ID );
|
||||||
|
|
||||||
TRACE("[%04x]: ownerdraw op %04x\n", CB_HWND(lphc), msg );
|
TRACE("[%04x]: ownerdraw op %04x\n", lphc->self, msg );
|
||||||
|
|
||||||
#define lpIS ((LPDELETEITEMSTRUCT)lParam)
|
switch( msg )
|
||||||
|
|
||||||
/* two first items are the same in all 4 structs */
|
|
||||||
lpIS->CtlType = ODT_COMBOBOX;
|
|
||||||
lpIS->CtlID = lphc->self->wIDmenu;
|
|
||||||
|
|
||||||
switch( msg ) /* patch window handle */
|
|
||||||
{
|
{
|
||||||
case WM_DELETEITEM:
|
case WM_DELETEITEM:
|
||||||
lpIS->hwndItem = hWnd;
|
{
|
||||||
#undef lpIS
|
DELETEITEMSTRUCT *lpIS = (DELETEITEMSTRUCT *)lParam;
|
||||||
break;
|
lpIS->CtlType = ODT_COMBOBOX;
|
||||||
case WM_DRAWITEM:
|
lpIS->CtlID = id;
|
||||||
#define lpIS ((LPDRAWITEMSTRUCT)lParam)
|
lpIS->hwndItem = hWnd;
|
||||||
lpIS->hwndItem = hWnd;
|
break;
|
||||||
#undef lpIS
|
}
|
||||||
break;
|
case WM_DRAWITEM:
|
||||||
case WM_COMPAREITEM:
|
{
|
||||||
#define lpIS ((LPCOMPAREITEMSTRUCT)lParam)
|
DRAWITEMSTRUCT *lpIS = (DRAWITEMSTRUCT *)lParam;
|
||||||
lpIS->hwndItem = hWnd;
|
lpIS->CtlType = ODT_COMBOBOX;
|
||||||
#undef lpIS
|
lpIS->CtlID = id;
|
||||||
break;
|
lpIS->hwndItem = hWnd;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WM_COMPAREITEM:
|
||||||
|
{
|
||||||
|
COMPAREITEMSTRUCT *lpIS = (COMPAREITEMSTRUCT *)lParam;
|
||||||
|
lpIS->CtlType = ODT_COMBOBOX;
|
||||||
|
lpIS->CtlID = id;
|
||||||
|
lpIS->hwndItem = hWnd;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WM_MEASUREITEM:
|
||||||
|
{
|
||||||
|
MEASUREITEMSTRUCT *lpIS = (MEASUREITEMSTRUCT *)lParam;
|
||||||
|
lpIS->CtlType = ODT_COMBOBOX;
|
||||||
|
lpIS->CtlID = id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return SendMessageW(lphc->owner, msg, id, lParam);
|
||||||
return SendMessageW(lphc->owner, msg, lphc->self->wIDmenu, lParam);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -1622,7 +1615,7 @@ static void CBResetPos(
|
||||||
}
|
}
|
||||||
|
|
||||||
if( bRedraw && !(lphc->wState & CBF_NOREDRAW) )
|
if( bRedraw && !(lphc->wState & CBF_NOREDRAW) )
|
||||||
RedrawWindow( lphc->self->hwndSelf, NULL, 0,
|
RedrawWindow( lphc->self, NULL, 0,
|
||||||
RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW );
|
RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1633,7 +1626,7 @@ static void CBResetPos(
|
||||||
*/
|
*/
|
||||||
static void COMBO_Size( LPHEADCOMBO lphc )
|
static void COMBO_Size( LPHEADCOMBO lphc )
|
||||||
{
|
{
|
||||||
CBCalcPlacement(lphc->self->hwndSelf,
|
CBCalcPlacement(lphc->self,
|
||||||
lphc,
|
lphc,
|
||||||
&lphc->textRect,
|
&lphc->textRect,
|
||||||
&lphc->buttonRect,
|
&lphc->buttonRect,
|
||||||
|
@ -1665,7 +1658,7 @@ static void COMBO_Font( LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw )
|
||||||
*/
|
*/
|
||||||
if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
|
if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
|
||||||
{
|
{
|
||||||
CBCalcPlacement(lphc->self->hwndSelf,
|
CBCalcPlacement(lphc->self,
|
||||||
lphc,
|
lphc,
|
||||||
&lphc->textRect,
|
&lphc->textRect,
|
||||||
&lphc->buttonRect,
|
&lphc->buttonRect,
|
||||||
|
@ -1698,7 +1691,7 @@ static LRESULT COMBO_SetItemHeight( LPHEADCOMBO lphc, INT index, INT height )
|
||||||
*/
|
*/
|
||||||
if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
|
if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
|
||||||
{
|
{
|
||||||
CBCalcPlacement(lphc->self->hwndSelf,
|
CBCalcPlacement(lphc->self,
|
||||||
lphc,
|
lphc,
|
||||||
&lphc->textRect,
|
&lphc->textRect,
|
||||||
&lphc->buttonRect,
|
&lphc->buttonRect,
|
||||||
|
@ -1733,7 +1726,7 @@ static LRESULT COMBO_SelectString( LPHEADCOMBO lphc, INT start, LPARAM pText, BO
|
||||||
CBUpdateEdit( lphc, index );
|
CBUpdateEdit( lphc, index );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
|
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (LRESULT)index;
|
return (LRESULT)index;
|
||||||
|
@ -1746,7 +1739,7 @@ static void COMBO_LButtonDown( LPHEADCOMBO lphc, LPARAM lParam )
|
||||||
{
|
{
|
||||||
POINT pt;
|
POINT pt;
|
||||||
BOOL bButton;
|
BOOL bButton;
|
||||||
HWND hWnd = lphc->self->hwndSelf;
|
HWND hWnd = lphc->self;
|
||||||
|
|
||||||
pt.x = LOWORD(lParam);
|
pt.x = LOWORD(lParam);
|
||||||
pt.y = HIWORD(lParam);
|
pt.y = HIWORD(lParam);
|
||||||
|
@ -1842,7 +1835,7 @@ static void COMBO_MouseMove( LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam )
|
||||||
}
|
}
|
||||||
|
|
||||||
GetClientRect( lphc->hWndLBox, &lbRect );
|
GetClientRect( lphc->hWndLBox, &lbRect );
|
||||||
MapWindowPoints( lphc->self->hwndSelf, lphc->hWndLBox, &pt, 1 );
|
MapWindowPoints( lphc->self, lphc->hWndLBox, &pt, 1 );
|
||||||
if( PtInRect(&lbRect, pt) )
|
if( PtInRect(&lbRect, pt) )
|
||||||
{
|
{
|
||||||
lphc->wState &= ~CBF_CAPTURE;
|
lphc->wState &= ~CBF_CAPTURE;
|
||||||
|
@ -1856,18 +1849,17 @@ static void COMBO_MouseMove( LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam )
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* ComboWndProc_locked
|
* ComboWndProc_common
|
||||||
*
|
*
|
||||||
* http://www.microsoft.com/msdn/sdk/platforms/doc/sdk/win32/ctrl/src/combobox_15.htm
|
* http://www.microsoft.com/msdn/sdk/platforms/doc/sdk/win32/ctrl/src/combobox_15.htm
|
||||||
*/
|
*/
|
||||||
static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
|
static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
|
||||||
WPARAM wParam, LPARAM lParam, BOOL unicode )
|
WPARAM wParam, LPARAM lParam, BOOL unicode )
|
||||||
{
|
{
|
||||||
LPHEADCOMBO lphc = CB_GETPTR(pWnd);
|
LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongA( hwnd, 0 );
|
||||||
HWND hwnd = pWnd->hwndSelf;
|
|
||||||
|
|
||||||
TRACE("[%04x]: msg %s wp %08x lp %08lx\n",
|
TRACE("[%04x]: msg %s wp %08x lp %08lx\n",
|
||||||
pWnd->hwndSelf, SPY_GetMsgName(message), wParam, lParam );
|
hwnd, SPY_GetMsgName(message), wParam, lParam );
|
||||||
|
|
||||||
if( lphc || message == WM_NCCREATE )
|
if( lphc || message == WM_NCCREATE )
|
||||||
switch(message)
|
switch(message)
|
||||||
|
@ -1879,7 +1871,7 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
|
||||||
{
|
{
|
||||||
LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style :
|
LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style :
|
||||||
((LPCREATESTRUCTA)lParam)->style;
|
((LPCREATESTRUCTA)lParam)->style;
|
||||||
return COMBO_NCCreate(pWnd, style);
|
return COMBO_NCCreate(hwnd, style);
|
||||||
}
|
}
|
||||||
case WM_NCDESTROY:
|
case WM_NCDESTROY:
|
||||||
COMBO_NCDestroy(lphc);
|
COMBO_NCDestroy(lphc);
|
||||||
|
@ -1899,7 +1891,7 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
|
||||||
hwndParent = ((LPCREATESTRUCTA)lParam)->hwndParent;
|
hwndParent = ((LPCREATESTRUCTA)lParam)->hwndParent;
|
||||||
style = ((LPCREATESTRUCTA)lParam)->style;
|
style = ((LPCREATESTRUCTA)lParam)->style;
|
||||||
}
|
}
|
||||||
return COMBO_Create(lphc, pWnd, hwndParent, style);
|
return COMBO_Create(hwnd, lphc, hwndParent, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_PRINTCLIENT:
|
case WM_PRINTCLIENT:
|
||||||
|
@ -1999,7 +1991,7 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
|
||||||
EnableWindow( lphc->hWndLBox, (BOOL)wParam );
|
EnableWindow( lphc->hWndLBox, (BOOL)wParam );
|
||||||
|
|
||||||
/* Force the control to repaint when the enabled state changes. */
|
/* Force the control to repaint when the enabled state changes. */
|
||||||
InvalidateRect(CB_HWND(lphc), NULL, TRUE);
|
InvalidateRect(lphc->self, NULL, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case WM_SETREDRAW:
|
case WM_SETREDRAW:
|
||||||
if( wParam )
|
if( wParam )
|
||||||
|
@ -2038,7 +2030,7 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
|
||||||
SendMessageA(hwndTarget, message, wParam, lParam);
|
SendMessageA(hwndTarget, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self->hwndSelf );
|
if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self );
|
||||||
if( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam );
|
if( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
|
@ -2117,7 +2109,7 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
|
||||||
SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)empty_stringW);
|
SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)empty_stringW);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
InvalidateRect(CB_HWND(lphc), NULL, TRUE);
|
InvalidateRect(lphc->self, NULL, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case CB_INITSTORAGE:
|
case CB_INITSTORAGE:
|
||||||
return SendMessageW(lphc->hWndLBox, LB_INITSTORAGE, wParam, lParam);
|
return SendMessageW(lphc->hWndLBox, LB_INITSTORAGE, wParam, lParam);
|
||||||
|
@ -2195,7 +2187,7 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
|
||||||
if( lphc->wState & CBF_EDIT )
|
if( lphc->wState & CBF_EDIT )
|
||||||
CBUpdateEdit( lphc, (INT)wParam );
|
CBUpdateEdit( lphc, (INT)wParam );
|
||||||
else
|
else
|
||||||
InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
|
InvalidateRect(lphc->self, &lphc->textRect, TRUE);
|
||||||
lphc->wState &= ~CBF_SELCHANGE;
|
lphc->wState &= ~CBF_SELCHANGE;
|
||||||
return lParam;
|
return lParam;
|
||||||
case CB_GETLBTEXT16:
|
case CB_GETLBTEXT16:
|
||||||
|
@ -2264,15 +2256,8 @@ static LRESULT ComboWndProc_locked( WND* pWnd, UINT message,
|
||||||
*/
|
*/
|
||||||
static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
|
static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
LRESULT retvalue = 0;
|
if (!IsWindow(hwnd)) return 0;
|
||||||
WND* pWnd = WIN_FindWndPtr(hwnd);
|
return ComboWndProc_common( hwnd, message, wParam, lParam, FALSE );
|
||||||
|
|
||||||
if (pWnd)
|
|
||||||
{
|
|
||||||
retvalue = ComboWndProc_locked(pWnd, message, wParam, lParam, FALSE);
|
|
||||||
WIN_ReleaseWndPtr(pWnd);
|
|
||||||
}
|
|
||||||
return retvalue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -2280,13 +2265,6 @@ static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPA
|
||||||
*/
|
*/
|
||||||
static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
|
static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
LRESULT retvalue = 0;
|
if (!IsWindow(hwnd)) return 0;
|
||||||
WND* pWnd = WIN_FindWndPtr(hwnd);
|
return ComboWndProc_common( hwnd, message, wParam, lParam, TRUE );
|
||||||
|
|
||||||
if (pWnd)
|
|
||||||
{
|
|
||||||
retvalue = ComboWndProc_locked(pWnd, message, wParam, lParam, TRUE);
|
|
||||||
WIN_ReleaseWndPtr(pWnd);
|
|
||||||
}
|
|
||||||
return retvalue;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,17 +11,13 @@
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
#include "win.h"
|
|
||||||
#include "controls.h"
|
#include "controls.h"
|
||||||
#include "wine/winuser16.h"
|
#include "wine/winuser16.h"
|
||||||
|
|
||||||
typedef struct
|
static HBRUSH hbrushPattern;
|
||||||
{
|
static HBITMAP hbitmapWallPaper;
|
||||||
HBRUSH hbrushPattern;
|
static SIZE bitmapSize;
|
||||||
HBITMAP hbitmapWallPaper;
|
static BOOL fTileWallPaper;
|
||||||
SIZE bitmapSize;
|
|
||||||
BOOL fTileWallPaper;
|
|
||||||
} DESKTOP;
|
|
||||||
|
|
||||||
static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
|
static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
|
||||||
|
|
||||||
|
@ -35,7 +31,7 @@ const struct builtin_class_descr DESKTOP_builtin_class =
|
||||||
CS_GLOBALCLASS, /* style */
|
CS_GLOBALCLASS, /* style */
|
||||||
NULL, /* procA (winproc is Unicode only) */
|
NULL, /* procA (winproc is Unicode only) */
|
||||||
DesktopWndProc, /* procW */
|
DesktopWndProc, /* procW */
|
||||||
sizeof(DESKTOP), /* extra */
|
0, /* extra */
|
||||||
IDC_ARROWA, /* cursor */
|
IDC_ARROWA, /* cursor */
|
||||||
COLOR_BACKGROUND+1 /* brush */
|
COLOR_BACKGROUND+1 /* brush */
|
||||||
};
|
};
|
||||||
|
@ -103,20 +99,16 @@ static HBITMAP DESKTOP_LoadBitmap( HDC hdc, const char *filename )
|
||||||
static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
|
static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
LRESULT retvalue = 0;
|
LRESULT retvalue = 0;
|
||||||
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
|
||||||
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
|
|
||||||
|
|
||||||
if (message == WM_NCCREATE)
|
if (message == WM_NCCREATE)
|
||||||
{
|
{
|
||||||
desktopPtr->hbrushPattern = 0;
|
hbrushPattern = 0;
|
||||||
desktopPtr->hbitmapWallPaper = 0;
|
hbitmapWallPaper = 0;
|
||||||
SetDeskPattern();
|
SetDeskPattern();
|
||||||
SetDeskWallPaper( (LPSTR)-1 );
|
SetDeskWallPaper( (LPSTR)-1 );
|
||||||
retvalue = 1;
|
retvalue = 1;
|
||||||
}
|
}
|
||||||
/* all other messages are ignored */
|
/* all other messages are ignored */
|
||||||
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return retvalue;
|
return retvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,11 +119,9 @@ static LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LP
|
||||||
BOOL WINAPI PaintDesktop(HDC hdc)
|
BOOL WINAPI PaintDesktop(HDC hdc)
|
||||||
{
|
{
|
||||||
HWND hwnd = GetDesktopWindow();
|
HWND hwnd = GetDesktopWindow();
|
||||||
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
|
||||||
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
|
|
||||||
|
|
||||||
/* check for a queue; otherwise don't paint anything (non-desktop mode) */
|
/* check for an owning thread; otherwise don't paint anything (non-desktop mode) */
|
||||||
if (wndPtr->hmemTaskQ)
|
if (GetWindowThreadProcessId( hwnd, NULL ))
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
|
@ -139,11 +129,10 @@ BOOL WINAPI PaintDesktop(HDC hdc)
|
||||||
|
|
||||||
/* Paint desktop pattern (only if wall paper does not cover everything) */
|
/* Paint desktop pattern (only if wall paper does not cover everything) */
|
||||||
|
|
||||||
if (!desktopPtr->hbitmapWallPaper ||
|
if (!hbitmapWallPaper ||
|
||||||
(!desktopPtr->fTileWallPaper && ((desktopPtr->bitmapSize.cx < rect.right) ||
|
(!fTileWallPaper && ((bitmapSize.cx < rect.right) || (bitmapSize.cy < rect.bottom))))
|
||||||
(desktopPtr->bitmapSize.cy < rect.bottom))))
|
|
||||||
{
|
{
|
||||||
HBRUSH brush = desktopPtr->hbrushPattern;
|
HBRUSH brush = hbrushPattern;
|
||||||
if (!brush) brush = GetClassLongA( hwnd, GCL_HBRBACKGROUND );
|
if (!brush) brush = GetClassLongA( hwnd, GCL_HBRBACKGROUND );
|
||||||
/* Set colors in case pattern is a monochrome bitmap */
|
/* Set colors in case pattern is a monochrome bitmap */
|
||||||
SetBkColor( hdc, RGB(0,0,0) );
|
SetBkColor( hdc, RGB(0,0,0) );
|
||||||
|
@ -153,33 +142,30 @@ BOOL WINAPI PaintDesktop(HDC hdc)
|
||||||
|
|
||||||
/* Paint wall paper */
|
/* Paint wall paper */
|
||||||
|
|
||||||
if (desktopPtr->hbitmapWallPaper)
|
if (hbitmapWallPaper)
|
||||||
{
|
{
|
||||||
INT x, y;
|
INT x, y;
|
||||||
HDC hMemDC = CreateCompatibleDC( hdc );
|
HDC hMemDC = CreateCompatibleDC( hdc );
|
||||||
|
|
||||||
SelectObject( hMemDC, desktopPtr->hbitmapWallPaper );
|
SelectObject( hMemDC, hbitmapWallPaper );
|
||||||
|
|
||||||
if (desktopPtr->fTileWallPaper)
|
if (fTileWallPaper)
|
||||||
{
|
{
|
||||||
for (y = 0; y < rect.bottom; y += desktopPtr->bitmapSize.cy)
|
for (y = 0; y < rect.bottom; y += bitmapSize.cy)
|
||||||
for (x = 0; x < rect.right; x += desktopPtr->bitmapSize.cx)
|
for (x = 0; x < rect.right; x += bitmapSize.cx)
|
||||||
BitBlt( hdc, x, y, desktopPtr->bitmapSize.cx,
|
BitBlt( hdc, x, y, bitmapSize.cx, bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
|
||||||
desktopPtr->bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = (rect.left + rect.right - desktopPtr->bitmapSize.cx) / 2;
|
x = (rect.left + rect.right - bitmapSize.cx) / 2;
|
||||||
y = (rect.top + rect.bottom - desktopPtr->bitmapSize.cy) / 2;
|
y = (rect.top + rect.bottom - bitmapSize.cy) / 2;
|
||||||
if (x < 0) x = 0;
|
if (x < 0) x = 0;
|
||||||
if (y < 0) y = 0;
|
if (y < 0) y = 0;
|
||||||
BitBlt( hdc, x, y, desktopPtr->bitmapSize.cx,
|
BitBlt( hdc, x, y, bitmapSize.cx, bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
|
||||||
desktopPtr->bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
|
|
||||||
}
|
}
|
||||||
DeleteDC( hMemDC );
|
DeleteDC( hMemDC );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,8 +199,6 @@ BOOL WINAPI SetDeskWallPaper( LPCSTR filename )
|
||||||
HBITMAP hbitmap;
|
HBITMAP hbitmap;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
WND *wndPtr = WIN_GetDesktop();
|
|
||||||
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
|
|
||||||
|
|
||||||
if (filename == (LPSTR)-1)
|
if (filename == (LPSTR)-1)
|
||||||
{
|
{
|
||||||
|
@ -224,17 +208,16 @@ BOOL WINAPI SetDeskWallPaper( LPCSTR filename )
|
||||||
hdc = GetDC( 0 );
|
hdc = GetDC( 0 );
|
||||||
hbitmap = DESKTOP_LoadBitmap( hdc, filename );
|
hbitmap = DESKTOP_LoadBitmap( hdc, filename );
|
||||||
ReleaseDC( 0, hdc );
|
ReleaseDC( 0, hdc );
|
||||||
if (desktopPtr->hbitmapWallPaper) DeleteObject( desktopPtr->hbitmapWallPaper );
|
if (hbitmapWallPaper) DeleteObject( hbitmapWallPaper );
|
||||||
desktopPtr->hbitmapWallPaper = hbitmap;
|
hbitmapWallPaper = hbitmap;
|
||||||
desktopPtr->fTileWallPaper = GetProfileIntA( "desktop", "TileWallPaper", 0 );
|
fTileWallPaper = GetProfileIntA( "desktop", "TileWallPaper", 0 );
|
||||||
if (hbitmap)
|
if (hbitmap)
|
||||||
{
|
{
|
||||||
BITMAP bmp;
|
BITMAP bmp;
|
||||||
GetObjectA( hbitmap, sizeof(bmp), &bmp );
|
GetObjectA( hbitmap, sizeof(bmp), &bmp );
|
||||||
desktopPtr->bitmapSize.cx = (bmp.bmWidth != 0) ? bmp.bmWidth : 1;
|
bitmapSize.cx = (bmp.bmWidth != 0) ? bmp.bmWidth : 1;
|
||||||
desktopPtr->bitmapSize.cy = (bmp.bmHeight != 0) ? bmp.bmHeight : 1;
|
bitmapSize.cy = (bmp.bmHeight != 0) ? bmp.bmHeight : 1;
|
||||||
}
|
}
|
||||||
WIN_ReleaseDesktop();
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,11 +229,9 @@ BOOL WINAPI SetDeskWallPaper( LPCSTR filename )
|
||||||
*/
|
*/
|
||||||
BOOL DESKTOP_SetPattern( LPCSTR pattern )
|
BOOL DESKTOP_SetPattern( LPCSTR pattern )
|
||||||
{
|
{
|
||||||
WND *wndPtr = WIN_GetDesktop();
|
|
||||||
DESKTOP *desktopPtr = (DESKTOP *)wndPtr->wExtra;
|
|
||||||
int pat[8];
|
int pat[8];
|
||||||
|
|
||||||
if (desktopPtr->hbrushPattern) DeleteObject( desktopPtr->hbrushPattern );
|
if (hbrushPattern) DeleteObject( hbrushPattern );
|
||||||
memset( pat, 0, sizeof(pat) );
|
memset( pat, 0, sizeof(pat) );
|
||||||
if (pattern && sscanf( pattern, " %d %d %d %d %d %d %d %d",
|
if (pattern && sscanf( pattern, " %d %d %d %d %d %d %d %d",
|
||||||
&pat[0], &pat[1], &pat[2], &pat[3],
|
&pat[0], &pat[1], &pat[2], &pat[3],
|
||||||
|
@ -262,11 +243,10 @@ BOOL DESKTOP_SetPattern( LPCSTR pattern )
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) pattern[i] = pat[i] & 0xffff;
|
for (i = 0; i < 8; i++) pattern[i] = pat[i] & 0xffff;
|
||||||
hbitmap = CreateBitmap( 8, 8, 1, 1, (LPSTR)pattern );
|
hbitmap = CreateBitmap( 8, 8, 1, 1, (LPSTR)pattern );
|
||||||
desktopPtr->hbrushPattern = CreatePatternBrush( hbitmap );
|
hbrushPattern = CreatePatternBrush( hbitmap );
|
||||||
DeleteObject( hbitmap );
|
DeleteObject( hbitmap );
|
||||||
}
|
}
|
||||||
else desktopPtr->hbrushPattern = 0;
|
else hbrushPattern = 0;
|
||||||
WIN_ReleaseDesktop();
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1091
controls/edit.c
1091
controls/edit.c
File diff suppressed because it is too large
Load Diff
|
@ -41,94 +41,89 @@ const struct builtin_class_descr ICONTITLE_builtin_class =
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* ICONTITLE_Create
|
* ICONTITLE_Create
|
||||||
*/
|
*/
|
||||||
HWND ICONTITLE_Create( WND* wnd )
|
HWND ICONTITLE_Create( HWND owner )
|
||||||
{
|
{
|
||||||
WND* wndPtr;
|
WND* wndPtr;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
|
HINSTANCE instance = GetWindowLongA( owner, GWL_HINSTANCE );
|
||||||
|
|
||||||
if( wnd->dwStyle & WS_CHILD )
|
if( GetWindowLongA( owner, GWL_STYLE ) & WS_CHILD )
|
||||||
hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_ATOM, NULL,
|
hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_ATOM, NULL,
|
||||||
WS_CHILD | WS_CLIPSIBLINGS, 0, 0, 1, 1,
|
WS_CHILD | WS_CLIPSIBLINGS, 0, 0, 1, 1,
|
||||||
wnd->parent->hwndSelf, 0, wnd->hInstance, NULL );
|
GetParent(owner), 0, instance, NULL );
|
||||||
else
|
else
|
||||||
hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_ATOM, NULL,
|
hWnd = CreateWindowExA( 0, ICONTITLE_CLASS_ATOM, NULL,
|
||||||
WS_CLIPSIBLINGS, 0, 0, 1, 1,
|
WS_CLIPSIBLINGS, 0, 0, 1, 1,
|
||||||
wnd->hwndSelf, 0, wnd->hInstance, NULL );
|
owner, 0, instance, NULL );
|
||||||
wndPtr = WIN_FindWndPtr( hWnd );
|
wndPtr = WIN_FindWndPtr( hWnd );
|
||||||
if( wndPtr )
|
if( wndPtr )
|
||||||
{
|
{
|
||||||
|
WND *wnd = WIN_FindWndPtr(owner);
|
||||||
wndPtr->owner = wnd; /* MDI depends on this */
|
wndPtr->owner = wnd; /* MDI depends on this */
|
||||||
wndPtr->dwStyle &= ~(WS_CAPTION | WS_BORDER);
|
wndPtr->dwStyle &= ~(WS_CAPTION | WS_BORDER);
|
||||||
if( wnd->dwStyle & WS_DISABLED ) wndPtr->dwStyle |= WS_DISABLED;
|
if (!IsWindowEnabled(owner)) wndPtr->dwStyle |= WS_DISABLED;
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
WIN_ReleaseWndPtr(wndPtr);
|
||||||
|
WIN_ReleaseWndPtr(wnd);
|
||||||
return hWnd;
|
return hWnd;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* ICONTITLE_GetTitlePos
|
* ICONTITLE_SetTitlePos
|
||||||
*/
|
*/
|
||||||
static BOOL ICONTITLE_GetTitlePos( WND* wnd, LPRECT lpRect )
|
static BOOL ICONTITLE_SetTitlePos( HWND hwnd, HWND owner )
|
||||||
{
|
{
|
||||||
static WCHAR emptyTitleText[] = {'<','.','.','.','>',0};
|
static WCHAR emptyTitleText[] = {'<','.','.','.','>',0};
|
||||||
LPWSTR str = NULL;
|
WCHAR str[80];
|
||||||
int length = lstrlenW( wnd->owner->text );
|
HDC hDC;
|
||||||
|
HFONT hPrevFont;
|
||||||
|
RECT rect;
|
||||||
|
INT cx, cy;
|
||||||
|
POINT pt;
|
||||||
|
|
||||||
if( length )
|
int length = GetWindowTextW( owner, str, sizeof(str)/sizeof(WCHAR) );
|
||||||
|
|
||||||
|
while (length && str[length - 1] == ' ') /* remove trailing spaces */
|
||||||
|
str[--length] = 0;
|
||||||
|
|
||||||
|
if( !length )
|
||||||
{
|
{
|
||||||
str = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR) );
|
strcpyW( str, emptyTitleText );
|
||||||
strcpyW( str, wnd->owner->text );
|
length = strlenW( str );
|
||||||
while( str[length - 1] == ' ' ) /* remove trailing spaces */
|
|
||||||
{
|
|
||||||
str[--length] = '\0';
|
|
||||||
if( !length )
|
|
||||||
{
|
|
||||||
HeapFree( GetProcessHeap(), 0, str );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( !length )
|
|
||||||
{
|
|
||||||
str = emptyTitleText;
|
|
||||||
length = lstrlenW( str );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( str )
|
if (!(hDC = GetDC( hwnd ))) return FALSE;
|
||||||
{
|
|
||||||
HDC hDC = GetDC( wnd->hwndSelf );
|
|
||||||
if( hDC )
|
|
||||||
{
|
|
||||||
HFONT hPrevFont = SelectObject( hDC, hIconTitleFont );
|
|
||||||
|
|
||||||
SetRect( lpRect, 0, 0, GetSystemMetrics(SM_CXICONSPACING) -
|
hPrevFont = SelectObject( hDC, hIconTitleFont );
|
||||||
GetSystemMetrics(SM_CXBORDER) * 2,
|
|
||||||
GetSystemMetrics(SM_CYBORDER) * 2 );
|
|
||||||
|
|
||||||
DrawTextW( hDC, str, length, lpRect, DT_CALCRECT |
|
SetRect( &rect, 0, 0, GetSystemMetrics(SM_CXICONSPACING) -
|
||||||
DT_CENTER | DT_NOPREFIX | DT_WORDBREAK |
|
GetSystemMetrics(SM_CXBORDER) * 2,
|
||||||
(( bMultiLineTitle ) ? 0 : DT_SINGLELINE) );
|
GetSystemMetrics(SM_CYBORDER) * 2 );
|
||||||
|
|
||||||
SelectObject( hDC, hPrevFont );
|
DrawTextW( hDC, str, length, &rect, DT_CALCRECT | DT_CENTER | DT_NOPREFIX | DT_WORDBREAK |
|
||||||
ReleaseDC( wnd->hwndSelf, hDC );
|
(( bMultiLineTitle ) ? 0 : DT_SINGLELINE) );
|
||||||
|
|
||||||
lpRect->right += 4 * GetSystemMetrics(SM_CXBORDER) - lpRect->left;
|
SelectObject( hDC, hPrevFont );
|
||||||
lpRect->left = wnd->owner->rectWindow.left + GetSystemMetrics(SM_CXICON) / 2 -
|
ReleaseDC( hwnd, hDC );
|
||||||
(lpRect->right - lpRect->left) / 2;
|
|
||||||
lpRect->bottom -= lpRect->top;
|
cx = rect.right - rect.left + 4 * GetSystemMetrics(SM_CXBORDER);
|
||||||
lpRect->top = wnd->owner->rectWindow.top + GetSystemMetrics(SM_CYICON);
|
cy = rect.bottom - rect.top;
|
||||||
}
|
|
||||||
if( str != emptyTitleText ) HeapFree( GetProcessHeap(), 0, str );
|
pt.x = (GetSystemMetrics(SM_CXICON) - cx) / 2;
|
||||||
return ( hDC ) ? TRUE : FALSE;
|
pt.y = GetSystemMetrics(SM_CYICON);
|
||||||
}
|
|
||||||
return FALSE;
|
/* point is relative to owner, make it relative to parent */
|
||||||
|
MapWindowPoints( owner, GetParent(hwnd), &pt, 1 );
|
||||||
|
|
||||||
|
SetWindowPos( hwnd, owner, pt.x, pt.y, cx, cy, SWP_NOACTIVATE );
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* ICONTITLE_Paint
|
* ICONTITLE_Paint
|
||||||
*/
|
*/
|
||||||
static BOOL ICONTITLE_Paint( WND* wnd, HDC hDC, BOOL bActive )
|
static BOOL ICONTITLE_Paint( HWND hwnd, HWND owner, HDC hDC, BOOL bActive )
|
||||||
{
|
{
|
||||||
HFONT hPrevFont;
|
HFONT hPrevFont;
|
||||||
HBRUSH hBrush = 0;
|
HBRUSH hBrush = 0;
|
||||||
|
@ -141,9 +136,9 @@ static BOOL ICONTITLE_Paint( WND* wnd, HDC hDC, BOOL bActive )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( wnd->dwStyle & WS_CHILD )
|
if( GetWindowLongA( hwnd, GWL_STYLE ) & WS_CHILD )
|
||||||
{
|
{
|
||||||
hBrush = (HBRUSH) GetClassLongA(wnd->hwndSelf, GCL_HBRBACKGROUND);
|
hBrush = (HBRUSH) GetClassLongA(hwnd, GCL_HBRBACKGROUND);
|
||||||
if( hBrush )
|
if( hBrush )
|
||||||
{
|
{
|
||||||
INT level;
|
INT level;
|
||||||
|
@ -165,25 +160,23 @@ static BOOL ICONTITLE_Paint( WND* wnd, HDC hDC, BOOL bActive )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FillWindow16( wnd->parent->hwndSelf, wnd->hwndSelf, hDC, hBrush );
|
FillWindow16( GetParent(hwnd), hwnd, hDC, hBrush );
|
||||||
|
|
||||||
hPrevFont = SelectObject( hDC, hIconTitleFont );
|
hPrevFont = SelectObject( hDC, hIconTitleFont );
|
||||||
if( hPrevFont )
|
if( hPrevFont )
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
INT length;
|
INT length;
|
||||||
char buffer[80];
|
WCHAR buffer[80];
|
||||||
|
|
||||||
rect.left = rect.top = 0;
|
GetClientRect( hwnd, &rect );
|
||||||
rect.right = wnd->rectWindow.right - wnd->rectWindow.left;
|
|
||||||
rect.bottom = wnd->rectWindow.bottom - wnd->rectWindow.top;
|
|
||||||
|
|
||||||
length = GetWindowTextA( wnd->owner->hwndSelf, buffer, 80 );
|
length = GetWindowTextW( owner, buffer, 80 );
|
||||||
SetTextColor( hDC, textColor );
|
SetTextColor( hDC, textColor );
|
||||||
SetBkMode( hDC, TRANSPARENT );
|
SetBkMode( hDC, TRANSPARENT );
|
||||||
|
|
||||||
DrawTextA( hDC, buffer, length, &rect, DT_CENTER | DT_NOPREFIX |
|
DrawTextW( hDC, buffer, length, &rect, DT_CENTER | DT_NOPREFIX |
|
||||||
DT_WORDBREAK | ((bMultiLineTitle) ? 0 : DT_SINGLELINE) );
|
DT_WORDBREAK | ((bMultiLineTitle) ? 0 : DT_SINGLELINE) );
|
||||||
|
|
||||||
SelectObject( hDC, hPrevFont );
|
SelectObject( hDC, hPrevFont );
|
||||||
}
|
}
|
||||||
|
@ -197,6 +190,7 @@ LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg,
|
||||||
WPARAM wParam, LPARAM lParam )
|
WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
LRESULT retvalue;
|
LRESULT retvalue;
|
||||||
|
HWND owner = GetWindow( hWnd, GW_OWNER );
|
||||||
WND *wnd = WIN_FindWndPtr( hWnd );
|
WND *wnd = WIN_FindWndPtr( hWnd );
|
||||||
|
|
||||||
if( !wnd )
|
if( !wnd )
|
||||||
|
@ -219,44 +213,27 @@ LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg,
|
||||||
goto END;
|
goto END;
|
||||||
case WM_NCMOUSEMOVE:
|
case WM_NCMOUSEMOVE:
|
||||||
case WM_NCLBUTTONDBLCLK:
|
case WM_NCLBUTTONDBLCLK:
|
||||||
retvalue = SendMessageA( wnd->owner->hwndSelf, msg, wParam, lParam );
|
retvalue = SendMessageW( owner, msg, wParam, lParam );
|
||||||
goto END;
|
goto END;
|
||||||
case WM_ACTIVATE:
|
case WM_ACTIVATE:
|
||||||
if( wParam ) SetActiveWindow( wnd->owner->hwndSelf );
|
if( wParam ) SetActiveWindow( owner );
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
retvalue = 0;
|
retvalue = 0;
|
||||||
goto END;
|
goto END;
|
||||||
case WM_SHOWWINDOW:
|
case WM_SHOWWINDOW:
|
||||||
if( wnd && wParam )
|
if( wnd && wParam ) ICONTITLE_SetTitlePos( hWnd, owner );
|
||||||
{
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
retvalue = 0;
|
retvalue = 0;
|
||||||
goto END;
|
goto END;
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
if( wnd )
|
if( wnd )
|
||||||
{
|
{
|
||||||
WND* iconWnd = WIN_LockWndPtr(wnd->owner);
|
if( GetWindowLongA( owner, GWL_STYLE ) & WS_CHILD )
|
||||||
|
lParam = SendMessageA( owner, WM_ISACTIVEICON, 0, 0 );
|
||||||
if( iconWnd->dwStyle & WS_CHILD )
|
|
||||||
lParam = SendMessageA( iconWnd->hwndSelf, WM_ISACTIVEICON, 0, 0 );
|
|
||||||
else
|
else
|
||||||
lParam = (iconWnd->hwndSelf == GetActiveWindow16());
|
lParam = (owner == GetActiveWindow());
|
||||||
|
if( ICONTITLE_Paint( hWnd, owner, (HDC)wParam, (BOOL)lParam ) )
|
||||||
WIN_ReleaseWndPtr(iconWnd);
|
|
||||||
if( ICONTITLE_Paint( wnd, (HDC)wParam, (BOOL)lParam ) )
|
|
||||||
ValidateRect( hWnd, NULL );
|
ValidateRect( hWnd, NULL );
|
||||||
retvalue = 1;
|
retvalue = 1;
|
||||||
goto END;
|
goto END;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
430
controls/menu.c
430
controls/menu.c
|
@ -285,7 +285,7 @@ static void do_debug_print_menuitem(const char *prefix, MENUITEM * mp,
|
||||||
*
|
*
|
||||||
* Validate the given menu handle and returns the menu structure pointer.
|
* Validate the given menu handle and returns the menu structure pointer.
|
||||||
*/
|
*/
|
||||||
POPUPMENU *MENU_GetMenu(HMENU hMenu)
|
static POPUPMENU *MENU_GetMenu(HMENU hMenu)
|
||||||
{
|
{
|
||||||
POPUPMENU *menu = USER_HEAP_LIN_ADDR(hMenu);
|
POPUPMENU *menu = USER_HEAP_LIN_ADDR(hMenu);
|
||||||
if (!menu || menu->wMagic != MENU_MAGIC)
|
if (!menu || menu->wMagic != MENU_MAGIC)
|
||||||
|
@ -296,6 +296,23 @@ POPUPMENU *MENU_GetMenu(HMENU hMenu)
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* get_win_sys_menu
|
||||||
|
*
|
||||||
|
* Get the system menu of a window
|
||||||
|
*/
|
||||||
|
static HMENU get_win_sys_menu( HWND hwnd )
|
||||||
|
{
|
||||||
|
HMENU ret = 0;
|
||||||
|
WND *win = WIN_FindWndPtr( hwnd );
|
||||||
|
if (win)
|
||||||
|
{
|
||||||
|
ret = win->hSysMenu;
|
||||||
|
WIN_ReleaseWndPtr( win );
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* MENU_CopySysPopup
|
* MENU_CopySysPopup
|
||||||
*
|
*
|
||||||
|
@ -643,12 +660,7 @@ static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu,
|
||||||
{
|
{
|
||||||
TRACE("\tlooking for '%c' in [%04x]\n", (char)key, (UINT16)hmenu );
|
TRACE("\tlooking for '%c' in [%04x]\n", (char)key, (UINT16)hmenu );
|
||||||
|
|
||||||
if (!IsMenu( hmenu ))
|
if (!IsMenu( hmenu )) hmenu = GetSubMenu( get_win_sys_menu(hwndOwner), 0);
|
||||||
{
|
|
||||||
WND* w = WIN_FindWndPtr(hwndOwner);
|
|
||||||
hmenu = GetSubMenu(w->hSysMenu, 0);
|
|
||||||
WIN_ReleaseWndPtr(w);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hmenu)
|
if (hmenu)
|
||||||
{
|
{
|
||||||
|
@ -1457,10 +1469,9 @@ UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, HWND hwnd,
|
||||||
LPPOPUPMENU lppop;
|
LPPOPUPMENU lppop;
|
||||||
UINT i,retvalue;
|
UINT i,retvalue;
|
||||||
HFONT hfontOld = 0;
|
HFONT hfontOld = 0;
|
||||||
|
HMENU hMenu = GetMenu(hwnd);
|
||||||
|
|
||||||
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
lppop = MENU_GetMenu( hMenu );
|
||||||
|
|
||||||
lppop = MENU_GetMenu ((HMENU)wndPtr->wIDmenu );
|
|
||||||
if (lppop == NULL || lprect == NULL)
|
if (lppop == NULL || lprect == NULL)
|
||||||
{
|
{
|
||||||
retvalue = GetSystemMetrics(SM_CYMENU);
|
retvalue = GetSystemMetrics(SM_CYMENU);
|
||||||
|
@ -1505,16 +1516,13 @@ UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, HWND hwnd,
|
||||||
|
|
||||||
for (i = 0; i < lppop->nItems; i++)
|
for (i = 0; i < lppop->nItems; i++)
|
||||||
{
|
{
|
||||||
MENU_DrawMenuItem( hwnd, (HMENU)wndPtr->wIDmenu, hwnd,
|
MENU_DrawMenuItem( hwnd, hMenu, hwnd,
|
||||||
hDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
|
hDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
|
||||||
}
|
}
|
||||||
retvalue = lppop->Height;
|
retvalue = lppop->Height;
|
||||||
|
|
||||||
END:
|
END:
|
||||||
if (hfontOld)
|
if (hfontOld) SelectObject (hDC, hfontOld);
|
||||||
SelectObject (hDC, hfontOld);
|
|
||||||
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return retvalue;
|
return retvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1527,8 +1535,8 @@ END:
|
||||||
static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id,
|
static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id,
|
||||||
INT x, INT y, INT xanchor, INT yanchor )
|
INT x, INT y, INT xanchor, INT yanchor )
|
||||||
{
|
{
|
||||||
POPUPMENU *menu;
|
POPUPMENU *menu;
|
||||||
WND *wndOwner = NULL;
|
UINT width, height;
|
||||||
|
|
||||||
TRACE("owner=0x%04x hmenu=0x%04x id=0x%04x x=0x%04x y=0x%04x xa=0x%04x ya=0x%04x\n",
|
TRACE("owner=0x%04x hmenu=0x%04x id=0x%04x x=0x%04x y=0x%04x xa=0x%04x ya=0x%04x\n",
|
||||||
hwndOwner, hmenu, id, x, y, xanchor, yanchor);
|
hwndOwner, hmenu, id, x, y, xanchor, yanchor);
|
||||||
|
@ -1543,62 +1551,52 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id,
|
||||||
/* store the owner for DrawItem */
|
/* store the owner for DrawItem */
|
||||||
menu->hwndOwner = hwndOwner;
|
menu->hwndOwner = hwndOwner;
|
||||||
|
|
||||||
if( (wndOwner = WIN_FindWndPtr( hwndOwner )) )
|
|
||||||
|
MENU_PopupMenuCalcSize( menu, hwndOwner );
|
||||||
|
|
||||||
|
/* adjust popup menu pos so that it fits within the desktop */
|
||||||
|
|
||||||
|
width = menu->Width + GetSystemMetrics(SM_CXBORDER);
|
||||||
|
height = menu->Height + GetSystemMetrics(SM_CYBORDER);
|
||||||
|
|
||||||
|
if( x + width > GetSystemMetrics(SM_CXSCREEN ))
|
||||||
{
|
{
|
||||||
UINT width, height;
|
if( xanchor )
|
||||||
|
x -= width - xanchor;
|
||||||
MENU_PopupMenuCalcSize( menu, hwndOwner );
|
if( x + width > GetSystemMetrics(SM_CXSCREEN))
|
||||||
|
x = GetSystemMetrics(SM_CXSCREEN) - width;
|
||||||
/* adjust popup menu pos so that it fits within the desktop */
|
|
||||||
|
|
||||||
width = menu->Width + GetSystemMetrics(SM_CXBORDER);
|
|
||||||
height = menu->Height + GetSystemMetrics(SM_CYBORDER);
|
|
||||||
|
|
||||||
if( x + width > GetSystemMetrics(SM_CXSCREEN ))
|
|
||||||
{
|
|
||||||
if( xanchor )
|
|
||||||
x -= width - xanchor;
|
|
||||||
if( x + width > GetSystemMetrics(SM_CXSCREEN))
|
|
||||||
x = GetSystemMetrics(SM_CXSCREEN) - width;
|
|
||||||
}
|
|
||||||
if( x < 0 ) x = 0;
|
|
||||||
|
|
||||||
if( y + height > GetSystemMetrics(SM_CYSCREEN ))
|
|
||||||
{
|
|
||||||
if( yanchor )
|
|
||||||
y -= height + yanchor;
|
|
||||||
if( y + height > GetSystemMetrics(SM_CYSCREEN ))
|
|
||||||
y = GetSystemMetrics(SM_CYSCREEN) - height;
|
|
||||||
}
|
|
||||||
if( y < 0 ) y = 0;
|
|
||||||
|
|
||||||
if( TWEAK_WineLook == WIN31_LOOK )
|
|
||||||
{
|
|
||||||
width += POPUP_XSHADE * GetSystemMetrics(SM_CXBORDER); /* add space for shading */
|
|
||||||
height += POPUP_YSHADE * GetSystemMetrics(SM_CYBORDER);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* NOTE: In Windows, top menu popup is not owned. */
|
|
||||||
menu->hWnd = CreateWindowA( POPUPMENU_CLASS_ATOM, NULL,
|
|
||||||
WS_POPUP, x, y, width, height,
|
|
||||||
hwndOwner, 0, wndOwner->hInstance,
|
|
||||||
(LPVOID)hmenu );
|
|
||||||
if( !menu->hWnd )
|
|
||||||
{
|
|
||||||
WIN_ReleaseWndPtr(wndOwner);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!top_popup) top_popup = menu->hWnd;
|
|
||||||
|
|
||||||
/* Display the window */
|
|
||||||
|
|
||||||
SetWindowPos( menu->hWnd, HWND_TOP, 0, 0, 0, 0,
|
|
||||||
SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
|
|
||||||
UpdateWindow( menu->hWnd );
|
|
||||||
WIN_ReleaseWndPtr(wndOwner);
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
if( x < 0 ) x = 0;
|
||||||
|
|
||||||
|
if( y + height > GetSystemMetrics(SM_CYSCREEN ))
|
||||||
|
{
|
||||||
|
if( yanchor )
|
||||||
|
y -= height + yanchor;
|
||||||
|
if( y + height > GetSystemMetrics(SM_CYSCREEN ))
|
||||||
|
y = GetSystemMetrics(SM_CYSCREEN) - height;
|
||||||
|
}
|
||||||
|
if( y < 0 ) y = 0;
|
||||||
|
|
||||||
|
if( TWEAK_WineLook == WIN31_LOOK )
|
||||||
|
{
|
||||||
|
width += POPUP_XSHADE * GetSystemMetrics(SM_CXBORDER); /* add space for shading */
|
||||||
|
height += POPUP_YSHADE * GetSystemMetrics(SM_CYBORDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* NOTE: In Windows, top menu popup is not owned. */
|
||||||
|
menu->hWnd = CreateWindowA( POPUPMENU_CLASS_ATOM, NULL,
|
||||||
|
WS_POPUP, x, y, width, height,
|
||||||
|
hwndOwner, 0, GetWindowLongA(hwndOwner,GWL_HINSTANCE),
|
||||||
|
(LPVOID)hmenu );
|
||||||
|
if( !menu->hWnd ) return FALSE;
|
||||||
|
if (!top_popup) top_popup = menu->hWnd;
|
||||||
|
|
||||||
|
/* Display the window */
|
||||||
|
|
||||||
|
SetWindowPos( menu->hWnd, HWND_TOP, 0, 0, 0, 0,
|
||||||
|
SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
|
||||||
|
UpdateWindow( menu->hWnd );
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2005,27 +2003,17 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
|
||||||
RECT rect;
|
RECT rect;
|
||||||
POPUPMENU *menu;
|
POPUPMENU *menu;
|
||||||
MENUITEM *item;
|
MENUITEM *item;
|
||||||
WND *wndPtr;
|
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
|
|
||||||
TRACE("owner=0x%04x hmenu=0x%04x 0x%04x\n", hwndOwner, hmenu, selectFirst);
|
TRACE("owner=0x%04x hmenu=0x%04x 0x%04x\n", hwndOwner, hmenu, selectFirst);
|
||||||
|
|
||||||
if (!(menu = MENU_GetMenu( hmenu ))) return hmenu;
|
if (!(menu = MENU_GetMenu( hmenu ))) return hmenu;
|
||||||
|
|
||||||
if (!(wndPtr = WIN_FindWndPtr( menu->hWnd )) ||
|
if (menu->FocusedItem == NO_SELECTED_ITEM) return hmenu;
|
||||||
(menu->FocusedItem == NO_SELECTED_ITEM))
|
|
||||||
{
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return hmenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
item = &menu->items[menu->FocusedItem];
|
item = &menu->items[menu->FocusedItem];
|
||||||
if (!(item->fType & MF_POPUP) ||
|
if (!(item->fType & MF_POPUP) || (item->fState & (MF_GRAYED | MF_DISABLED)))
|
||||||
(item->fState & (MF_GRAYED | MF_DISABLED)))
|
|
||||||
{
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return hmenu;
|
return hmenu;
|
||||||
}
|
|
||||||
|
|
||||||
/* message must be sent before using item,
|
/* message must be sent before using item,
|
||||||
because nearly everything may be changed by the application ! */
|
because nearly everything may be changed by the application ! */
|
||||||
|
@ -2057,26 +2045,29 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
|
||||||
|
|
||||||
if (IS_SYSTEM_MENU(menu))
|
if (IS_SYSTEM_MENU(menu))
|
||||||
{
|
{
|
||||||
MENU_InitSysMenuPopup(item->hSubMenu, wndPtr->dwStyle, GetClassLongA(wndPtr->hwndSelf, GCL_STYLE));
|
MENU_InitSysMenuPopup(item->hSubMenu,
|
||||||
|
GetWindowLongA( menu->hWnd, GWL_STYLE ),
|
||||||
|
GetClassLongA( menu->hWnd, GCL_STYLE));
|
||||||
|
|
||||||
NC_GetSysPopupPos( wndPtr, &rect );
|
NC_GetSysPopupPos( menu->hWnd, &rect );
|
||||||
rect.top = rect.bottom;
|
rect.top = rect.bottom;
|
||||||
rect.right = GetSystemMetrics(SM_CXSIZE);
|
rect.right = GetSystemMetrics(SM_CXSIZE);
|
||||||
rect.bottom = GetSystemMetrics(SM_CYSIZE);
|
rect.bottom = GetSystemMetrics(SM_CYSIZE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
GetWindowRect( menu->hWnd, &rect );
|
||||||
if (menu->wFlags & MF_POPUP)
|
if (menu->wFlags & MF_POPUP)
|
||||||
{
|
{
|
||||||
rect.left = wndPtr->rectWindow.left + item->rect.right - GetSystemMetrics(SM_CXBORDER);
|
rect.left += item->rect.right - GetSystemMetrics(SM_CXBORDER);
|
||||||
rect.top = wndPtr->rectWindow.top + item->rect.top;
|
rect.top += item->rect.top;
|
||||||
rect.right = item->rect.left - item->rect.right + GetSystemMetrics(SM_CXBORDER);
|
rect.right = item->rect.left - item->rect.right + GetSystemMetrics(SM_CXBORDER);
|
||||||
rect.bottom = item->rect.top - item->rect.bottom;
|
rect.bottom = item->rect.top - item->rect.bottom;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rect.left = wndPtr->rectWindow.left + item->rect.left;
|
rect.left += item->rect.left;
|
||||||
rect.top = wndPtr->rectWindow.top + item->rect.bottom;
|
rect.top += item->rect.bottom;
|
||||||
rect.right = item->rect.right - item->rect.left;
|
rect.right = item->rect.right - item->rect.left;
|
||||||
rect.bottom = item->rect.bottom - item->rect.top;
|
rect.bottom = item->rect.bottom - item->rect.top;
|
||||||
}
|
}
|
||||||
|
@ -2086,7 +2077,6 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
|
||||||
rect.left, rect.top, rect.right, rect.bottom );
|
rect.left, rect.top, rect.right, rect.bottom );
|
||||||
if (selectFirst)
|
if (selectFirst)
|
||||||
MENU_MoveSelection( hwndOwner, item->hSubMenu, ITEM_NEXT );
|
MENU_MoveSelection( hwndOwner, item->hSubMenu, ITEM_NEXT );
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return item->hSubMenu;
|
return item->hSubMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2108,30 +2098,28 @@ BOOL MENU_IsMenuActive(void)
|
||||||
static HMENU MENU_PtMenu( HMENU hMenu, POINT pt )
|
static HMENU MENU_PtMenu( HMENU hMenu, POINT pt )
|
||||||
{
|
{
|
||||||
POPUPMENU *menu = MENU_GetMenu( hMenu );
|
POPUPMENU *menu = MENU_GetMenu( hMenu );
|
||||||
register UINT ht = menu->FocusedItem;
|
UINT item = menu->FocusedItem;
|
||||||
|
HMENU ret;
|
||||||
|
|
||||||
/* try subpopup first (if any) */
|
/* try subpopup first (if any) */
|
||||||
ht = (ht != NO_SELECTED_ITEM &&
|
ret = (item != NO_SELECTED_ITEM &&
|
||||||
(menu->items[ht].fType & MF_POPUP) &&
|
(menu->items[item].fType & MF_POPUP) &&
|
||||||
(menu->items[ht].fState & MF_MOUSESELECT))
|
(menu->items[item].fState & MF_MOUSESELECT))
|
||||||
? (UINT) MENU_PtMenu(menu->items[ht].hSubMenu, pt) : 0;
|
? MENU_PtMenu(menu->items[item].hSubMenu, pt) : 0;
|
||||||
|
|
||||||
if( !ht ) /* check the current window (avoiding WM_HITTEST) */
|
if (!ret) /* check the current window (avoiding WM_HITTEST) */
|
||||||
{
|
{
|
||||||
ht = (UINT)NC_HandleNCHitTest( menu->hWnd, pt );
|
INT ht = NC_HandleNCHitTest( menu->hWnd, pt );
|
||||||
if( menu->wFlags & MF_POPUP )
|
if( menu->wFlags & MF_POPUP )
|
||||||
ht = (ht != (UINT)HTNOWHERE &&
|
{
|
||||||
ht != (UINT)HTERROR) ? (UINT)hMenu : 0;
|
if (ht != HTNOWHERE && ht != HTERROR) ret = hMenu;
|
||||||
else
|
}
|
||||||
{
|
else if (ht == HTSYSMENU)
|
||||||
WND* wndPtr = WIN_FindWndPtr(menu->hWnd);
|
ret = get_win_sys_menu( menu->hWnd );
|
||||||
|
else if (ht == HTMENU)
|
||||||
ht = ( ht == HTSYSMENU ) ? (UINT)(wndPtr->hSysMenu)
|
ret = GetMenu( menu->hWnd );
|
||||||
: ( ht == HTMENU ) ? (UINT)(wndPtr->wIDmenu) : 0;
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (HMENU)ht;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -2335,7 +2323,6 @@ static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk )
|
||||||
if( (vk == VK_LEFT && menu->FocusedItem == 0 ) ||
|
if( (vk == VK_LEFT && menu->FocusedItem == 0 ) ||
|
||||||
(vk == VK_RIGHT && menu->FocusedItem == menu->nItems - 1))
|
(vk == VK_RIGHT && menu->FocusedItem == menu->nItems - 1))
|
||||||
{
|
{
|
||||||
WND* wndPtr;
|
|
||||||
HMENU hNewMenu;
|
HMENU hNewMenu;
|
||||||
HWND hNewWnd;
|
HWND hNewWnd;
|
||||||
UINT id = 0;
|
UINT id = 0;
|
||||||
|
@ -2347,62 +2334,50 @@ static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk )
|
||||||
|
|
||||||
if( l == 0 )
|
if( l == 0 )
|
||||||
{
|
{
|
||||||
wndPtr = WIN_FindWndPtr(pmt->hOwnerWnd);
|
DWORD style = GetWindowLongA( pmt->hOwnerWnd, GWL_STYLE );
|
||||||
|
|
||||||
hNewWnd = pmt->hOwnerWnd;
|
hNewWnd = pmt->hOwnerWnd;
|
||||||
if( IS_SYSTEM_MENU(menu) )
|
if( IS_SYSTEM_MENU(menu) )
|
||||||
{
|
{
|
||||||
/* switch to the menu bar */
|
/* switch to the menu bar */
|
||||||
|
|
||||||
if( wndPtr->dwStyle & WS_CHILD || !wndPtr->wIDmenu )
|
if(style & WS_CHILD || !(hNewMenu = GetMenu(hNewWnd))) return FALSE;
|
||||||
{
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
hNewMenu = wndPtr->wIDmenu;
|
|
||||||
if( vk == VK_LEFT )
|
if( vk == VK_LEFT )
|
||||||
{
|
{
|
||||||
menu = MENU_GetMenu( hNewMenu );
|
menu = MENU_GetMenu( hNewMenu );
|
||||||
id = menu->nItems - 1;
|
id = menu->nItems - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( wndPtr->dwStyle & WS_SYSMENU )
|
else if (style & WS_SYSMENU )
|
||||||
{
|
{
|
||||||
/* switch to the system menu */
|
/* switch to the system menu */
|
||||||
hNewMenu = wndPtr->hSysMenu;
|
hNewMenu = get_win_sys_menu( hNewWnd );
|
||||||
}
|
}
|
||||||
else
|
else return FALSE;
|
||||||
{
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
}
|
}
|
||||||
else /* application returned a new menu to switch to */
|
else /* application returned a new menu to switch to */
|
||||||
{
|
{
|
||||||
hNewMenu = LOWORD(l); hNewWnd = HIWORD(l);
|
hNewMenu = LOWORD(l);
|
||||||
|
hNewWnd = HIWORD(l);
|
||||||
|
|
||||||
if( IsMenu(hNewMenu) && IsWindow(hNewWnd) )
|
if( IsMenu(hNewMenu) && IsWindow(hNewWnd) )
|
||||||
{
|
{
|
||||||
wndPtr = WIN_FindWndPtr(hNewWnd);
|
DWORD style = GetWindowLongA( hNewWnd, GWL_STYLE );
|
||||||
|
|
||||||
if( wndPtr->dwStyle & WS_SYSMENU &&
|
if (style & WS_SYSMENU &&
|
||||||
GetSubMenu(wndPtr->hSysMenu, 0) == hNewMenu )
|
GetSubMenu(get_win_sys_menu(hNewWnd), 0) == hNewMenu )
|
||||||
{
|
{
|
||||||
/* get the real system menu */
|
/* get the real system menu */
|
||||||
hNewMenu = wndPtr->hSysMenu;
|
hNewMenu = get_win_sys_menu(hNewWnd);
|
||||||
}
|
}
|
||||||
else if( wndPtr->dwStyle & WS_CHILD || wndPtr->wIDmenu != hNewMenu )
|
else if (style & WS_CHILD || GetMenu(hNewWnd) != hNewMenu )
|
||||||
{
|
{
|
||||||
/* FIXME: Not sure what to do here;
|
/* FIXME: Not sure what to do here;
|
||||||
* perhaps try to track hNewMenu as a popup? */
|
* perhaps try to track hNewMenu as a popup? */
|
||||||
|
|
||||||
TRACE(" -- got confused.\n");
|
TRACE(" -- got confused.\n");
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
}
|
}
|
||||||
else return FALSE;
|
else return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2955,13 +2930,12 @@ static BOOL MENU_ExitTracking(HWND hWnd)
|
||||||
*
|
*
|
||||||
* Menu-bar tracking upon a mouse event. Called from NC_HandleSysCommand().
|
* Menu-bar tracking upon a mouse event. Called from NC_HandleSysCommand().
|
||||||
*/
|
*/
|
||||||
void MENU_TrackMouseMenuBar( WND* wndPtr, INT ht, POINT pt )
|
void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt )
|
||||||
{
|
{
|
||||||
HWND hWnd = wndPtr->hwndSelf;
|
HMENU hMenu = (ht == HTSYSMENU) ? get_win_sys_menu( hWnd ) : GetMenu( hWnd );
|
||||||
HMENU hMenu = (ht == HTSYSMENU) ? wndPtr->hSysMenu : wndPtr->wIDmenu;
|
|
||||||
UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON;
|
UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON;
|
||||||
|
|
||||||
TRACE("pwnd=%p ht=0x%04x (%ld,%ld)\n", wndPtr, ht, pt.x, pt.y);
|
TRACE("wnd=%x ht=0x%04x (%ld,%ld)\n", hWnd, ht, pt.x, pt.y);
|
||||||
|
|
||||||
if (IsMenu(hMenu))
|
if (IsMenu(hMenu))
|
||||||
{
|
{
|
||||||
|
@ -2977,59 +2951,54 @@ void MENU_TrackMouseMenuBar( WND* wndPtr, INT ht, POINT pt )
|
||||||
*
|
*
|
||||||
* Menu-bar tracking upon a keyboard event. Called from NC_HandleSysCommand().
|
* Menu-bar tracking upon a keyboard event. Called from NC_HandleSysCommand().
|
||||||
*/
|
*/
|
||||||
void MENU_TrackKbdMenuBar( WND* wndPtr, UINT wParam, INT vkey)
|
void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, INT vkey)
|
||||||
{
|
{
|
||||||
UINT uItem = NO_SELECTED_ITEM;
|
UINT uItem = NO_SELECTED_ITEM;
|
||||||
HMENU hTrackMenu;
|
HMENU hTrackMenu;
|
||||||
UINT wFlags = TPM_ENTERIDLEEX | TPM_LEFTALIGN | TPM_LEFTBUTTON;
|
UINT wFlags = TPM_ENTERIDLEEX | TPM_LEFTALIGN | TPM_LEFTBUTTON;
|
||||||
|
|
||||||
/* find window that has a menu */
|
/* find window that has a menu */
|
||||||
|
|
||||||
while( wndPtr->dwStyle & WS_CHILD)
|
while (GetWindowLongA( hwnd, GWL_STYLE ) & WS_CHILD)
|
||||||
if( !(wndPtr = wndPtr->parent) ) return;
|
if (!(hwnd = GetParent( hwnd ))) return;
|
||||||
|
|
||||||
/* check if we have to track a system menu */
|
/* check if we have to track a system menu */
|
||||||
|
|
||||||
if( (wndPtr->dwStyle & (WS_CHILD | WS_MINIMIZE)) ||
|
hTrackMenu = GetMenu( hwnd );
|
||||||
!wndPtr->wIDmenu || vkey == VK_SPACE )
|
if (!hTrackMenu || IsIconic(hwnd) || vkey == VK_SPACE )
|
||||||
{
|
{
|
||||||
if( !(wndPtr->dwStyle & WS_SYSMENU) ) return;
|
if (!(GetWindowLongA( hwnd, GWL_STYLE ) & WS_SYSMENU)) return;
|
||||||
hTrackMenu = wndPtr->hSysMenu;
|
hTrackMenu = get_win_sys_menu( hwnd );
|
||||||
uItem = 0;
|
uItem = 0;
|
||||||
wParam |= HTSYSMENU; /* prevent item lookup */
|
wParam |= HTSYSMENU; /* prevent item lookup */
|
||||||
}
|
}
|
||||||
else
|
|
||||||
hTrackMenu = wndPtr->wIDmenu;
|
|
||||||
|
|
||||||
if (IsMenu( hTrackMenu ))
|
if (!IsMenu( hTrackMenu )) return;
|
||||||
|
|
||||||
|
MENU_InitTracking( hwnd, hTrackMenu, FALSE, wFlags );
|
||||||
|
|
||||||
|
if( vkey && vkey != VK_SPACE )
|
||||||
{
|
{
|
||||||
MENU_InitTracking( wndPtr->hwndSelf, hTrackMenu, FALSE, wFlags );
|
uItem = MENU_FindItemByKey( hwnd, hTrackMenu, vkey, (wParam & HTSYSMENU) );
|
||||||
|
if( uItem >= (UINT)(-2) )
|
||||||
if( vkey && vkey != VK_SPACE )
|
|
||||||
{
|
{
|
||||||
uItem = MENU_FindItemByKey( wndPtr->hwndSelf, hTrackMenu,
|
if( uItem == (UINT)(-1) ) MessageBeep(0);
|
||||||
vkey, (wParam & HTSYSMENU) );
|
hTrackMenu = 0;
|
||||||
if( uItem >= (UINT)(-2) )
|
|
||||||
{
|
|
||||||
if( uItem == (UINT)(-1) ) MessageBeep(0);
|
|
||||||
hTrackMenu = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( hTrackMenu )
|
|
||||||
{
|
|
||||||
MENU_SelectItem( wndPtr->hwndSelf, hTrackMenu, uItem, TRUE, 0 );
|
|
||||||
|
|
||||||
if( uItem == NO_SELECTED_ITEM )
|
|
||||||
MENU_MoveSelection( wndPtr->hwndSelf, hTrackMenu, ITEM_NEXT );
|
|
||||||
else if( vkey )
|
|
||||||
PostMessageA( wndPtr->hwndSelf, WM_KEYDOWN, VK_DOWN, 0L );
|
|
||||||
|
|
||||||
MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, wndPtr->hwndSelf, NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
MENU_ExitTracking (wndPtr->hwndSelf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( hTrackMenu )
|
||||||
|
{
|
||||||
|
MENU_SelectItem( hwnd, hTrackMenu, uItem, TRUE, 0 );
|
||||||
|
|
||||||
|
if( uItem == NO_SELECTED_ITEM )
|
||||||
|
MENU_MoveSelection( hwnd, hTrackMenu, ITEM_NEXT );
|
||||||
|
else if( vkey )
|
||||||
|
PostMessageA( hwnd, WM_KEYDOWN, VK_DOWN, 0L );
|
||||||
|
|
||||||
|
MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, hwnd, NULL );
|
||||||
|
}
|
||||||
|
MENU_ExitTracking( hwnd );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3159,30 +3128,19 @@ UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
|
||||||
{
|
{
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
RECT rectBar;
|
RECT rectBar;
|
||||||
WND *wndPtr;
|
|
||||||
LPPOPUPMENU lppop;
|
LPPOPUPMENU lppop;
|
||||||
UINT retvalue;
|
|
||||||
|
|
||||||
TRACE("HWND 0x%x, width %d, at (%d, %d).\n",
|
TRACE("HWND 0x%x, width %d, at (%d, %d).\n",
|
||||||
hwnd, menubarWidth, orgX, orgY );
|
hwnd, menubarWidth, orgX, orgY );
|
||||||
|
|
||||||
if (!(wndPtr = WIN_FindWndPtr( hwnd )))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!(lppop = MENU_GetMenu((HMENU16)wndPtr->wIDmenu)))
|
if (!(lppop = MENU_GetMenu( GetMenu(hwnd) ))) return 0;
|
||||||
{
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
hdc = GetDCEx( hwnd, 0, DCX_CACHE | DCX_WINDOW );
|
hdc = GetDCEx( hwnd, 0, DCX_CACHE | DCX_WINDOW );
|
||||||
SelectObject( hdc, hMenuFont);
|
SelectObject( hdc, hMenuFont);
|
||||||
SetRect(&rectBar, orgX, orgY, orgX+menubarWidth, orgY+GetSystemMetrics(SM_CYMENU));
|
SetRect(&rectBar, orgX, orgY, orgX+menubarWidth, orgY+GetSystemMetrics(SM_CYMENU));
|
||||||
MENU_MenuBarCalcSize( hdc, &rectBar, lppop, hwnd );
|
MENU_MenuBarCalcSize( hdc, &rectBar, lppop, hwnd );
|
||||||
ReleaseDC( hwnd, hdc );
|
ReleaseDC( hwnd, hdc );
|
||||||
retvalue = lppop->Height;
|
return lppop->Height;
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return retvalue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3977,15 +3935,8 @@ HMENU16 WINAPI GetMenu16( HWND16 hWnd )
|
||||||
*/
|
*/
|
||||||
HMENU WINAPI GetMenu( HWND hWnd )
|
HMENU WINAPI GetMenu( HWND hWnd )
|
||||||
{
|
{
|
||||||
HMENU retvalue;
|
HMENU retvalue = (HMENU)GetWindowLongA( hWnd, GWL_ID );
|
||||||
WND * wndPtr = WIN_FindWndPtr(hWnd);
|
TRACE("for %04x returning %04x\n", hWnd, retvalue);
|
||||||
|
|
||||||
if (!wndPtr) return 0;
|
|
||||||
|
|
||||||
retvalue = (HMENU)wndPtr->wIDmenu;
|
|
||||||
TRACE("for %swindow %04x returning %04x\n",
|
|
||||||
(wndPtr->dwStyle & WS_CHILD) ? "child " : "", hWnd, retvalue);
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return retvalue;
|
return retvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4004,40 +3955,32 @@ BOOL16 WINAPI SetMenu16( HWND16 hWnd, HMENU16 hMenu )
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI SetMenu( HWND hWnd, HMENU hMenu )
|
BOOL WINAPI SetMenu( HWND hWnd, HMENU hMenu )
|
||||||
{
|
{
|
||||||
WND * wndPtr = WIN_FindWndPtr(hWnd);
|
|
||||||
BOOL res = FALSE;
|
|
||||||
|
|
||||||
TRACE("(%04x, %04x);\n", hWnd, hMenu);
|
TRACE("(%04x, %04x);\n", hWnd, hMenu);
|
||||||
|
|
||||||
if (hMenu && !IsMenu(hMenu))
|
if (hMenu && !IsMenu(hMenu))
|
||||||
{
|
{
|
||||||
WARN("hMenu is not a menu handle\n");
|
WARN("hMenu %x is not a menu handle\n", hMenu);
|
||||||
goto exit;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (GetWindowLongA( hWnd, GWL_STYLE ) & WS_CHILD) return FALSE;
|
||||||
|
|
||||||
if (wndPtr && !(wndPtr->dwStyle & WS_CHILD))
|
if (GetCapture() == hWnd) ReleaseCapture();
|
||||||
|
|
||||||
|
if (hMenu != 0)
|
||||||
{
|
{
|
||||||
if (GetCapture() == hWnd) ReleaseCapture();
|
LPPOPUPMENU lpmenu;
|
||||||
|
|
||||||
wndPtr->wIDmenu = (UINT)hMenu;
|
if (!(lpmenu = MENU_GetMenu(hMenu))) return FALSE;
|
||||||
if (hMenu != 0)
|
|
||||||
{
|
|
||||||
LPPOPUPMENU lpmenu;
|
|
||||||
|
|
||||||
if (!(lpmenu = MENU_GetMenu(hMenu)))
|
lpmenu->hWnd = hWnd;
|
||||||
goto exit;
|
lpmenu->Height = 0; /* Make sure we recalculate the size */
|
||||||
|
|
||||||
lpmenu->hWnd = hWnd;
|
|
||||||
lpmenu->Height = 0; /* Make sure we recalculate the size */
|
|
||||||
}
|
|
||||||
if (IsWindowVisible(hWnd))
|
|
||||||
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
|
|
||||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
|
|
||||||
res = TRUE;
|
|
||||||
}
|
}
|
||||||
exit:
|
SetWindowLongA( hWnd, GWL_ID, hMenu );
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return res;
|
if (IsWindowVisible(hWnd))
|
||||||
|
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
|
||||||
|
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4079,25 +4022,16 @@ void WINAPI DrawMenuBar16( HWND16 hWnd )
|
||||||
BOOL WINAPI DrawMenuBar( HWND hWnd )
|
BOOL WINAPI DrawMenuBar( HWND hWnd )
|
||||||
{
|
{
|
||||||
LPPOPUPMENU lppop;
|
LPPOPUPMENU lppop;
|
||||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
HMENU hMenu = GetMenu(hWnd);
|
||||||
if (wndPtr && !(wndPtr->dwStyle & WS_CHILD) && wndPtr->wIDmenu)
|
|
||||||
{
|
|
||||||
lppop = MENU_GetMenu((HMENU16)wndPtr->wIDmenu);
|
|
||||||
if (lppop == NULL)
|
|
||||||
{
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
lppop->Height = 0; /* Make sure we call MENU_MenuBarCalcSize */
|
if (GetWindowLongA( hWnd, GWL_STYLE ) & WS_CHILD) return FALSE;
|
||||||
lppop->hwndOwner = hWnd;
|
if (!hMenu || !(lppop = MENU_GetMenu( hMenu ))) return FALSE;
|
||||||
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
|
|
||||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
|
lppop->Height = 0; /* Make sure we call MENU_MenuBarCalcSize */
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
lppop->hwndOwner = hWnd;
|
||||||
return TRUE;
|
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
|
||||||
}
|
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
return TRUE;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -4967,11 +4901,9 @@ static BOOL translate_accelerator( HWND hWnd, UINT message, WPARAM wParam, LPARA
|
||||||
{
|
{
|
||||||
HMENU hMenu, hSubMenu, hSysMenu;
|
HMENU hMenu, hSubMenu, hSysMenu;
|
||||||
UINT uSysStat = (UINT)-1, uStat = (UINT)-1, nPos;
|
UINT uSysStat = (UINT)-1, uStat = (UINT)-1, nPos;
|
||||||
WND* wndPtr = WIN_FindWndPtr(hWnd);
|
|
||||||
|
|
||||||
hMenu = (wndPtr->dwStyle & WS_CHILD) ? 0 : (HMENU)wndPtr->wIDmenu;
|
hMenu = (GetWindowLongA( hWnd, GWL_STYLE ) & WS_CHILD) ? 0 : GetMenu(hWnd);
|
||||||
hSysMenu = wndPtr->hSysMenu;
|
hSysMenu = get_win_sys_menu( hWnd );
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
|
|
||||||
/* find menu item and ask application to initialize it */
|
/* find menu item and ask application to initialize it */
|
||||||
/* 1. in the system menu */
|
/* 1. in the system menu */
|
||||||
|
|
|
@ -144,11 +144,12 @@ static void SCROLL_LoadBitmaps(void)
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SCROLL_GetPtrScrollInfo
|
* SCROLL_GetScrollInfo
|
||||||
*/
|
*/
|
||||||
static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( WND* wndPtr, INT nBar )
|
static SCROLLBAR_INFO *SCROLL_GetScrollInfo( HWND hwnd, INT nBar )
|
||||||
{
|
{
|
||||||
SCROLLBAR_INFO *infoPtr;
|
SCROLLBAR_INFO *infoPtr;
|
||||||
|
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
|
|
||||||
if (!wndPtr) return NULL;
|
if (!wndPtr) return NULL;
|
||||||
switch(nBar)
|
switch(nBar)
|
||||||
|
@ -156,7 +157,9 @@ static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( WND* wndPtr, INT nBar )
|
||||||
case SB_HORZ: infoPtr = (SCROLLBAR_INFO *)wndPtr->pHScroll; break;
|
case SB_HORZ: infoPtr = (SCROLLBAR_INFO *)wndPtr->pHScroll; break;
|
||||||
case SB_VERT: infoPtr = (SCROLLBAR_INFO *)wndPtr->pVScroll; break;
|
case SB_VERT: infoPtr = (SCROLLBAR_INFO *)wndPtr->pVScroll; break;
|
||||||
case SB_CTL: infoPtr = (SCROLLBAR_INFO *)wndPtr->wExtra; break;
|
case SB_CTL: infoPtr = (SCROLLBAR_INFO *)wndPtr->wExtra; break;
|
||||||
default: return NULL;
|
default:
|
||||||
|
WIN_ReleaseWndPtr( wndPtr );
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!infoPtr) /* Create the info structure if needed */
|
if (!infoPtr) /* Create the info structure if needed */
|
||||||
|
@ -171,23 +174,11 @@ static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( WND* wndPtr, INT nBar )
|
||||||
}
|
}
|
||||||
if (!hUpArrow) SCROLL_LoadBitmaps();
|
if (!hUpArrow) SCROLL_LoadBitmaps();
|
||||||
}
|
}
|
||||||
|
WIN_ReleaseWndPtr( wndPtr );
|
||||||
return infoPtr;
|
return infoPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* SCROLL_GetScrollInfo
|
|
||||||
*/
|
|
||||||
static SCROLLBAR_INFO *SCROLL_GetScrollInfo( HWND hwnd, INT nBar )
|
|
||||||
{
|
|
||||||
SCROLLBAR_INFO *retvalue;
|
|
||||||
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
|
||||||
retvalue = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return retvalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SCROLL_GetScrollBarRect
|
* SCROLL_GetScrollBarRect
|
||||||
*
|
*
|
||||||
|
@ -258,7 +249,7 @@ static BOOL SCROLL_GetScrollBarRect( HWND hwnd, INT nBar, RECT *lprect,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SCROLLBAR_INFO *info = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
|
SCROLLBAR_INFO *info = SCROLL_GetScrollInfo( hwnd, nBar );
|
||||||
|
|
||||||
*arrowSize = GetSystemMetrics(SM_CXVSCROLL);
|
*arrowSize = GetSystemMetrics(SM_CXVSCROLL);
|
||||||
pixels -= (2 * (GetSystemMetrics(SM_CXVSCROLL) - SCROLL_ARROW_THUMB_OVERLAP));
|
pixels -= (2 * (GetSystemMetrics(SM_CXVSCROLL) - SCROLL_ARROW_THUMB_OVERLAP));
|
||||||
|
@ -793,7 +784,7 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar,
|
||||||
RECT rect;
|
RECT rect;
|
||||||
BOOL vertical;
|
BOOL vertical;
|
||||||
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
SCROLLBAR_INFO *infoPtr = SCROLL_GetPtrScrollInfo( wndPtr, nBar );
|
SCROLLBAR_INFO *infoPtr = SCROLL_GetScrollInfo( hwnd, nBar );
|
||||||
BOOL Save_SCROLL_MovingThumb = SCROLL_MovingThumb;
|
BOOL Save_SCROLL_MovingThumb = SCROLL_MovingThumb;
|
||||||
|
|
||||||
if (!wndPtr || !infoPtr ||
|
if (!wndPtr || !infoPtr ||
|
||||||
|
@ -877,9 +868,8 @@ static void SCROLL_RefreshScrollBar( HWND hwnd, INT nBar,
|
||||||
*/
|
*/
|
||||||
static void SCROLL_HandleKbdEvent( HWND hwnd, WPARAM wParam )
|
static void SCROLL_HandleKbdEvent( HWND hwnd, WPARAM wParam )
|
||||||
{
|
{
|
||||||
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
|
||||||
WPARAM msg;
|
WPARAM msg;
|
||||||
|
|
||||||
switch(wParam)
|
switch(wParam)
|
||||||
{
|
{
|
||||||
case VK_PRIOR: msg = SB_PAGEUP; break;
|
case VK_PRIOR: msg = SB_PAGEUP; break;
|
||||||
|
@ -888,14 +878,11 @@ static void SCROLL_HandleKbdEvent( HWND hwnd, WPARAM wParam )
|
||||||
case VK_END: msg = SB_BOTTOM; break;
|
case VK_END: msg = SB_BOTTOM; break;
|
||||||
case VK_UP: msg = SB_LINEUP; break;
|
case VK_UP: msg = SB_LINEUP; break;
|
||||||
case VK_DOWN: msg = SB_LINEDOWN; break;
|
case VK_DOWN: msg = SB_LINEDOWN; break;
|
||||||
default:
|
default: return;
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
SendMessageW( GetParent(hwnd),
|
SendMessageW( GetParent(hwnd),
|
||||||
(wndPtr->dwStyle & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL,
|
(GetWindowLongA( hwnd, GWL_STYLE ) & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL,
|
||||||
msg, hwnd );
|
msg, hwnd );
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1651,30 +1638,33 @@ BOOL bRedraw /* [in] Should scrollbar be redrawn afterwards ? */)
|
||||||
*
|
*
|
||||||
* Updates both scrollbars at the same time. Used by MDI CalcChildScroll().
|
* Updates both scrollbars at the same time. Used by MDI CalcChildScroll().
|
||||||
*/
|
*/
|
||||||
INT SCROLL_SetNCSbState(WND* wndPtr, int vMin, int vMax, int vPos,
|
INT SCROLL_SetNCSbState(HWND hwnd, int vMin, int vMax, int vPos,
|
||||||
int hMin, int hMax, int hPos)
|
int hMin, int hMax, int hPos)
|
||||||
{
|
{
|
||||||
INT vA, hA;
|
INT vA, hA;
|
||||||
SCROLLINFO vInfo, hInfo;
|
SCROLLINFO vInfo, hInfo;
|
||||||
|
|
||||||
vInfo.cbSize = hInfo.cbSize = sizeof(SCROLLINFO);
|
vInfo.cbSize = hInfo.cbSize = sizeof(SCROLLINFO);
|
||||||
vInfo.nMin = vMin; hInfo.nMin = hMin;
|
vInfo.nMin = vMin;
|
||||||
vInfo.nMax = vMax; hInfo.nMax = hMax;
|
vInfo.nMax = vMax;
|
||||||
vInfo.nPos = vPos; hInfo.nPos = hPos;
|
vInfo.nPos = vPos;
|
||||||
|
hInfo.nMin = hMin;
|
||||||
|
hInfo.nMax = hMax;
|
||||||
|
hInfo.nPos = hPos;
|
||||||
vInfo.fMask = hInfo.fMask = SIF_RANGE | SIF_POS;
|
vInfo.fMask = hInfo.fMask = SIF_RANGE | SIF_POS;
|
||||||
|
|
||||||
SCROLL_SetScrollInfo( wndPtr->hwndSelf, SB_VERT, &vInfo, &vA );
|
SCROLL_SetScrollInfo( hwnd, SB_VERT, &vInfo, &vA );
|
||||||
SCROLL_SetScrollInfo( wndPtr->hwndSelf, SB_HORZ, &hInfo, &hA );
|
SCROLL_SetScrollInfo( hwnd, SB_HORZ, &hInfo, &hA );
|
||||||
|
|
||||||
if( !SCROLL_ShowScrollBar( wndPtr->hwndSelf, SB_BOTH,
|
if( !SCROLL_ShowScrollBar( hwnd, SB_BOTH,
|
||||||
(hA & SA_SSI_SHOW),(vA & SA_SSI_SHOW) ) )
|
(hA & SA_SSI_SHOW),(vA & SA_SSI_SHOW) ) )
|
||||||
{
|
{
|
||||||
/* SetWindowPos() wasn't called, just redraw the scrollbars if needed */
|
/* SetWindowPos() wasn't called, just redraw the scrollbars if needed */
|
||||||
if( vA & SA_SSI_REFRESH )
|
if( vA & SA_SSI_REFRESH )
|
||||||
SCROLL_RefreshScrollBar( wndPtr->hwndSelf, SB_VERT, FALSE, TRUE );
|
SCROLL_RefreshScrollBar( hwnd, SB_VERT, FALSE, TRUE );
|
||||||
|
|
||||||
if( hA & SA_SSI_REFRESH )
|
if( hA & SA_SSI_REFRESH )
|
||||||
SCROLL_RefreshScrollBar( wndPtr->hwndSelf, SB_HORZ, FALSE, TRUE );
|
SCROLL_RefreshScrollBar( hwnd, SB_HORZ, FALSE, TRUE );
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
#include "wine/winuser16.h"
|
#include "wine/winuser16.h"
|
||||||
#include "win.h"
|
|
||||||
#include "cursoricon.h"
|
#include "cursoricon.h"
|
||||||
#include "controls.h"
|
#include "controls.h"
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
|
@ -16,25 +15,23 @@
|
||||||
|
|
||||||
DEFAULT_DEBUG_CHANNEL(static);
|
DEFAULT_DEBUG_CHANNEL(static);
|
||||||
|
|
||||||
static void STATIC_PaintOwnerDrawfn( WND *wndPtr, HDC hdc );
|
static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style );
|
||||||
static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc );
|
static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style );
|
||||||
static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc );
|
static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style );
|
||||||
static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc );
|
static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style );
|
||||||
static void STATIC_PaintBitmapfn( WND *wndPtr, HDC hdc );
|
static void STATIC_PaintBitmapfn( HWND hwnd, HDC hdc, DWORD style );
|
||||||
static void STATIC_PaintEtchedfn( WND *wndPtr, HDC hdc );
|
static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style );
|
||||||
static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
||||||
static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
||||||
|
|
||||||
static COLORREF color_windowframe, color_background, color_window;
|
static COLORREF color_windowframe, color_background, color_window;
|
||||||
|
|
||||||
typedef struct
|
/* offsets for GetWindowLong for static private information */
|
||||||
{
|
#define HFONT_GWL_OFFSET 0
|
||||||
HFONT16 hFont; /* Control font (or 0 for system font) */
|
#define HICON_GWL_OFFSET (sizeof(HFONT))
|
||||||
WORD dummy; /* Don't know what MS-Windows puts in there */
|
#define STATIC_EXTRA_BYTES (HICON_GWL_OFFSET + sizeof(HICON))
|
||||||
HICON16 hIcon; /* Icon handle for SS_ICON controls */
|
|
||||||
} STATICINFO;
|
|
||||||
|
|
||||||
typedef void (*pfPaint)( WND *, HDC );
|
typedef void (*pfPaint)( HWND hwnd, HDC hdc, DWORD style );
|
||||||
|
|
||||||
static pfPaint staticPaintFunc[SS_TYPEMASK+1] =
|
static pfPaint staticPaintFunc[SS_TYPEMASK+1] =
|
||||||
{
|
{
|
||||||
|
@ -69,7 +66,7 @@ const struct builtin_class_descr STATIC_builtin_class =
|
||||||
CS_GLOBALCLASS | CS_DBLCLKS | CS_PARENTDC, /* style */
|
CS_GLOBALCLASS | CS_DBLCLKS | CS_PARENTDC, /* style */
|
||||||
StaticWndProcA, /* procA */
|
StaticWndProcA, /* procA */
|
||||||
StaticWndProcW, /* procW */
|
StaticWndProcW, /* procW */
|
||||||
sizeof(STATICINFO), /* extra */
|
STATIC_EXTRA_BYTES, /* extra */
|
||||||
IDC_ARROWA, /* cursor */
|
IDC_ARROWA, /* cursor */
|
||||||
0 /* brush */
|
0 /* brush */
|
||||||
};
|
};
|
||||||
|
@ -80,22 +77,20 @@ const struct builtin_class_descr STATIC_builtin_class =
|
||||||
*
|
*
|
||||||
* Set the icon for an SS_ICON control.
|
* Set the icon for an SS_ICON control.
|
||||||
*/
|
*/
|
||||||
static HICON16 STATIC_SetIcon( WND *wndPtr, HICON16 hicon )
|
static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style )
|
||||||
{
|
{
|
||||||
HICON16 prevIcon;
|
HICON prevIcon;
|
||||||
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
|
|
||||||
CURSORICONINFO *info = hicon?(CURSORICONINFO *) GlobalLock16( hicon ):NULL;
|
CURSORICONINFO *info = hicon?(CURSORICONINFO *) GlobalLock16( hicon ):NULL;
|
||||||
|
|
||||||
if ((wndPtr->dwStyle & SS_TYPEMASK) != SS_ICON) return 0;
|
if ((style & SS_TYPEMASK) != SS_ICON) return 0;
|
||||||
if (hicon && !info) {
|
if (hicon && !info) {
|
||||||
ERR("huh? hicon!=0, but info=0???\n");
|
ERR("huh? hicon!=0, but info=0???\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
prevIcon = infoPtr->hIcon;
|
prevIcon = SetWindowLongA( hwnd, HICON_GWL_OFFSET, hicon );
|
||||||
infoPtr->hIcon = hicon;
|
|
||||||
if (hicon)
|
if (hicon)
|
||||||
{
|
{
|
||||||
SetWindowPos( wndPtr->hwndSelf, 0, 0, 0, info->nWidth, info->nHeight,
|
SetWindowPos( hwnd, 0, 0, 0, info->nWidth, info->nHeight,
|
||||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
|
||||||
GlobalUnlock16( hicon );
|
GlobalUnlock16( hicon );
|
||||||
}
|
}
|
||||||
|
@ -107,23 +102,21 @@ static HICON16 STATIC_SetIcon( WND *wndPtr, HICON16 hicon )
|
||||||
*
|
*
|
||||||
* Set the bitmap for an SS_BITMAP control.
|
* Set the bitmap for an SS_BITMAP control.
|
||||||
*/
|
*/
|
||||||
static HBITMAP16 STATIC_SetBitmap( WND *wndPtr, HBITMAP16 hBitmap )
|
static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hBitmap, DWORD style )
|
||||||
{
|
{
|
||||||
HBITMAP16 hOldBitmap;
|
HBITMAP hOldBitmap;
|
||||||
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
|
|
||||||
|
|
||||||
if ((wndPtr->dwStyle & SS_TYPEMASK) != SS_BITMAP) return 0;
|
if ((style & SS_TYPEMASK) != SS_BITMAP) return 0;
|
||||||
if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP) {
|
if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP) {
|
||||||
ERR("huh? hBitmap!=0, but not bitmap\n");
|
ERR("huh? hBitmap!=0, but not bitmap\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
hOldBitmap = infoPtr->hIcon;
|
hOldBitmap = SetWindowLongA( hwnd, HICON_GWL_OFFSET, hBitmap );
|
||||||
infoPtr->hIcon = hBitmap;
|
|
||||||
if (hBitmap)
|
if (hBitmap)
|
||||||
{
|
{
|
||||||
BITMAP bm;
|
BITMAP bm;
|
||||||
GetObjectW(hBitmap, sizeof(bm), &bm);
|
GetObjectW(hBitmap, sizeof(bm), &bm);
|
||||||
SetWindowPos( wndPtr->hwndSelf, 0, 0, 0, bm.bmWidth, bm.bmHeight,
|
SetWindowPos( hwnd, 0, 0, 0, bm.bmWidth, bm.bmHeight,
|
||||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
|
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
|
||||||
}
|
}
|
||||||
return hOldBitmap;
|
return hOldBitmap;
|
||||||
|
@ -134,9 +127,10 @@ static HBITMAP16 STATIC_SetBitmap( WND *wndPtr, HBITMAP16 hBitmap )
|
||||||
*
|
*
|
||||||
* Load the icon for an SS_ICON control.
|
* Load the icon for an SS_ICON control.
|
||||||
*/
|
*/
|
||||||
static HICON STATIC_LoadIconA( WND *wndPtr, LPCSTR name )
|
static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name )
|
||||||
{
|
{
|
||||||
HICON hicon = LoadIconA( wndPtr->hInstance, name );
|
HINSTANCE hInstance = GetWindowLongA( hwnd, GWL_HINSTANCE );
|
||||||
|
HICON hicon = LoadIconA( hInstance, name );
|
||||||
if (!hicon) hicon = LoadIconA( 0, name );
|
if (!hicon) hicon = LoadIconA( 0, name );
|
||||||
return hicon;
|
return hicon;
|
||||||
}
|
}
|
||||||
|
@ -146,9 +140,10 @@ static HICON STATIC_LoadIconA( WND *wndPtr, LPCSTR name )
|
||||||
*
|
*
|
||||||
* Load the icon for an SS_ICON control.
|
* Load the icon for an SS_ICON control.
|
||||||
*/
|
*/
|
||||||
static HICON STATIC_LoadIconW( WND *wndPtr, LPCWSTR name )
|
static HICON STATIC_LoadIconW( HWND hwnd, LPCWSTR name )
|
||||||
{
|
{
|
||||||
HICON hicon = LoadIconW( wndPtr->hInstance, name );
|
HINSTANCE hInstance = GetWindowLongA( hwnd, GWL_HINSTANCE );
|
||||||
|
HICON hicon = LoadIconW( hInstance, name );
|
||||||
if (!hicon) hicon = LoadIconW( 0, name );
|
if (!hicon) hicon = LoadIconW( 0, name );
|
||||||
return hicon;
|
return hicon;
|
||||||
}
|
}
|
||||||
|
@ -158,9 +153,10 @@ static HICON STATIC_LoadIconW( WND *wndPtr, LPCWSTR name )
|
||||||
*
|
*
|
||||||
* Load the bitmap for an SS_BITMAP control.
|
* Load the bitmap for an SS_BITMAP control.
|
||||||
*/
|
*/
|
||||||
static HBITMAP STATIC_LoadBitmapA( WND *wndPtr, LPCSTR name )
|
static HBITMAP STATIC_LoadBitmapA( HWND hwnd, LPCSTR name )
|
||||||
{
|
{
|
||||||
HBITMAP hbitmap = LoadBitmapA( wndPtr->hInstance, name );
|
HINSTANCE hInstance = GetWindowLongA( hwnd, GWL_HINSTANCE );
|
||||||
|
HBITMAP hbitmap = LoadBitmapA( hInstance, name );
|
||||||
if (!hbitmap) /* Try OEM icon (FIXME: is this right?) */
|
if (!hbitmap) /* Try OEM icon (FIXME: is this right?) */
|
||||||
hbitmap = LoadBitmapA( 0, name );
|
hbitmap = LoadBitmapA( 0, name );
|
||||||
return hbitmap;
|
return hbitmap;
|
||||||
|
@ -171,23 +167,24 @@ static HBITMAP STATIC_LoadBitmapA( WND *wndPtr, LPCSTR name )
|
||||||
*
|
*
|
||||||
* Load the bitmap for an SS_BITMAP control.
|
* Load the bitmap for an SS_BITMAP control.
|
||||||
*/
|
*/
|
||||||
static HBITMAP STATIC_LoadBitmapW( WND *wndPtr, LPCWSTR name )
|
static HBITMAP STATIC_LoadBitmapW( HWND hwnd, LPCWSTR name )
|
||||||
{
|
{
|
||||||
HBITMAP hbitmap = LoadBitmapW( wndPtr->hInstance, name );
|
HINSTANCE hInstance = GetWindowLongA( hwnd, GWL_HINSTANCE );
|
||||||
|
HBITMAP hbitmap = LoadBitmapW( hInstance, name );
|
||||||
if (!hbitmap) /* Try OEM icon (FIXME: is this right?) */
|
if (!hbitmap) /* Try OEM icon (FIXME: is this right?) */
|
||||||
hbitmap = LoadBitmapW( 0, name );
|
hbitmap = LoadBitmapW( 0, name );
|
||||||
return hbitmap;
|
return hbitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* StaticWndProc_locked
|
* StaticWndProc_common
|
||||||
*/
|
*/
|
||||||
static LRESULT StaticWndProc_locked( WND *wndPtr, UINT uMsg, WPARAM wParam,
|
static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
LPARAM lParam, BOOL unicode )
|
LPARAM lParam, BOOL unicode )
|
||||||
{
|
{
|
||||||
LRESULT lResult = 0;
|
LRESULT lResult = 0;
|
||||||
LONG style = wndPtr->dwStyle & SS_TYPEMASK;
|
LONG full_style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||||
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
|
LONG style = full_style & SS_TYPEMASK;
|
||||||
|
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
|
@ -195,8 +192,7 @@ static LRESULT StaticWndProc_locked( WND *wndPtr, UINT uMsg, WPARAM wParam,
|
||||||
if (style < 0L || style > SS_TYPEMASK)
|
if (style < 0L || style > SS_TYPEMASK)
|
||||||
{
|
{
|
||||||
ERR("Unknown style 0x%02lx\n", style );
|
ERR("Unknown style 0x%02lx\n", style );
|
||||||
lResult = -1L;
|
return -1;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
/* initialise colours */
|
/* initialise colours */
|
||||||
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
|
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
|
||||||
|
@ -214,36 +210,36 @@ static LRESULT StaticWndProc_locked( WND *wndPtr, UINT uMsg, WPARAM wParam,
|
||||||
* had already been loaded by the application the last thing we want to do is
|
* had already been loaded by the application the last thing we want to do is
|
||||||
* GlobalFree16 the handle.
|
* GlobalFree16 the handle.
|
||||||
*/
|
*/
|
||||||
} else {
|
break;
|
||||||
lResult = unicode ? DefWindowProcW(wndPtr->hwndSelf, uMsg, wParam, lParam) :
|
}
|
||||||
DefWindowProcA(wndPtr->hwndSelf, uMsg, wParam, lParam);
|
else return unicode ? DefWindowProcW(hwnd, uMsg, wParam, lParam) :
|
||||||
}
|
DefWindowProcA(hwnd, uMsg, wParam, lParam);
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
{
|
{
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
BeginPaint(wndPtr->hwndSelf, &ps);
|
BeginPaint(hwnd, &ps);
|
||||||
if (staticPaintFunc[style])
|
if (staticPaintFunc[style])
|
||||||
(staticPaintFunc[style])( wndPtr, ps.hdc );
|
(staticPaintFunc[style])( hwnd, ps.hdc, full_style );
|
||||||
EndPaint(wndPtr->hwndSelf, &ps);
|
EndPaint(hwnd, &ps);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_ENABLE:
|
case WM_ENABLE:
|
||||||
InvalidateRect(wndPtr->hwndSelf, NULL, FALSE);
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SYSCOLORCHANGE:
|
case WM_SYSCOLORCHANGE:
|
||||||
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
|
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
|
||||||
color_background = GetSysColor(COLOR_BACKGROUND);
|
color_background = GetSysColor(COLOR_BACKGROUND);
|
||||||
color_window = GetSysColor(COLOR_WINDOW);
|
color_window = GetSysColor(COLOR_WINDOW);
|
||||||
InvalidateRect(wndPtr->hwndSelf, NULL, TRUE);
|
InvalidateRect(hwnd, NULL, TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_NCCREATE:
|
case WM_NCCREATE:
|
||||||
if ((TWEAK_WineLook > WIN31_LOOK) && (wndPtr->dwStyle & SS_SUNKEN))
|
if ((TWEAK_WineLook > WIN31_LOOK) && (full_style & SS_SUNKEN))
|
||||||
wndPtr->dwExStyle |= WS_EX_STATICEDGE;
|
SetWindowLongA( hwnd, GWL_EXSTYLE,
|
||||||
|
GetWindowLongA( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE );
|
||||||
|
|
||||||
if(unicode)
|
if(unicode)
|
||||||
lParam = (LPARAM)(((LPCREATESTRUCTW)lParam)->lpszName);
|
lParam = (LPARAM)(((LPCREATESTRUCTW)lParam)->lpszName);
|
||||||
|
@ -255,98 +251,81 @@ static LRESULT StaticWndProc_locked( WND *wndPtr, UINT uMsg, WPARAM wParam,
|
||||||
{
|
{
|
||||||
HICON hIcon;
|
HICON hIcon;
|
||||||
if(unicode)
|
if(unicode)
|
||||||
hIcon = STATIC_LoadIconW(wndPtr, (LPCWSTR)lParam);
|
hIcon = STATIC_LoadIconW(hwnd, (LPCWSTR)lParam);
|
||||||
else
|
else
|
||||||
hIcon = STATIC_LoadIconA(wndPtr, (LPCSTR)lParam);
|
hIcon = STATIC_LoadIconA(hwnd, (LPCSTR)lParam);
|
||||||
/* FIXME : should we also return the previous hIcon here ??? */
|
/* FIXME : should we also return the previous hIcon here ??? */
|
||||||
STATIC_SetIcon(wndPtr, hIcon);
|
STATIC_SetIcon(hwnd, hIcon, style);
|
||||||
}
|
}
|
||||||
else if (style == SS_BITMAP)
|
else if (style == SS_BITMAP)
|
||||||
{
|
{
|
||||||
HBITMAP hBitmap;
|
HBITMAP hBitmap;
|
||||||
if(unicode)
|
if(unicode)
|
||||||
hBitmap = STATIC_LoadBitmapW(wndPtr, (LPCWSTR)lParam);
|
hBitmap = STATIC_LoadBitmapW(hwnd, (LPCWSTR)lParam);
|
||||||
else
|
else
|
||||||
hBitmap = STATIC_LoadBitmapA(wndPtr, (LPCSTR)lParam);
|
hBitmap = STATIC_LoadBitmapA(hwnd, (LPCSTR)lParam);
|
||||||
STATIC_SetBitmap(wndPtr, hBitmap);
|
STATIC_SetBitmap(hwnd, hBitmap, style);
|
||||||
}
|
}
|
||||||
else if(lParam && HIWORD(lParam))
|
else if (HIWORD(lParam))
|
||||||
{
|
{
|
||||||
if(unicode)
|
if(unicode)
|
||||||
DEFWND_SetTextW(wndPtr, (LPCWSTR)lParam);
|
lResult = DefWindowProcW( hwnd, WM_SETTEXT, wParam, lParam );
|
||||||
else
|
else
|
||||||
DEFWND_SetTextA(wndPtr, (LPCSTR)lParam);
|
lResult = DefWindowProcA( hwnd, WM_SETTEXT, wParam, lParam );
|
||||||
}
|
}
|
||||||
if(uMsg == WM_SETTEXT)
|
if(uMsg == WM_SETTEXT)
|
||||||
InvalidateRect(wndPtr->hwndSelf, NULL, FALSE);
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
lResult = 1; /* success. FIXME: check text length */
|
return 1; /* success. FIXME: check text length */
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_SETFONT:
|
case WM_SETFONT:
|
||||||
if (style == SS_ICON)
|
if ((style == SS_ICON) || (style == SS_BITMAP)) return 0;
|
||||||
{
|
SetWindowLongA( hwnd, HFONT_GWL_OFFSET, wParam );
|
||||||
lResult = 0;
|
|
||||||
goto END;
|
|
||||||
}
|
|
||||||
if (style == SS_BITMAP)
|
|
||||||
{
|
|
||||||
lResult = 0;
|
|
||||||
goto END;
|
|
||||||
}
|
|
||||||
infoPtr->hFont = (HFONT16)wParam;
|
|
||||||
if (LOWORD(lParam))
|
if (LOWORD(lParam))
|
||||||
InvalidateRect( wndPtr->hwndSelf, NULL, FALSE );
|
InvalidateRect( hwnd, NULL, FALSE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_GETFONT:
|
case WM_GETFONT:
|
||||||
lResult = infoPtr->hFont;
|
return GetWindowLongA( hwnd, HFONT_GWL_OFFSET );
|
||||||
goto END;
|
|
||||||
|
|
||||||
case WM_NCHITTEST:
|
case WM_NCHITTEST:
|
||||||
if (wndPtr->dwStyle & SS_NOTIFY)
|
if (full_style & SS_NOTIFY)
|
||||||
lResult = HTCLIENT;
|
return HTCLIENT;
|
||||||
else
|
else
|
||||||
lResult = HTTRANSPARENT;
|
return HTTRANSPARENT;
|
||||||
goto END;
|
|
||||||
|
|
||||||
case WM_GETDLGCODE:
|
case WM_GETDLGCODE:
|
||||||
lResult = DLGC_STATIC;
|
return DLGC_STATIC;
|
||||||
goto END;
|
|
||||||
|
|
||||||
case STM_GETIMAGE:
|
case STM_GETIMAGE:
|
||||||
case STM_GETICON16:
|
case STM_GETICON16:
|
||||||
case STM_GETICON:
|
case STM_GETICON:
|
||||||
lResult = infoPtr->hIcon;
|
return GetWindowLongA( hwnd, HICON_GWL_OFFSET );
|
||||||
goto END;
|
|
||||||
|
|
||||||
case STM_SETIMAGE:
|
case STM_SETIMAGE:
|
||||||
switch(wParam) {
|
switch(wParam) {
|
||||||
case IMAGE_BITMAP:
|
case IMAGE_BITMAP:
|
||||||
lResult = STATIC_SetBitmap( wndPtr, (HBITMAP)lParam );
|
lResult = STATIC_SetBitmap( hwnd, (HBITMAP)lParam, style );
|
||||||
break;
|
break;
|
||||||
case IMAGE_ICON:
|
case IMAGE_ICON:
|
||||||
lResult = STATIC_SetIcon( wndPtr, (HICON16)lParam );
|
lResult = STATIC_SetIcon( hwnd, (HICON)lParam, style );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FIXME("STM_SETIMAGE: Unhandled type %x\n", wParam);
|
FIXME("STM_SETIMAGE: Unhandled type %x\n", wParam);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
InvalidateRect( wndPtr->hwndSelf, NULL, FALSE );
|
InvalidateRect( hwnd, NULL, FALSE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STM_SETICON16:
|
case STM_SETICON16:
|
||||||
case STM_SETICON:
|
case STM_SETICON:
|
||||||
lResult = STATIC_SetIcon( wndPtr, (HICON16)wParam );
|
lResult = STATIC_SetIcon( hwnd, (HICON)wParam, style );
|
||||||
InvalidateRect( wndPtr->hwndSelf, NULL, FALSE );
|
InvalidateRect( hwnd, NULL, FALSE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
lResult = unicode ? DefWindowProcW(wndPtr->hwndSelf, uMsg, wParam, lParam) :
|
return unicode ? DefWindowProcW(hwnd, uMsg, wParam, lParam) :
|
||||||
DefWindowProcA(wndPtr->hwndSelf, uMsg, wParam, lParam);
|
DefWindowProcA(hwnd, uMsg, wParam, lParam);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END:
|
|
||||||
return lResult;
|
return lResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,15 +334,8 @@ END:
|
||||||
*/
|
*/
|
||||||
static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
LRESULT lResult = 0;
|
if (!IsWindow( hWnd )) return 0;
|
||||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
return StaticWndProc_common(hWnd, uMsg, wParam, lParam, FALSE);
|
||||||
|
|
||||||
if (wndPtr)
|
|
||||||
{
|
|
||||||
lResult = StaticWndProc_locked(wndPtr, uMsg, wParam, lParam, FALSE);
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
}
|
|
||||||
return lResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -371,47 +343,39 @@ static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
||||||
*/
|
*/
|
||||||
static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
LRESULT lResult = 0;
|
if (!IsWindow( hWnd )) return 0;
|
||||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
return StaticWndProc_common(hWnd, uMsg, wParam, lParam, TRUE);
|
||||||
|
|
||||||
if (wndPtr)
|
|
||||||
{
|
|
||||||
lResult = StaticWndProc_locked(wndPtr, uMsg, wParam, lParam, TRUE);
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
}
|
|
||||||
return lResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void STATIC_PaintOwnerDrawfn( WND *wndPtr, HDC hdc )
|
static void STATIC_PaintOwnerDrawfn( HWND hwnd, HDC hdc, DWORD style )
|
||||||
{
|
{
|
||||||
DRAWITEMSTRUCT dis;
|
DRAWITEMSTRUCT dis;
|
||||||
|
LONG id = GetWindowLongA( hwnd, GWL_ID );
|
||||||
|
|
||||||
dis.CtlType = ODT_STATIC;
|
dis.CtlType = ODT_STATIC;
|
||||||
dis.CtlID = wndPtr->wIDmenu;
|
dis.CtlID = id;
|
||||||
dis.itemID = 0;
|
dis.itemID = 0;
|
||||||
dis.itemAction = ODA_DRAWENTIRE;
|
dis.itemAction = ODA_DRAWENTIRE;
|
||||||
dis.itemState = 0;
|
dis.itemState = 0;
|
||||||
dis.hwndItem = wndPtr->hwndSelf;
|
dis.hwndItem = hwnd;
|
||||||
dis.hDC = hdc;
|
dis.hDC = hdc;
|
||||||
dis.itemData = 0;
|
dis.itemData = 0;
|
||||||
GetClientRect( wndPtr->hwndSelf, &dis.rcItem );
|
GetClientRect( hwnd, &dis.rcItem );
|
||||||
|
|
||||||
SendMessageW( GetParent(wndPtr->hwndSelf), WM_CTLCOLORSTATIC,
|
SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd );
|
||||||
hdc, wndPtr->hwndSelf );
|
SendMessageW( GetParent(hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
|
||||||
SendMessageW( GetParent(wndPtr->hwndSelf), WM_DRAWITEM,
|
|
||||||
wndPtr->wIDmenu, (LPARAM)&dis );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc )
|
static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
HBRUSH hBrush;
|
HBRUSH hBrush;
|
||||||
|
HFONT hFont;
|
||||||
WORD wFormat;
|
WORD wFormat;
|
||||||
|
INT len;
|
||||||
|
WCHAR *text;
|
||||||
|
|
||||||
LONG style = wndPtr->dwStyle;
|
GetClientRect( hwnd, &rc);
|
||||||
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
|
|
||||||
|
|
||||||
GetClientRect( wndPtr->hwndSelf, &rc);
|
|
||||||
|
|
||||||
switch (style & SS_TYPEMASK)
|
switch (style & SS_TYPEMASK)
|
||||||
{
|
{
|
||||||
|
@ -442,31 +406,32 @@ static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc )
|
||||||
if (style & SS_NOPREFIX)
|
if (style & SS_NOPREFIX)
|
||||||
wFormat |= DT_NOPREFIX;
|
wFormat |= DT_NOPREFIX;
|
||||||
|
|
||||||
if (infoPtr->hFont) SelectObject( hdc, infoPtr->hFont );
|
if ((hFont = GetWindowLongA( hwnd, HFONT_GWL_OFFSET ))) SelectObject( hdc, hFont );
|
||||||
|
|
||||||
if ((style & SS_NOPREFIX) || ((style & SS_TYPEMASK) != SS_SIMPLE))
|
if ((style & SS_NOPREFIX) || ((style & SS_TYPEMASK) != SS_SIMPLE))
|
||||||
{
|
{
|
||||||
hBrush = SendMessageW( GetParent(wndPtr->hwndSelf), WM_CTLCOLORSTATIC,
|
hBrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd );
|
||||||
hdc, wndPtr->hwndSelf );
|
|
||||||
if (!hBrush) /* did the app forget to call defwindowproc ? */
|
if (!hBrush) /* did the app forget to call defwindowproc ? */
|
||||||
hBrush = DefWindowProcW(GetParent(wndPtr->hwndSelf), WM_CTLCOLORSTATIC,
|
hBrush = DefWindowProcW(GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd);
|
||||||
hdc, wndPtr->hwndSelf);
|
FillRect( hdc, &rc, hBrush );
|
||||||
FillRect( hdc, &rc, hBrush );
|
|
||||||
}
|
}
|
||||||
if (!IsWindowEnabled(wndPtr->hwndSelf))
|
if (!IsWindowEnabled(hwnd)) SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
|
||||||
SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
|
|
||||||
|
|
||||||
if (wndPtr->text) DrawTextW( hdc, wndPtr->text, -1, &rc, wFormat );
|
if (!(len = SendMessageW( hwnd, WM_GETTEXTLENGTH, 0, 0 ))) return;
|
||||||
|
if (!(text = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) return;
|
||||||
|
SendMessageW( hwnd, WM_GETTEXT, len + 1, (LPARAM)text );
|
||||||
|
DrawTextW( hdc, text, -1, &rc, wFormat );
|
||||||
|
HeapFree( GetProcessHeap(), 0, text );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc )
|
static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style )
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
HBRUSH hBrush;
|
HBRUSH hBrush;
|
||||||
|
|
||||||
GetClientRect( wndPtr->hwndSelf, &rc);
|
GetClientRect( hwnd, &rc);
|
||||||
|
|
||||||
switch (wndPtr->dwStyle & SS_TYPEMASK)
|
switch (style & SS_TYPEMASK)
|
||||||
{
|
{
|
||||||
case SS_BLACKRECT:
|
case SS_BLACKRECT:
|
||||||
hBrush = CreateSolidBrush(color_windowframe);
|
hBrush = CreateSolidBrush(color_windowframe);
|
||||||
|
@ -499,42 +464,41 @@ static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc )
|
static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style )
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
HBRUSH hbrush;
|
HBRUSH hbrush;
|
||||||
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
|
HICON hIcon;
|
||||||
|
|
||||||
GetClientRect( wndPtr->hwndSelf, &rc );
|
GetClientRect( hwnd, &rc );
|
||||||
hbrush = SendMessageW( GetParent(wndPtr->hwndSelf), WM_CTLCOLORSTATIC,
|
hbrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd );
|
||||||
hdc, wndPtr->hwndSelf );
|
|
||||||
FillRect( hdc, &rc, hbrush );
|
FillRect( hdc, &rc, hbrush );
|
||||||
if (infoPtr->hIcon) DrawIcon( hdc, rc.left, rc.top, infoPtr->hIcon );
|
if ((hIcon = GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
|
||||||
|
DrawIcon( hdc, rc.left, rc.top, hIcon );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void STATIC_PaintBitmapfn(WND *wndPtr, HDC hdc )
|
static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, DWORD style )
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
HBRUSH hbrush;
|
HBRUSH hbrush;
|
||||||
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
|
HICON hIcon;
|
||||||
HDC hMemDC;
|
HDC hMemDC;
|
||||||
HBITMAP oldbitmap;
|
HBITMAP oldbitmap;
|
||||||
|
|
||||||
GetClientRect( wndPtr->hwndSelf, &rc );
|
GetClientRect( hwnd, &rc );
|
||||||
hbrush = SendMessageW( GetParent(wndPtr->hwndSelf), WM_CTLCOLORSTATIC,
|
hbrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd );
|
||||||
hdc, wndPtr->hwndSelf );
|
|
||||||
FillRect( hdc, &rc, hbrush );
|
FillRect( hdc, &rc, hbrush );
|
||||||
|
|
||||||
if (infoPtr->hIcon) {
|
if ((hIcon = GetWindowLongA( hwnd, HICON_GWL_OFFSET )))
|
||||||
|
{
|
||||||
BITMAP bm;
|
BITMAP bm;
|
||||||
SIZE sz;
|
SIZE sz;
|
||||||
|
|
||||||
if(GetObjectType(infoPtr->hIcon) != OBJ_BITMAP)
|
if(GetObjectType(hIcon) != OBJ_BITMAP) return;
|
||||||
return;
|
|
||||||
if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
|
if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
|
||||||
GetObjectW(infoPtr->hIcon, sizeof(bm), &bm);
|
GetObjectW(hIcon, sizeof(bm), &bm);
|
||||||
GetBitmapDimensionEx(infoPtr->hIcon, &sz);
|
GetBitmapDimensionEx(hIcon, &sz);
|
||||||
oldbitmap = SelectObject(hMemDC, infoPtr->hIcon);
|
oldbitmap = SelectObject(hMemDC, hIcon);
|
||||||
BitBlt(hdc, sz.cx, sz.cy, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
|
BitBlt(hdc, sz.cx, sz.cy, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0,
|
||||||
SRCCOPY);
|
SRCCOPY);
|
||||||
SelectObject(hMemDC, oldbitmap);
|
SelectObject(hMemDC, oldbitmap);
|
||||||
|
@ -543,15 +507,15 @@ static void STATIC_PaintBitmapfn(WND *wndPtr, HDC hdc )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void STATIC_PaintEtchedfn( WND *wndPtr, HDC hdc )
|
static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style )
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
|
|
||||||
if (TWEAK_WineLook == WIN31_LOOK)
|
if (TWEAK_WineLook == WIN31_LOOK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetClientRect( wndPtr->hwndSelf, &rc );
|
GetClientRect( hwnd, &rc );
|
||||||
switch (wndPtr->dwStyle & SS_TYPEMASK)
|
switch (style & SS_TYPEMASK)
|
||||||
{
|
{
|
||||||
case SS_ETCHEDHORZ:
|
case SS_ETCHEDHORZ:
|
||||||
DrawEdge(hdc,&rc,EDGE_ETCHED,BF_TOP|BF_BOTTOM);
|
DrawEdge(hdc,&rc,EDGE_ETCHED,BF_TOP|BF_BOTTOM);
|
||||||
|
@ -564,4 +528,3 @@ static void STATIC_PaintEtchedfn( WND *wndPtr, HDC hdc )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "winproc.h"
|
#include "winproc.h"
|
||||||
|
|
||||||
struct tagWND;
|
|
||||||
|
|
||||||
/* Built-in class names (see _Undocumented_Windows_ p.418) */
|
/* Built-in class names (see _Undocumented_Windows_ p.418) */
|
||||||
#define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768) /* PopupMenu */
|
#define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768) /* PopupMenu */
|
||||||
#define DESKTOP_CLASS_ATOM MAKEINTATOM(32769) /* Desktop */
|
#define DESKTOP_CLASS_ATOM MAKEINTATOM(32769) /* Desktop */
|
||||||
|
@ -36,7 +34,7 @@ struct builtin_class_descr
|
||||||
extern BOOL DESKTOP_SetPattern( LPCSTR pattern );
|
extern BOOL DESKTOP_SetPattern( LPCSTR pattern );
|
||||||
|
|
||||||
/* icon title */
|
/* icon title */
|
||||||
extern HWND ICONTITLE_Create( struct tagWND * );
|
extern HWND ICONTITLE_Create( HWND hwnd );
|
||||||
|
|
||||||
/* menu controls */
|
/* menu controls */
|
||||||
extern BOOL MENU_Init(void);
|
extern BOOL MENU_Init(void);
|
||||||
|
@ -44,8 +42,8 @@ extern BOOL MENU_IsMenuActive(void);
|
||||||
extern HMENU MENU_GetSysMenu(HWND hWndOwner, HMENU hSysPopup);
|
extern HMENU MENU_GetSysMenu(HWND hWndOwner, HMENU hSysPopup);
|
||||||
extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
|
extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
|
||||||
INT orgX, INT orgY );
|
INT orgX, INT orgY );
|
||||||
extern void MENU_TrackMouseMenuBar( struct tagWND *wnd, INT ht, POINT pt );
|
extern void MENU_TrackMouseMenuBar( HWND hwnd, INT ht, POINT pt );
|
||||||
extern void MENU_TrackKbdMenuBar( struct tagWND *wnd, UINT wParam, INT vkey );
|
extern void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, INT vkey );
|
||||||
extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
|
extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
|
||||||
HWND hwnd, BOOL suppress_draw );
|
HWND hwnd, BOOL suppress_draw );
|
||||||
extern UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget );
|
extern UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget );
|
||||||
|
@ -53,7 +51,7 @@ extern UINT MENU_FindSubMenu( HMENU *hmenu, HMENU hSubTarget );
|
||||||
/* scrollbar */
|
/* scrollbar */
|
||||||
extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, BOOL arrows, BOOL interior );
|
extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, BOOL arrows, BOOL interior );
|
||||||
extern void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt );
|
extern void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt );
|
||||||
extern INT SCROLL_SetNCSbState( struct tagWND *wndPtr, int vMin, int vMax, int vPos,
|
extern INT SCROLL_SetNCSbState( HWND hwnd, int vMin, int vMax, int vPos,
|
||||||
int hMin, int hMax, int hPos );
|
int hMin, int hMax, int hPos );
|
||||||
|
|
||||||
/* combo box */
|
/* combo box */
|
||||||
|
@ -80,7 +78,7 @@ extern INT SCROLL_SetNCSbState( struct tagWND *wndPtr, int vMin, int vMax, int v
|
||||||
/* combo state struct */
|
/* combo state struct */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
struct tagWND *self;
|
HWND self;
|
||||||
HWND owner;
|
HWND owner;
|
||||||
UINT dwStyle;
|
UINT dwStyle;
|
||||||
HWND hWndEdit;
|
HWND hWndEdit;
|
||||||
|
@ -98,10 +96,6 @@ typedef struct
|
||||||
|
|
||||||
/* Note, that CBS_DROPDOWNLIST style is actually (CBS_SIMPLE | CBS_DROPDOWN) */
|
/* Note, that CBS_DROPDOWNLIST style is actually (CBS_SIMPLE | CBS_DROPDOWN) */
|
||||||
#define CB_GETTYPE( lphc ) ((lphc)->dwStyle & (CBS_DROPDOWNLIST))
|
#define CB_GETTYPE( lphc ) ((lphc)->dwStyle & (CBS_DROPDOWNLIST))
|
||||||
#define CB_DISABLED( lphc ) ((lphc)->self->dwStyle & WS_DISABLED)
|
|
||||||
#define CB_OWNERDRAWN( lphc ) ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
|
|
||||||
#define CB_HASSTRINGS( lphc ) ((lphc)->dwStyle & CBS_HASSTRINGS)
|
|
||||||
#define CB_HWND( lphc ) ((lphc)->self->hwndSelf)
|
|
||||||
|
|
||||||
extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL );
|
extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL );
|
||||||
|
|
||||||
|
|
|
@ -953,12 +953,12 @@ UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SW_MAXIMIZE:
|
case SW_MAXIMIZE:
|
||||||
WINPOS_GetMinMaxInfo( wndPtr, &size, &wpl.ptMaxPosition, NULL, NULL );
|
WINPOS_GetMinMaxInfo( hwnd, &size, &wpl.ptMaxPosition, NULL, NULL );
|
||||||
|
|
||||||
if( wndPtr->dwStyle & WS_MINIMIZE )
|
if( wndPtr->dwStyle & WS_MINIMIZE )
|
||||||
{
|
{
|
||||||
wndPtr->dwStyle &= ~WS_MINIMIZE;
|
wndPtr->dwStyle &= ~WS_MINIMIZE;
|
||||||
WINPOS_ShowIconTitle( wndPtr, FALSE );
|
WINPOS_ShowIconTitle( hwnd, FALSE );
|
||||||
X11DRV_set_iconic_state( wndPtr );
|
X11DRV_set_iconic_state( wndPtr );
|
||||||
}
|
}
|
||||||
wndPtr->dwStyle |= WS_MAXIMIZE;
|
wndPtr->dwStyle |= WS_MAXIMIZE;
|
||||||
|
@ -970,13 +970,13 @@ UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
|
||||||
if( wndPtr->dwStyle & WS_MINIMIZE )
|
if( wndPtr->dwStyle & WS_MINIMIZE )
|
||||||
{
|
{
|
||||||
wndPtr->dwStyle &= ~WS_MINIMIZE;
|
wndPtr->dwStyle &= ~WS_MINIMIZE;
|
||||||
WINPOS_ShowIconTitle( wndPtr, FALSE );
|
WINPOS_ShowIconTitle( hwnd, FALSE );
|
||||||
X11DRV_set_iconic_state( wndPtr );
|
X11DRV_set_iconic_state( wndPtr );
|
||||||
|
|
||||||
if( wndPtr->flags & WIN_RESTORE_MAX)
|
if( wndPtr->flags & WIN_RESTORE_MAX)
|
||||||
{
|
{
|
||||||
/* Restore to maximized position */
|
/* Restore to maximized position */
|
||||||
WINPOS_GetMinMaxInfo( wndPtr, &size, &wpl.ptMaxPosition, NULL, NULL);
|
WINPOS_GetMinMaxInfo( hwnd, &size, &wpl.ptMaxPosition, NULL, NULL);
|
||||||
wndPtr->dwStyle |= WS_MAXIMIZE;
|
wndPtr->dwStyle |= WS_MAXIMIZE;
|
||||||
SetRect( rect, wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, size.x, size.y );
|
SetRect( rect, wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, size.x, size.y );
|
||||||
break;
|
break;
|
||||||
|
@ -1103,14 +1103,14 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT cmd )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (hwnd == GetActiveWindow())
|
if (hwnd == GetActiveWindow())
|
||||||
WINPOS_ActivateOtherWindow(wndPtr);
|
WINPOS_ActivateOtherWindow(hwnd);
|
||||||
|
|
||||||
/* Revert focus to parent */
|
/* Revert focus to parent */
|
||||||
if (hwnd == GetFocus() || IsChild(hwnd, GetFocus()))
|
if (hwnd == GetFocus() || IsChild(hwnd, GetFocus()))
|
||||||
SetFocus( GetParent(hwnd) );
|
SetFocus( GetParent(hwnd) );
|
||||||
}
|
}
|
||||||
if (!IsWindow( hwnd )) goto END;
|
if (!IsWindow( hwnd )) goto END;
|
||||||
else if( wndPtr->dwStyle & WS_MINIMIZE ) WINPOS_ShowIconTitle( wndPtr, TRUE );
|
else if( wndPtr->dwStyle & WS_MINIMIZE ) WINPOS_ShowIconTitle( hwnd, TRUE );
|
||||||
|
|
||||||
if (wndPtr->flags & WIN_NEED_SIZE)
|
if (wndPtr->flags & WIN_NEED_SIZE)
|
||||||
{
|
{
|
||||||
|
@ -1704,7 +1704,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
|
||||||
|
|
||||||
/* Get min/max info */
|
/* Get min/max info */
|
||||||
|
|
||||||
WINPOS_GetMinMaxInfo( wndPtr, NULL, NULL, &minTrack, &maxTrack );
|
WINPOS_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack );
|
||||||
sizingRect = wndPtr->rectWindow;
|
sizingRect = wndPtr->rectWindow;
|
||||||
origRect = sizingRect;
|
origRect = sizingRect;
|
||||||
if (wndPtr->dwStyle & WS_CHILD)
|
if (wndPtr->dwStyle & WS_CHILD)
|
||||||
|
@ -1816,7 +1816,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
|
||||||
{
|
{
|
||||||
hOldCursor = SetCursor(hDragCursor);
|
hOldCursor = SetCursor(hDragCursor);
|
||||||
ShowCursor( TRUE );
|
ShowCursor( TRUE );
|
||||||
WINPOS_ShowIconTitle( wndPtr, FALSE );
|
WINPOS_ShowIconTitle( hwnd, FALSE );
|
||||||
}
|
}
|
||||||
else if(!DragFullWindows)
|
else if(!DragFullWindows)
|
||||||
draw_moving_frame( hdc, &sizingRect, thickframe );
|
draw_moving_frame( hdc, &sizingRect, thickframe );
|
||||||
|
@ -1934,7 +1934,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
|
||||||
SendMessageA( hwnd, WM_SYSCOMMAND,
|
SendMessageA( hwnd, WM_SYSCOMMAND,
|
||||||
SC_MOUSEMENU + HTSYSMENU, MAKELONG(pt.x,pt.y));
|
SC_MOUSEMENU + HTSYSMENU, MAKELONG(pt.x,pt.y));
|
||||||
}
|
}
|
||||||
else WINPOS_ShowIconTitle( wndPtr, TRUE );
|
else WINPOS_ShowIconTitle( hwnd, TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
END:
|
END:
|
||||||
|
|
|
@ -9,19 +9,17 @@
|
||||||
|
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
|
|
||||||
struct tagWND;
|
extern LONG NC_HandleNCPaint( HWND hwnd , HRGN clip);
|
||||||
|
extern LONG NC_HandleNCActivate( HWND hwnd, WPARAM wParam );
|
||||||
extern LONG NC_HandleNCPaint( HWND hwnd , HRGN clip);
|
extern LONG NC_HandleNCCalcSize( HWND hwnd, RECT *winRect );
|
||||||
extern LONG NC_HandleNCActivate( struct tagWND *pwnd, WPARAM wParam );
|
extern LONG NC_HandleNCHitTest( HWND hwnd, POINT pt );
|
||||||
extern LONG NC_HandleNCCalcSize( struct tagWND *pWnd, RECT *winRect );
|
extern LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam );
|
||||||
extern LONG NC_HandleNCHitTest( HWND hwnd, POINT pt );
|
extern LONG NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam);
|
||||||
extern LONG NC_HandleNCLButtonDown( struct tagWND* pWnd, WPARAM wParam, LPARAM lParam );
|
extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt );
|
||||||
extern LONG NC_HandleNCLButtonDblClk( struct tagWND *pWnd, WPARAM wParam, LPARAM lParam);
|
extern LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam );
|
||||||
extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt );
|
extern void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down );
|
||||||
extern LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam );
|
|
||||||
extern void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down );
|
|
||||||
extern BOOL NC_DrawSysButton95( HWND hwnd, HDC hdc, BOOL down );
|
extern BOOL NC_DrawSysButton95( HWND hwnd, HDC hdc, BOOL down );
|
||||||
extern BOOL NC_GetSysPopupPos( struct tagWND* wndPtr, RECT* rect );
|
extern void NC_GetSysPopupPos( HWND hwnd, RECT* rect );
|
||||||
extern void NC_GetInsideRect( HWND hwnd, RECT *rect );
|
extern void NC_GetInsideRect( HWND hwnd, RECT *rect );
|
||||||
|
|
||||||
#endif /* __WINE_NONCLIENT_H */
|
#endif /* __WINE_NONCLIENT_H */
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
|
|
||||||
struct tagWND;
|
|
||||||
|
|
||||||
/* undocumented SWP flags - from SDK 3.1 */
|
/* undocumented SWP flags - from SDK 3.1 */
|
||||||
#define SWP_NOCLIENTSIZE 0x0800
|
#define SWP_NOCLIENTSIZE 0x0800
|
||||||
#define SWP_NOCLIENTMOVE 0x1000
|
#define SWP_NOCLIENTMOVE 0x1000
|
||||||
|
@ -24,10 +22,9 @@ struct tagWND;
|
||||||
struct tagWINDOWPOS16;
|
struct tagWINDOWPOS16;
|
||||||
|
|
||||||
extern BOOL WINPOS_RedrawIconTitle( HWND hWnd );
|
extern BOOL WINPOS_RedrawIconTitle( HWND hWnd );
|
||||||
extern BOOL WINPOS_ShowIconTitle( struct tagWND* pWnd, BOOL bShow );
|
extern BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow );
|
||||||
extern void WINPOS_GetMinMaxInfo( struct tagWND* pWnd, POINT *maxSize,
|
extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, POINT *minTrack,
|
||||||
POINT *maxPos, POINT *minTrack,
|
POINT *maxTrack );
|
||||||
POINT *maxTrack );
|
|
||||||
extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse,
|
extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse,
|
||||||
BOOL fChangeFocus );
|
BOOL fChangeFocus );
|
||||||
extern BOOL WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
|
extern BOOL WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
|
||||||
|
@ -35,11 +32,11 @@ extern LONG WINPOS_SendNCCalcSize(HWND hwnd, BOOL calcValidRect,
|
||||||
RECT *newWindowRect, RECT *oldWindowRect,
|
RECT *newWindowRect, RECT *oldWindowRect,
|
||||||
RECT *oldClientRect, WINDOWPOS *winpos,
|
RECT *oldClientRect, WINDOWPOS *winpos,
|
||||||
RECT *newClientRect );
|
RECT *newClientRect );
|
||||||
extern LONG WINPOS_HandleWindowPosChanging16(struct tagWND *wndPtr, struct tagWINDOWPOS16 *winpos);
|
extern LONG WINPOS_HandleWindowPosChanging16(HWND hwnd, struct tagWINDOWPOS16 *winpos);
|
||||||
extern LONG WINPOS_HandleWindowPosChanging(struct tagWND *wndPtr, WINDOWPOS *winpos);
|
extern LONG WINPOS_HandleWindowPosChanging(HWND hwnd, WINDOWPOS *winpos);
|
||||||
extern HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest );
|
extern HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest );
|
||||||
extern void WINPOS_CheckInternalPos( struct tagWND* wndPtr );
|
extern void WINPOS_CheckInternalPos( HWND hwnd );
|
||||||
extern BOOL WINPOS_ActivateOtherWindow(struct tagWND* pWnd);
|
extern BOOL WINPOS_ActivateOtherWindow( HWND hwnd );
|
||||||
extern BOOL WINPOS_CreateInternalPosAtom(void);
|
extern BOOL WINPOS_CreateInternalPosAtom(void);
|
||||||
|
|
||||||
#endif /* __WINE_WINPOS_H */
|
#endif /* __WINE_WINPOS_H */
|
||||||
|
|
|
@ -29,7 +29,6 @@ struct tagCURSORICONINFO;
|
||||||
struct tagDC;
|
struct tagDC;
|
||||||
struct tagDeviceCaps;
|
struct tagDeviceCaps;
|
||||||
struct tagPALETTEOBJ;
|
struct tagPALETTEOBJ;
|
||||||
struct tagWND;
|
|
||||||
struct tagWINDOWPOS;
|
struct tagWINDOWPOS;
|
||||||
struct DIDEVICEOBJECTDATA;
|
struct DIDEVICEOBJECTDATA;
|
||||||
|
|
||||||
|
@ -367,8 +366,6 @@ extern INT16 X11DRV_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
|
||||||
extern BOOL X11DRV_GetDIState(DWORD len, LPVOID ptr);
|
extern BOOL X11DRV_GetDIState(DWORD len, LPVOID ptr);
|
||||||
extern BOOL X11DRV_GetDIData(BYTE *keystate, DWORD dodsize, struct DIDEVICEOBJECTDATA *dod, LPDWORD entries, DWORD flags);
|
extern BOOL X11DRV_GetDIData(BYTE *keystate, DWORD dodsize, struct DIDEVICEOBJECTDATA *dod, LPDWORD entries, DWORD flags);
|
||||||
|
|
||||||
extern void X11DRV_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
|
|
||||||
|
|
||||||
/* X11 mouse driver */
|
/* X11 mouse driver */
|
||||||
|
|
||||||
extern void X11DRV_InitMouse(LPMOUSE_EVENT_PROC);
|
extern void X11DRV_InitMouse(LPMOUSE_EVENT_PROC);
|
||||||
|
|
|
@ -307,11 +307,11 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_NCLBUTTONDOWN:
|
case WM_NCLBUTTONDOWN:
|
||||||
return NC_HandleNCLButtonDown( wndPtr, wParam, lParam );
|
return NC_HandleNCLButtonDown( wndPtr->hwndSelf, wParam, lParam );
|
||||||
|
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
case WM_NCLBUTTONDBLCLK:
|
case WM_NCLBUTTONDBLCLK:
|
||||||
return NC_HandleNCLButtonDblClk( wndPtr, wParam, lParam );
|
return NC_HandleNCLButtonDblClk( wndPtr->hwndSelf, wParam, lParam );
|
||||||
|
|
||||||
case WM_NCRBUTTONDOWN:
|
case WM_NCRBUTTONDOWN:
|
||||||
/* in Windows, capture is taken when right-clicking on the caption bar */
|
/* in Windows, capture is taken when right-clicking on the caption bar */
|
||||||
|
@ -376,7 +376,7 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_NCACTIVATE:
|
case WM_NCACTIVATE:
|
||||||
return NC_HandleNCActivate( wndPtr, wParam );
|
return NC_HandleNCActivate( wndPtr->hwndSelf, wParam );
|
||||||
|
|
||||||
case WM_NCDESTROY:
|
case WM_NCDESTROY:
|
||||||
if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text );
|
if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text );
|
||||||
|
@ -674,13 +674,13 @@ LRESULT WINAPI DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
|
||||||
{
|
{
|
||||||
RECT rect32;
|
RECT rect32;
|
||||||
CONV_RECT16TO32( MapSL(lParam), &rect32 );
|
CONV_RECT16TO32( MapSL(lParam), &rect32 );
|
||||||
result = NC_HandleNCCalcSize( wndPtr, &rect32 );
|
result = NC_HandleNCCalcSize( hwnd, &rect32 );
|
||||||
CONV_RECT32TO16( &rect32, MapSL(lParam) );
|
CONV_RECT32TO16( &rect32, MapSL(lParam) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_WINDOWPOSCHANGING:
|
case WM_WINDOWPOSCHANGING:
|
||||||
result = WINPOS_HandleWindowPosChanging16( wndPtr, MapSL(lParam) );
|
result = WINPOS_HandleWindowPosChanging16( hwnd, MapSL(lParam) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_WINDOWPOSCHANGED:
|
case WM_WINDOWPOSCHANGED:
|
||||||
|
@ -751,12 +751,11 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_NCCALCSIZE:
|
case WM_NCCALCSIZE:
|
||||||
result = NC_HandleNCCalcSize( wndPtr, (RECT *)lParam );
|
result = NC_HandleNCCalcSize( hwnd, (RECT *)lParam );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_WINDOWPOSCHANGING:
|
case WM_WINDOWPOSCHANGING:
|
||||||
result = WINPOS_HandleWindowPosChanging( wndPtr,
|
result = WINPOS_HandleWindowPosChanging( hwnd, (WINDOWPOS *)lParam );
|
||||||
(WINDOWPOS *)lParam );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_WINDOWPOSCHANGED:
|
case WM_WINDOWPOSCHANGED:
|
||||||
|
@ -875,12 +874,11 @@ LRESULT WINAPI DefWindowProcW(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_NCCALCSIZE:
|
case WM_NCCALCSIZE:
|
||||||
result = NC_HandleNCCalcSize( wndPtr, (RECT *)lParam );
|
result = NC_HandleNCCalcSize( hwnd, (RECT *)lParam );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_WINDOWPOSCHANGING:
|
case WM_WINDOWPOSCHANGING:
|
||||||
result = WINPOS_HandleWindowPosChanging( wndPtr,
|
result = WINPOS_HandleWindowPosChanging( hwnd, (WINDOWPOS *)lParam );
|
||||||
(WINDOWPOS *)lParam );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_WINDOWPOSCHANGED:
|
case WM_WINDOWPOSCHANGED:
|
||||||
|
|
|
@ -1309,7 +1309,7 @@ static LRESULT WINAPI MDIClientWndProc_locked( WND *wndPtr, UINT message,
|
||||||
AppendMenuW( ci->hWindowMenu, MF_SEPARATOR, 0, NULL );
|
AppendMenuW( ci->hWindowMenu, MF_SEPARATOR, 0, NULL );
|
||||||
|
|
||||||
GetClientRect(frameWnd->hwndSelf, &rect);
|
GetClientRect(frameWnd->hwndSelf, &rect);
|
||||||
NC_HandleNCCalcSize( wndPtr, &rect );
|
NC_HandleNCCalcSize( wndPtr->hwndSelf, &rect );
|
||||||
wndPtr->rectClient = rect;
|
wndPtr->rectClient = rect;
|
||||||
|
|
||||||
TRACE("Client created - hwnd = %04x, idFirst = %u\n",
|
TRACE("Client created - hwnd = %04x, idFirst = %u\n",
|
||||||
|
@ -2270,8 +2270,8 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
|
||||||
SetScrollInfo(hwnd, scroll, &info, TRUE);
|
SetScrollInfo(hwnd, scroll, &info, TRUE);
|
||||||
break;
|
break;
|
||||||
case SB_BOTH:
|
case SB_BOTH:
|
||||||
SCROLL_SetNCSbState( Wnd, vmin, vmax, vpos,
|
SCROLL_SetNCSbState( Wnd->hwndSelf, vmin, vmax, vpos,
|
||||||
hmin, hmax, hpos);
|
hmin, hmax, hpos);
|
||||||
}
|
}
|
||||||
WIN_ReleaseWndPtr(Wnd);
|
WIN_ReleaseWndPtr(Wnd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -495,41 +495,45 @@ BOOL WINAPI AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL menu, DWORD exSty
|
||||||
*
|
*
|
||||||
* Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
|
* Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
|
||||||
*/
|
*/
|
||||||
LONG NC_HandleNCCalcSize( WND *pWnd, RECT *winRect )
|
LONG NC_HandleNCCalcSize( HWND hwnd, RECT *winRect )
|
||||||
{
|
{
|
||||||
RECT tmpRect = { 0, 0, 0, 0 };
|
RECT tmpRect = { 0, 0, 0, 0 };
|
||||||
LONG result = 0;
|
LONG result = 0;
|
||||||
UINT style = (UINT) GetClassLongA(pWnd->hwndSelf, GCL_STYLE);
|
LONG cls_style = GetClassLongA(hwnd, GCL_STYLE);
|
||||||
|
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||||
|
LONG exStyle = GetWindowLongA( hwnd, GWL_EXSTYLE );
|
||||||
|
|
||||||
if (style & CS_VREDRAW) result |= WVR_VREDRAW;
|
if (cls_style & CS_VREDRAW) result |= WVR_VREDRAW;
|
||||||
if (style & CS_HREDRAW) result |= WVR_HREDRAW;
|
if (cls_style & CS_HREDRAW) result |= WVR_HREDRAW;
|
||||||
|
|
||||||
if( !( pWnd->dwStyle & WS_MINIMIZE ) ) {
|
if (!IsIconic(hwnd))
|
||||||
|
{
|
||||||
if (TWEAK_WineLook == WIN31_LOOK)
|
if (TWEAK_WineLook == WIN31_LOOK)
|
||||||
NC_AdjustRect( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle );
|
NC_AdjustRect( &tmpRect, style, FALSE, exStyle );
|
||||||
else
|
else
|
||||||
NC_AdjustRectOuter95( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle );
|
NC_AdjustRectOuter95( &tmpRect, style, FALSE, exStyle );
|
||||||
|
|
||||||
winRect->left -= tmpRect.left;
|
winRect->left -= tmpRect.left;
|
||||||
winRect->top -= tmpRect.top;
|
winRect->top -= tmpRect.top;
|
||||||
winRect->right -= tmpRect.right;
|
winRect->right -= tmpRect.right;
|
||||||
winRect->bottom -= tmpRect.bottom;
|
winRect->bottom -= tmpRect.bottom;
|
||||||
|
|
||||||
if (HAS_MENU(pWnd)) {
|
if (!(style & WS_CHILD) && GetMenu(hwnd))
|
||||||
|
{
|
||||||
TRACE("Calling GetMenuBarHeight with HWND 0x%x, width %d, "
|
TRACE("Calling GetMenuBarHeight with HWND 0x%x, width %d, "
|
||||||
"at (%d, %d).\n", pWnd->hwndSelf,
|
"at (%d, %d).\n", hwnd,
|
||||||
winRect->right - winRect->left,
|
winRect->right - winRect->left,
|
||||||
-tmpRect.left, -tmpRect.top );
|
-tmpRect.left, -tmpRect.top );
|
||||||
|
|
||||||
winRect->top +=
|
winRect->top +=
|
||||||
MENU_GetMenuBarHeight( pWnd->hwndSelf,
|
MENU_GetMenuBarHeight( hwnd,
|
||||||
winRect->right - winRect->left,
|
winRect->right - winRect->left,
|
||||||
-tmpRect.left, -tmpRect.top ) + 1;
|
-tmpRect.left, -tmpRect.top ) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TWEAK_WineLook > WIN31_LOOK) {
|
if (TWEAK_WineLook > WIN31_LOOK) {
|
||||||
SetRect(&tmpRect, 0, 0, 0, 0);
|
SetRect(&tmpRect, 0, 0, 0, 0);
|
||||||
NC_AdjustRectInner95 (&tmpRect, pWnd->dwStyle, pWnd->dwExStyle);
|
NC_AdjustRectInner95 (&tmpRect, style, exStyle);
|
||||||
winRect->left -= tmpRect.left;
|
winRect->left -= tmpRect.left;
|
||||||
winRect->top -= tmpRect.top;
|
winRect->top -= tmpRect.top;
|
||||||
winRect->right -= tmpRect.right;
|
winRect->right -= tmpRect.right;
|
||||||
|
@ -1693,23 +1697,26 @@ LONG NC_HandleNCPaint( HWND hwnd , HRGN clip)
|
||||||
*
|
*
|
||||||
* Handle a WM_NCACTIVATE message. Called from DefWindowProc().
|
* Handle a WM_NCACTIVATE message. Called from DefWindowProc().
|
||||||
*/
|
*/
|
||||||
LONG NC_HandleNCActivate( WND *wndPtr, WPARAM wParam )
|
LONG NC_HandleNCActivate( HWND hwnd, WPARAM wParam )
|
||||||
{
|
{
|
||||||
|
WND* wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
|
|
||||||
/* Lotus Notes draws menu descriptions in the caption of its main
|
/* Lotus Notes draws menu descriptions in the caption of its main
|
||||||
* window. When it wants to restore original "system" view, it just
|
* window. When it wants to restore original "system" view, it just
|
||||||
* sends WM_NCACTIVATE message to itself. Any optimizations here in
|
* sends WM_NCACTIVATE message to itself. Any optimizations here in
|
||||||
* attempt to minimize redrawings lead to a not restored caption.
|
* attempt to minimize redrawings lead to a not restored caption.
|
||||||
*/
|
*/
|
||||||
|
if (wndPtr)
|
||||||
{
|
{
|
||||||
if (wParam) wndPtr->flags |= WIN_NCACTIVATED;
|
if (wParam) wndPtr->flags |= WIN_NCACTIVATED;
|
||||||
else wndPtr->flags &= ~WIN_NCACTIVATED;
|
else wndPtr->flags &= ~WIN_NCACTIVATED;
|
||||||
|
|
||||||
if( wndPtr->dwStyle & WS_MINIMIZE )
|
if (IsIconic(hwnd)) WINPOS_RedrawIconTitle( hwnd );
|
||||||
WINPOS_RedrawIconTitle( wndPtr->hwndSelf );
|
|
||||||
else if (TWEAK_WineLook == WIN31_LOOK)
|
else if (TWEAK_WineLook == WIN31_LOOK)
|
||||||
NC_DoNCPaint( wndPtr, (HRGN)1, FALSE );
|
NC_DoNCPaint( wndPtr, (HRGN)1, FALSE );
|
||||||
else
|
else
|
||||||
NC_DoNCPaint95( wndPtr, (HRGN)1, FALSE );
|
NC_DoNCPaint95( wndPtr, (HRGN)1, FALSE );
|
||||||
|
WIN_ReleaseWndPtr(wndPtr);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1769,30 +1776,28 @@ LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam )
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* NC_GetSysPopupPos
|
* NC_GetSysPopupPos
|
||||||
*/
|
*/
|
||||||
BOOL NC_GetSysPopupPos( WND* wndPtr, RECT* rect )
|
void NC_GetSysPopupPos( HWND hwnd, RECT* rect )
|
||||||
{
|
{
|
||||||
if( wndPtr->hSysMenu )
|
if (IsIconic(hwnd)) GetWindowRect( hwnd, rect );
|
||||||
{
|
else
|
||||||
if( wndPtr->dwStyle & WS_MINIMIZE )
|
{
|
||||||
GetWindowRect( wndPtr->hwndSelf, rect );
|
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
else
|
if (!wndPtr) return;
|
||||||
{
|
|
||||||
NC_GetInsideRect( wndPtr->hwndSelf, rect );
|
NC_GetInsideRect( hwnd, rect );
|
||||||
OffsetRect( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top);
|
OffsetRect( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top);
|
||||||
if (wndPtr->dwStyle & WS_CHILD)
|
if (wndPtr->dwStyle & WS_CHILD)
|
||||||
ClientToScreen( wndPtr->parent->hwndSelf, (POINT *)rect );
|
ClientToScreen( wndPtr->parent->hwndSelf, (POINT *)rect );
|
||||||
if (TWEAK_WineLook == WIN31_LOOK) {
|
if (TWEAK_WineLook == WIN31_LOOK) {
|
||||||
rect->right = rect->left + GetSystemMetrics(SM_CXSIZE);
|
rect->right = rect->left + GetSystemMetrics(SM_CXSIZE);
|
||||||
rect->bottom = rect->top + GetSystemMetrics(SM_CYSIZE);
|
rect->bottom = rect->top + GetSystemMetrics(SM_CYSIZE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
|
rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
|
||||||
rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
|
rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
|
||||||
}
|
}
|
||||||
}
|
WIN_ReleaseWndPtr( wndPtr );
|
||||||
return TRUE;
|
}
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -2052,23 +2057,25 @@ END:
|
||||||
*
|
*
|
||||||
* Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
|
* Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
|
||||||
*/
|
*/
|
||||||
LONG NC_HandleNCLButtonDown( WND* pWnd, WPARAM wParam, LPARAM lParam )
|
LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
HWND hwnd = pWnd->hwndSelf;
|
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||||
|
|
||||||
switch(wParam) /* Hit test */
|
switch(wParam) /* Hit test */
|
||||||
{
|
{
|
||||||
case HTCAPTION:
|
case HTCAPTION:
|
||||||
hwnd = WIN_GetTopParent(hwnd);
|
{
|
||||||
|
HWND top = WIN_GetTopParent(hwnd);
|
||||||
|
|
||||||
if( WINPOS_SetActiveWindow(hwnd, TRUE, TRUE) || (GetActiveWindow() == hwnd) )
|
if( WINPOS_SetActiveWindow(top, TRUE, TRUE) || (GetActiveWindow() == top) )
|
||||||
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam );
|
SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam );
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case HTSYSMENU:
|
case HTSYSMENU:
|
||||||
if( pWnd->dwStyle & WS_SYSMENU )
|
if( style & WS_SYSMENU )
|
||||||
{
|
{
|
||||||
if( !(pWnd->dwStyle & WS_MINIMIZE) )
|
if( !(style & WS_MINIMIZE) )
|
||||||
{
|
{
|
||||||
HDC hDC = GetWindowDC(hwnd);
|
HDC hDC = GetWindowDC(hwnd);
|
||||||
if (TWEAK_WineLook == WIN31_LOOK)
|
if (TWEAK_WineLook == WIN31_LOOK)
|
||||||
|
@ -2130,15 +2137,15 @@ LONG NC_HandleNCLButtonDown( WND* pWnd, WPARAM wParam, LPARAM lParam )
|
||||||
*
|
*
|
||||||
* Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
|
* Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
|
||||||
*/
|
*/
|
||||||
LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM wParam, LPARAM lParam )
|
LONG NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* if this is an icon, send a restore since we are handling
|
* if this is an icon, send a restore since we are handling
|
||||||
* a double click
|
* a double click
|
||||||
*/
|
*/
|
||||||
if (pWnd->dwStyle & WS_MINIMIZE)
|
if (IsIconic(hwnd))
|
||||||
{
|
{
|
||||||
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_RESTORE, lParam );
|
SendMessageW( hwnd, WM_SYSCOMMAND, SC_RESTORE, lParam );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2146,22 +2153,22 @@ LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
case HTCAPTION:
|
case HTCAPTION:
|
||||||
/* stop processing if WS_MAXIMIZEBOX is missing */
|
/* stop processing if WS_MAXIMIZEBOX is missing */
|
||||||
if (pWnd->dwStyle & WS_MAXIMIZEBOX)
|
if (GetWindowLongA( hwnd, GWL_STYLE ) & WS_MAXIMIZEBOX)
|
||||||
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND,
|
SendMessageW( hwnd, WM_SYSCOMMAND,
|
||||||
(pWnd->dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE, lParam );
|
IsZoomed(hwnd) ? SC_RESTORE : SC_MAXIMIZE, lParam );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HTSYSMENU:
|
case HTSYSMENU:
|
||||||
if (!(GetClassWord(pWnd->hwndSelf, GCW_STYLE) & CS_NOCLOSE))
|
if (!(GetClassWord(hwnd, GCW_STYLE) & CS_NOCLOSE))
|
||||||
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_CLOSE, lParam );
|
SendMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, lParam );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HTHSCROLL:
|
case HTHSCROLL:
|
||||||
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam );
|
SendMessageW( hwnd, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL, lParam );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HTVSCROLL:
|
case HTVSCROLL:
|
||||||
SendMessageW( pWnd->hwndSelf, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam );
|
SendMessageW( hwnd, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL, lParam );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2219,11 +2226,11 @@ LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SC_MOUSEMENU:
|
case SC_MOUSEMENU:
|
||||||
MENU_TrackMouseMenuBar( wndPtr, wParam & 0x000F, pt );
|
MENU_TrackMouseMenuBar( hwnd, wParam & 0x000F, pt );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SC_KEYMENU:
|
case SC_KEYMENU:
|
||||||
MENU_TrackKbdMenuBar( wndPtr , wParam , pt.x );
|
MENU_TrackKbdMenuBar( hwnd, wParam , pt.x );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SC_TASKLIST:
|
case SC_TASKLIST:
|
||||||
|
|
|
@ -438,7 +438,7 @@ static WND* WIN_DestroyWindow( WND* wndPtr )
|
||||||
|
|
||||||
/* FIXME: do we need to fake QS_MOUSEMOVE wakebit? */
|
/* FIXME: do we need to fake QS_MOUSEMOVE wakebit? */
|
||||||
|
|
||||||
WINPOS_CheckInternalPos( wndPtr );
|
WINPOS_CheckInternalPos( hwnd );
|
||||||
if( hwnd == GetCapture()) ReleaseCapture();
|
if( hwnd == GetCapture()) ReleaseCapture();
|
||||||
|
|
||||||
/* free resources associated with the window */
|
/* free resources associated with the window */
|
||||||
|
@ -844,7 +844,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
|
||||||
|
|
||||||
if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
|
if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
|
||||||
{
|
{
|
||||||
WINPOS_GetMinMaxInfo( wndPtr, &maxSize, &maxPos, &minTrack, &maxTrack);
|
WINPOS_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack);
|
||||||
if (maxSize.x < cs->cx) cs->cx = maxSize.x;
|
if (maxSize.x < cs->cx) cs->cx = maxSize.x;
|
||||||
if (maxSize.y < cs->cy) cs->cy = maxSize.y;
|
if (maxSize.y < cs->cy) cs->cy = maxSize.y;
|
||||||
if (cs->cx < minTrack.x ) cs->cx = minTrack.x;
|
if (cs->cx < minTrack.x ) cs->cx = minTrack.x;
|
||||||
|
@ -1321,7 +1321,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
|
|
||||||
WINPOS_ActivateOtherWindow(wndPtr);
|
WINPOS_ActivateOtherWindow(wndPtr->hwndSelf);
|
||||||
|
|
||||||
if( wndPtr->owner &&
|
if( wndPtr->owner &&
|
||||||
wndPtr->owner->hwndLastActive == wndPtr->hwndSelf )
|
wndPtr->owner->hwndLastActive == wndPtr->hwndSelf )
|
||||||
|
|
148
windows/winpos.c
148
windows/winpos.c
|
@ -79,11 +79,11 @@ BOOL WINPOS_CreateInternalPosAtom()
|
||||||
*
|
*
|
||||||
* Called when a window is destroyed.
|
* Called when a window is destroyed.
|
||||||
*/
|
*/
|
||||||
void WINPOS_CheckInternalPos( WND* wndPtr )
|
void WINPOS_CheckInternalPos( HWND hwnd )
|
||||||
{
|
{
|
||||||
LPINTERNALPOS lpPos;
|
LPINTERNALPOS lpPos;
|
||||||
MESSAGEQUEUE *pMsgQ = 0;
|
MESSAGEQUEUE *pMsgQ = 0;
|
||||||
HWND hwnd = wndPtr->hwndSelf;
|
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
|
|
||||||
lpPos = (LPINTERNALPOS) GetPropA( hwnd, atomInternalPos );
|
lpPos = (LPINTERNALPOS) GetPropA( hwnd, atomInternalPos );
|
||||||
|
|
||||||
|
@ -92,6 +92,7 @@ void WINPOS_CheckInternalPos( WND* wndPtr )
|
||||||
if ( !pMsgQ )
|
if ( !pMsgQ )
|
||||||
{
|
{
|
||||||
WARN("\tMessage queue not found. Exiting!\n" );
|
WARN("\tMessage queue not found. Exiting!\n" );
|
||||||
|
WIN_ReleaseWndPtr( wndPtr );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +112,7 @@ void WINPOS_CheckInternalPos( WND* wndPtr )
|
||||||
}
|
}
|
||||||
|
|
||||||
QUEUE_Unlock( pMsgQ );
|
QUEUE_Unlock( pMsgQ );
|
||||||
|
WIN_ReleaseWndPtr( wndPtr );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,16 +143,13 @@ UINT WINAPI ArrangeIconicWindows( HWND parent )
|
||||||
{
|
{
|
||||||
if( IsIconic( hwndChild ) )
|
if( IsIconic( hwndChild ) )
|
||||||
{
|
{
|
||||||
WND *wndPtr = WIN_FindWndPtr(hwndChild);
|
WINPOS_ShowIconTitle( hwndChild, FALSE );
|
||||||
|
|
||||||
WINPOS_ShowIconTitle( wndPtr, FALSE );
|
|
||||||
|
|
||||||
SetWindowPos( hwndChild, 0, x + (xspacing - GetSystemMetrics(SM_CXICON)) / 2,
|
SetWindowPos( hwndChild, 0, x + (xspacing - GetSystemMetrics(SM_CXICON)) / 2,
|
||||||
y - yspacing - GetSystemMetrics(SM_CYICON)/2, 0, 0,
|
y - yspacing - GetSystemMetrics(SM_CYICON)/2, 0, 0,
|
||||||
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
|
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
|
||||||
if( IsWindow(hwndChild) )
|
if( IsWindow(hwndChild) )
|
||||||
WINPOS_ShowIconTitle(wndPtr , TRUE );
|
WINPOS_ShowIconTitle(hwndChild , TRUE );
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
|
|
||||||
if (x <= rectParent.right - xspacing) x += xspacing;
|
if (x <= rectParent.right - xspacing) x += xspacing;
|
||||||
else
|
else
|
||||||
|
@ -1050,32 +1049,28 @@ BOOL WINPOS_RedrawIconTitle( HWND hWnd )
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* WINPOS_ShowIconTitle
|
* WINPOS_ShowIconTitle
|
||||||
*/
|
*/
|
||||||
BOOL WINPOS_ShowIconTitle( WND* pWnd, BOOL bShow )
|
BOOL WINPOS_ShowIconTitle( HWND hwnd, BOOL bShow )
|
||||||
{
|
{
|
||||||
LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( pWnd->hwndSelf, atomInternalPos );
|
LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA( hwnd, atomInternalPos );
|
||||||
|
|
||||||
if( lpPos && !(pWnd->dwExStyle & WS_EX_MANAGED))
|
if( lpPos && !(GetWindowLongA( hwnd, GWL_EXSTYLE) & WS_EX_MANAGED))
|
||||||
{
|
{
|
||||||
HWND16 hWnd = lpPos->hwndIconTitle;
|
HWND title = lpPos->hwndIconTitle;
|
||||||
|
|
||||||
TRACE("0x%04x %i\n", pWnd->hwndSelf, (bShow != 0) );
|
TRACE("0x%04x %i\n", hwnd, (bShow != 0) );
|
||||||
|
|
||||||
if( !hWnd )
|
if( !title )
|
||||||
lpPos->hwndIconTitle = hWnd = ICONTITLE_Create( pWnd );
|
lpPos->hwndIconTitle = title = ICONTITLE_Create( hwnd );
|
||||||
if( bShow )
|
if( bShow )
|
||||||
{
|
{
|
||||||
if( ( pWnd = WIN_FindWndPtr(hWnd) ) != NULL)
|
if (!IsWindowVisible(title))
|
||||||
{
|
{
|
||||||
if( !(pWnd->dwStyle & WS_VISIBLE) )
|
SendMessageA( title, WM_SHOWWINDOW, TRUE, 0 );
|
||||||
{
|
SetWindowPos( title, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
|
||||||
SendMessageA( hWnd, WM_SHOWWINDOW, TRUE, 0 );
|
SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
|
||||||
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
|
}
|
||||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW );
|
|
||||||
}
|
|
||||||
WIN_ReleaseWndPtr(pWnd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else ShowWindow( hWnd, SW_HIDE );
|
else ShowWindow( title, SW_HIDE );
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1085,12 +1080,14 @@ BOOL WINPOS_ShowIconTitle( WND* pWnd, BOOL bShow )
|
||||||
*
|
*
|
||||||
* Get the minimized and maximized information for a window.
|
* Get the minimized and maximized information for a window.
|
||||||
*/
|
*/
|
||||||
void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
|
void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
|
||||||
POINT *minTrack, POINT *maxTrack )
|
POINT *minTrack, POINT *maxTrack )
|
||||||
{
|
{
|
||||||
LPINTERNALPOS lpPos;
|
LPINTERNALPOS lpPos;
|
||||||
MINMAXINFO MinMax;
|
MINMAXINFO MinMax;
|
||||||
INT xinc, yinc;
|
INT xinc, yinc;
|
||||||
|
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||||
|
LONG exstyle = GetWindowLongA( hwnd, GWL_EXSTYLE );
|
||||||
|
|
||||||
/* Compute default values */
|
/* Compute default values */
|
||||||
|
|
||||||
|
@ -1101,7 +1098,7 @@ void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
|
||||||
MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN);
|
MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN);
|
||||||
MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);
|
MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
|
||||||
if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
|
if (HAS_DLGFRAME( style, exstyle ))
|
||||||
{
|
{
|
||||||
xinc = GetSystemMetrics(SM_CXDLGFRAME);
|
xinc = GetSystemMetrics(SM_CXDLGFRAME);
|
||||||
yinc = GetSystemMetrics(SM_CYDLGFRAME);
|
yinc = GetSystemMetrics(SM_CYDLGFRAME);
|
||||||
|
@ -1109,12 +1106,12 @@ void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xinc = yinc = 0;
|
xinc = yinc = 0;
|
||||||
if (HAS_THICKFRAME(wndPtr->dwStyle))
|
if (HAS_THICKFRAME(style))
|
||||||
{
|
{
|
||||||
xinc += GetSystemMetrics(SM_CXFRAME);
|
xinc += GetSystemMetrics(SM_CXFRAME);
|
||||||
yinc += GetSystemMetrics(SM_CYFRAME);
|
yinc += GetSystemMetrics(SM_CYFRAME);
|
||||||
}
|
}
|
||||||
if (wndPtr->dwStyle & WS_BORDER)
|
if (style & WS_BORDER)
|
||||||
{
|
{
|
||||||
xinc += GetSystemMetrics(SM_CXBORDER);
|
xinc += GetSystemMetrics(SM_CXBORDER);
|
||||||
yinc += GetSystemMetrics(SM_CYBORDER);
|
yinc += GetSystemMetrics(SM_CYBORDER);
|
||||||
|
@ -1123,7 +1120,7 @@ void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
|
||||||
MinMax.ptMaxSize.x += 2 * xinc;
|
MinMax.ptMaxSize.x += 2 * xinc;
|
||||||
MinMax.ptMaxSize.y += 2 * yinc;
|
MinMax.ptMaxSize.y += 2 * yinc;
|
||||||
|
|
||||||
lpPos = (LPINTERNALPOS)GetPropA( wndPtr->hwndSelf, atomInternalPos );
|
lpPos = (LPINTERNALPOS)GetPropA( hwnd, atomInternalPos );
|
||||||
if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) )
|
if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) )
|
||||||
CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );
|
CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );
|
||||||
else
|
else
|
||||||
|
@ -1132,7 +1129,7 @@ void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
|
||||||
MinMax.ptMaxPosition.y = -yinc;
|
MinMax.ptMaxPosition.y = -yinc;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageA( wndPtr->hwndSelf, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
|
SendMessageA( hwnd, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
|
||||||
|
|
||||||
/* Some sanity checks */
|
/* Some sanity checks */
|
||||||
|
|
||||||
|
@ -1292,7 +1289,7 @@ static BOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT16 *wndpl,
|
||||||
|
|
||||||
if( pWnd->dwStyle & WS_MINIMIZE )
|
if( pWnd->dwStyle & WS_MINIMIZE )
|
||||||
{
|
{
|
||||||
WINPOS_ShowIconTitle( pWnd, FALSE );
|
WINPOS_ShowIconTitle( pWnd->hwndSelf, FALSE );
|
||||||
if( wndpl->flags & WPF_SETMINPOSITION && !EMPTYPOINT(lpPos->ptIconPos))
|
if( wndpl->flags & WPF_SETMINPOSITION && !EMPTYPOINT(lpPos->ptIconPos))
|
||||||
SetWindowPos( hwnd, 0, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
|
SetWindowPos( hwnd, 0, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
|
||||||
0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
|
0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
|
||||||
|
@ -1312,7 +1309,7 @@ static BOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT16 *wndpl,
|
||||||
ShowWindow( hwnd, wndpl->showCmd );
|
ShowWindow( hwnd, wndpl->showCmd );
|
||||||
if( IsWindow(hwnd) && pWnd->dwStyle & WS_MINIMIZE )
|
if( IsWindow(hwnd) && pWnd->dwStyle & WS_MINIMIZE )
|
||||||
{
|
{
|
||||||
if( pWnd->dwStyle & WS_VISIBLE ) WINPOS_ShowIconTitle( pWnd, TRUE );
|
if( pWnd->dwStyle & WS_VISIBLE ) WINPOS_ShowIconTitle( pWnd->hwndSelf, TRUE );
|
||||||
|
|
||||||
/* SDK: ...valid only the next time... */
|
/* SDK: ...valid only the next time... */
|
||||||
if( wndpl->flags & WPF_RESTORETOMAXIMIZED ) pWnd->flags |= WIN_RESTORE_MAX;
|
if( wndpl->flags & WPF_RESTORETOMAXIMIZED ) pWnd->flags |= WIN_RESTORE_MAX;
|
||||||
|
@ -1680,11 +1677,11 @@ CLEANUP_END:
|
||||||
*
|
*
|
||||||
* Activates window other than pWnd.
|
* Activates window other than pWnd.
|
||||||
*/
|
*/
|
||||||
BOOL WINPOS_ActivateOtherWindow(WND* pWnd)
|
BOOL WINPOS_ActivateOtherWindow(HWND hwnd)
|
||||||
{
|
{
|
||||||
BOOL bRet = 0;
|
BOOL bRet = 0;
|
||||||
WND* pWndTo = NULL;
|
WND *pWnd, *pWndTo = NULL;
|
||||||
HWND hwndActive = 0;
|
HWND hwndActive = 0;
|
||||||
|
|
||||||
/* Get current active window from the active queue */
|
/* Get current active window from the active queue */
|
||||||
if ( hActiveQueue )
|
if ( hActiveQueue )
|
||||||
|
@ -1697,37 +1694,42 @@ BOOL WINPOS_ActivateOtherWindow(WND* pWnd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pWnd->hwndSelf == hwndPrevActive )
|
if( hwnd == hwndPrevActive )
|
||||||
hwndPrevActive = 0;
|
hwndPrevActive = 0;
|
||||||
|
|
||||||
if( hwndActive != pWnd->hwndSelf &&
|
pWnd = WIN_FindWndPtr( hwnd );
|
||||||
( hwndActive || QUEUE_IsExitingQueue(pWnd->hmemTaskQ)) )
|
if( hwndActive != hwnd &&
|
||||||
return 0;
|
( hwndActive || QUEUE_IsExitingQueue(pWnd->hmemTaskQ)) )
|
||||||
|
{
|
||||||
|
WIN_ReleaseWndPtr( pWnd );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if( !(pWnd->dwStyle & WS_POPUP) || !(pWnd->owner) ||
|
if( !(pWnd->dwStyle & WS_POPUP) || !(pWnd->owner) ||
|
||||||
!WINPOS_CanActivate((pWndTo = WIN_GetTopParentPtr(pWnd->owner))) )
|
!WINPOS_CanActivate((pWndTo = WIN_GetTopParentPtr(pWnd->owner))) )
|
||||||
{
|
{
|
||||||
WND* pWndPtr = WIN_GetTopParentPtr(pWnd);
|
WND* pWndPtr = WIN_GetTopParentPtr(pWnd);
|
||||||
|
|
||||||
WIN_ReleaseWndPtr(pWndTo);
|
WIN_ReleaseWndPtr(pWndTo);
|
||||||
pWndTo = WIN_FindWndPtr(hwndPrevActive);
|
pWndTo = WIN_FindWndPtr(hwndPrevActive);
|
||||||
|
|
||||||
while( !WINPOS_CanActivate(pWndTo) )
|
while( !WINPOS_CanActivate(pWndTo) )
|
||||||
{
|
{
|
||||||
/* by now owned windows should've been taken care of */
|
/* by now owned windows should've been taken care of */
|
||||||
WIN_UpdateWndPtr(&pWndTo,pWndPtr->next);
|
WIN_UpdateWndPtr(&pWndTo,pWndPtr->next);
|
||||||
WIN_UpdateWndPtr(&pWndPtr,pWndTo);
|
WIN_UpdateWndPtr(&pWndPtr,pWndTo);
|
||||||
if( !pWndTo ) break;
|
if( !pWndTo ) break;
|
||||||
}
|
}
|
||||||
WIN_ReleaseWndPtr(pWndPtr);
|
WIN_ReleaseWndPtr(pWndPtr);
|
||||||
}
|
}
|
||||||
|
WIN_ReleaseWndPtr( pWnd );
|
||||||
|
|
||||||
bRet = WINPOS_SetActiveWindow( pWndTo ? pWndTo->hwndSelf : 0, FALSE, TRUE );
|
bRet = WINPOS_SetActiveWindow( pWndTo ? pWndTo->hwndSelf : 0, FALSE, TRUE );
|
||||||
|
|
||||||
if( pWndTo ) WIN_ReleaseWndPtr(pWndTo);
|
if( pWndTo ) WIN_ReleaseWndPtr(pWndTo);
|
||||||
|
|
||||||
hwndPrevActive = 0;
|
hwndPrevActive = 0;
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
|
@ -1827,17 +1829,18 @@ LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
|
||||||
*
|
*
|
||||||
* Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
|
* Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
|
||||||
*/
|
*/
|
||||||
LONG WINPOS_HandleWindowPosChanging16( WND *wndPtr, WINDOWPOS16 *winpos )
|
LONG WINPOS_HandleWindowPosChanging16( HWND hwnd, WINDOWPOS16 *winpos )
|
||||||
{
|
{
|
||||||
POINT maxSize, minTrack;
|
POINT maxSize, minTrack;
|
||||||
|
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||||
|
|
||||||
if (winpos->flags & SWP_NOSIZE) return 0;
|
if (winpos->flags & SWP_NOSIZE) return 0;
|
||||||
if ((wndPtr->dwStyle & WS_THICKFRAME) ||
|
if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
|
||||||
((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0))
|
|
||||||
{
|
{
|
||||||
WINPOS_GetMinMaxInfo( wndPtr, &maxSize, NULL, &minTrack, NULL );
|
WINPOS_GetMinMaxInfo( hwnd, &maxSize, NULL, &minTrack, NULL );
|
||||||
if (maxSize.x < winpos->cx) winpos->cx = maxSize.x;
|
if (maxSize.x < winpos->cx) winpos->cx = maxSize.x;
|
||||||
if (maxSize.y < winpos->cy) winpos->cy = maxSize.y;
|
if (maxSize.y < winpos->cy) winpos->cy = maxSize.y;
|
||||||
if (!(wndPtr->dwStyle & WS_MINIMIZE))
|
if (!(style & WS_MINIMIZE))
|
||||||
{
|
{
|
||||||
if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
|
if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
|
||||||
if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
|
if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
|
||||||
|
@ -1852,17 +1855,18 @@ LONG WINPOS_HandleWindowPosChanging16( WND *wndPtr, WINDOWPOS16 *winpos )
|
||||||
*
|
*
|
||||||
* Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
|
* Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
|
||||||
*/
|
*/
|
||||||
LONG WINPOS_HandleWindowPosChanging( WND *wndPtr, WINDOWPOS *winpos )
|
LONG WINPOS_HandleWindowPosChanging( HWND hwnd, WINDOWPOS *winpos )
|
||||||
{
|
{
|
||||||
POINT maxSize, minTrack;
|
POINT maxSize, minTrack;
|
||||||
|
LONG style = GetWindowLongA( hwnd, GWL_STYLE );
|
||||||
|
|
||||||
if (winpos->flags & SWP_NOSIZE) return 0;
|
if (winpos->flags & SWP_NOSIZE) return 0;
|
||||||
if ((wndPtr->dwStyle & WS_THICKFRAME) ||
|
if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
|
||||||
((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0))
|
|
||||||
{
|
{
|
||||||
WINPOS_GetMinMaxInfo( wndPtr, &maxSize, NULL, &minTrack, NULL );
|
WINPOS_GetMinMaxInfo( hwnd, &maxSize, NULL, &minTrack, NULL );
|
||||||
winpos->cx = min( winpos->cx, maxSize.x );
|
winpos->cx = min( winpos->cx, maxSize.x );
|
||||||
winpos->cy = min( winpos->cy, maxSize.y );
|
winpos->cy = min( winpos->cy, maxSize.y );
|
||||||
if (!(wndPtr->dwStyle & WS_MINIMIZE))
|
if (!(style & WS_MINIMIZE))
|
||||||
{
|
{
|
||||||
if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
|
if (winpos->cx < minTrack.x ) winpos->cx = minTrack.x;
|
||||||
if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
|
if (winpos->cy < minTrack.y ) winpos->cy = minTrack.y;
|
||||||
|
|
Loading…
Reference in New Issue