Commit 47361da5 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

- do not move updown control and buddy if an alignment was not requested

- in UDM_SETACCEL handler do not forget to update number of accelerators - update arrows info in WM_LBUTTONDOWN as well as in WM_MOUSEMOVE - use accelerators in WM_LBUTTONDOWN handler
parent 33676ad3
......@@ -428,8 +428,9 @@ static LRESULT CALLBACK
UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
WNDPROC superClassWndProc = (WNDPROC)GetPropW(hwnd, BUDDY_SUPERCLASS_WNDPROC);
TRACE("hwnd=%p, wndProc=%d, uMsg=%04x, wParam=%d, lParam=%d\n",
hwnd, (INT)superClassWndProc, uMsg, wParam, (UINT)lParam);
TRACE("hwnd=%p, wndProc=%p, uMsg=%04x, wParam=%08x, lParam=%08lx\n",
hwnd, superClassWndProc, uMsg, wParam, lParam);
if (uMsg == WM_KEYDOWN) {
HWND upDownHwnd = GetPropW(hwnd, BUDDY_UPDOWN_HWND);
......@@ -510,7 +511,8 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
budRect.right -= DEFAULT_WIDTH + DEFAULT_XSEP;
x = budRect.right+DEFAULT_XSEP;
} else {
x = budRect.right+DEFAULT_XSEP;
/* nothing to do */
return ret;
}
/* first adjust the buddy to accommodate the up/down */
......@@ -535,7 +537,7 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
x -= DEFAULT_BUDDYBORDER;
}
SetWindowPos(infoPtr->Self, infoPtr->Buddy, x,
SetWindowPos(infoPtr->Self, 0, x,
budRect.top - DEFAULT_ADDTOP, width,
budRect.bottom - budRect.top + DEFAULT_ADDTOP + DEFAULT_ADDBOT,
SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOZORDER);
......@@ -570,6 +572,8 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
delta *= (action & FLAG_INCR ? 1 : -1) * (infoPtr->MaxVal < infoPtr->MinVal ? -1 : 1);
if ( (action & FLAG_INCR) && (action & FLAG_DECR) ) delta = 0;
TRACE("current %d, delta: %d\n", infoPtr->CurVal, delta);
/* We must notify parent now to obtain permission */
ni.iPos = infoPtr->CurVal;
ni.iDelta = delta;
......@@ -581,6 +585,8 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
/* Now adjust value with (maybe new) delta */
if (UPDOWN_OffsetVal (infoPtr, ni.iDelta)) {
TRACE("new %d, delta: %d\n", infoPtr->CurVal, ni.iDelta);
/* Now take care about our buddy */
if (dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr);
}
......@@ -599,7 +605,7 @@ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action)
*/
static BOOL UPDOWN_IsEnabled (UPDOWN_INFO *infoPtr)
{
if(GetWindowLongW (infoPtr->Self, GWL_STYLE) & WS_DISABLED)
if (!IsWindowEnabled(infoPtr->Self))
return FALSE;
if(infoPtr->Buddy)
return IsWindowEnabled(infoPtr->Buddy);
......@@ -651,16 +657,25 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, POINTS pts)
RECT rect;
int temp, arrow;
TRACE("msg %04x point %s\n", msg, wine_dbgstr_point(&pt));
switch(msg)
{
case WM_LBUTTONDOWN: /* Initialise mouse tracking */
/* If we are inside an arrow, then nothing to do */
if(!(infoPtr->Flags & FLAG_MOUSEIN)) return;
/* If the buddy is an edit, will set focus to it */
if (UPDOWN_IsBuddyEdit(infoPtr)) SetFocus(infoPtr->Buddy);
/* Now see which one is the 'active' arrow */
arrow = UPDOWN_GetArrowFromPoint (infoPtr, &rect, pt);
/* Update the flags if we are in/out */
infoPtr->Flags &= ~(FLAG_MOUSEIN | FLAG_ARROW);
if (arrow)
infoPtr->Flags |= FLAG_MOUSEIN | arrow;
else
if (infoPtr->AccelIndex != -1) infoPtr->AccelIndex = 0;
if (infoPtr->Flags & FLAG_ARROW) {
/* Update the CurVal if necessary */
......@@ -673,7 +688,8 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, POINTS pts)
InvalidateRect (infoPtr->Self, NULL, FALSE);
/* process the click */
UPDOWN_DoAction (infoPtr, 1, infoPtr->Flags & FLAG_ARROW);
temp = (infoPtr->AccelCount && infoPtr->AccelVect) ? infoPtr->AccelVect[0].nInc : 1;
UPDOWN_DoAction (infoPtr, temp, infoPtr->Flags & FLAG_ARROW);
/* now capture all mouse messages */
SetCapture (infoPtr->Self);
......@@ -718,6 +734,8 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
int temp;
TRACE("hwnd=%p msg=%04x wparam=%08x lparam=%08lx\n", hwnd, message, wParam, lParam);
if (!infoPtr && (message != WM_CREATE))
return DefWindowProcW (hwnd, message, wParam, lParam);
......@@ -843,7 +861,8 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
return 0;
case UDM_SETACCEL:
TRACE("UpDown Ctrl new accel info, hwnd=%p\n", hwnd);
TRACE("UDM_SETACCEL\n");
if(infoPtr->AccelVect) {
Free (infoPtr->AccelVect);
infoPtr->AccelCount = 0;
......@@ -853,6 +872,11 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
infoPtr->AccelVect = Alloc (wParam*sizeof(UDACCEL));
if(infoPtr->AccelVect == 0) return FALSE;
memcpy(infoPtr->AccelVect, (void*)lParam, wParam*sizeof(UDACCEL));
infoPtr->AccelCount = wParam;
for (temp = 0; temp < wParam; temp++)
TRACE("%d: nSec %u nInc %u\n", temp, infoPtr->AccelVect[temp].nSec, infoPtr->AccelVect[temp].nInc);
return TRUE;
case UDM_GETBASE:
......
......@@ -1732,7 +1732,7 @@ static const SPY_NOTIFY spnfy_array[] = {
SPNFY(TBN_GETINFOTIPW, NMTBGETINFOTIPW),
SPNFY(TBN_GETBUTTONINFOW, NMTOOLBARW),
/* Up/Down 0U-721U to 0U-740U */
SPNFY(UDN_DELTAPOS, NMHDR),
SPNFY(UDN_DELTAPOS, NM_UPDOWN),
/* Month Calendar 0U-750U to 0U-759U */
/* ******************* WARNING ***************************** */
/* The following appear backwards but needs to be this way. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment