comctl32/monthcal: Fix hittesting for MCHT_CALENDARDATEPREV/MCHT_CALENDARDATENEXT cases.

This commit is contained in:
Nikolay Sivov 2009-09-29 23:30:49 +04:00 committed by Alexandre Julliard
parent 74d000489b
commit 344f07007b
1 changed files with 13 additions and 13 deletions

View File

@ -1210,30 +1210,30 @@ MONTHCAL_HitTest(const MONTHCAL_INFO *infoPtr, MCHITTESTINFO *lpht)
goto done; goto done;
} }
if(PtInRect(&infoPtr->days, lpht->pt)) if(PtInRect(&infoPtr->days, lpht->pt))
{ {
lpht->st.wYear = infoPtr->curSel.wYear; lpht->st.wYear = infoPtr->curSel.wYear;
if ( day < 1) if ( day < 1)
{ {
retval = MCHT_CALENDARDATEPREV; retval = MCHT_CALENDARDATEPREV;
lpht->st.wMonth = infoPtr->curSel.wMonth - 1; lpht->st.wMonth = infoPtr->curSel.wMonth - 1;
if (lpht->st.wMonth <1) if (lpht->st.wMonth < 1)
{ {
lpht->st.wMonth = 12; lpht->st.wMonth = 12;
lpht->st.wYear--; lpht->st.wYear--;
} }
lpht->st.wDay = MONTHCAL_MonthLength(lpht->st.wMonth,lpht->st.wYear) -day; lpht->st.wDay = MONTHCAL_MonthLength(lpht->st.wMonth,lpht->st.wYear) + day;
} }
else if (day > MONTHCAL_MonthLength(infoPtr->curSel.wMonth,infoPtr->curSel.wYear)) else if (day > MONTHCAL_MonthLength(infoPtr->curSel.wMonth,infoPtr->curSel.wYear))
{ {
retval = MCHT_CALENDARDATENEXT; retval = MCHT_CALENDARDATENEXT;
lpht->st.wMonth = infoPtr->curSel.wMonth + 1; lpht->st.wMonth = infoPtr->curSel.wMonth + 1;
if (lpht->st.wMonth <12) if (lpht->st.wMonth > 12)
{ {
lpht->st.wMonth = 1; lpht->st.wMonth = 1;
lpht->st.wYear++; lpht->st.wYear++;
} }
lpht->st.wDay = day - MONTHCAL_MonthLength(infoPtr->curSel.wMonth,infoPtr->curSel.wYear) ; lpht->st.wDay = day - MONTHCAL_MonthLength(infoPtr->curSel.wMonth,infoPtr->curSel.wYear);
} }
else { else {
retval = MCHT_CALENDARDATE; retval = MCHT_CALENDARDATE;
lpht->st.wMonth = infoPtr->curSel.wMonth; lpht->st.wMonth = infoPtr->curSel.wMonth;