comctl32: tab: Minor bug fixes in the curSel and curFocus getters and setters.
This commit is contained in:
parent
62d3be772d
commit
637a6116e2
|
@ -231,19 +231,10 @@ static inline LRESULT TAB_GetCurSel (const TAB_INFO *infoPtr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* RETURNS
|
/* RETURNS
|
||||||
* the index of the tab item that has the focus
|
* the index of the tab item that has the focus. */
|
||||||
* NOTE
|
|
||||||
* we have not to return negative value
|
|
||||||
* TODO
|
|
||||||
* test for windows */
|
|
||||||
static inline LRESULT
|
static inline LRESULT
|
||||||
TAB_GetCurFocus (const TAB_INFO *infoPtr)
|
TAB_GetCurFocus (const TAB_INFO *infoPtr)
|
||||||
{
|
{
|
||||||
if (infoPtr->uFocus<0)
|
|
||||||
{
|
|
||||||
FIXME("we have not to return negative value\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return infoPtr->uFocus;
|
return infoPtr->uFocus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,10 +246,13 @@ static inline LRESULT TAB_GetToolTips (const TAB_INFO *infoPtr)
|
||||||
|
|
||||||
static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
|
static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
|
||||||
{
|
{
|
||||||
INT prevItem = -1;
|
INT prevItem = infoPtr->iSelected;
|
||||||
|
|
||||||
if (iItem >= 0 && iItem < infoPtr->uNumItem) {
|
if (iItem < 0)
|
||||||
prevItem=infoPtr->iSelected;
|
infoPtr->iSelected=-1;
|
||||||
|
else if (iItem >= infoPtr->uNumItem)
|
||||||
|
return -1;
|
||||||
|
else {
|
||||||
if (infoPtr->iSelected != iItem) {
|
if (infoPtr->iSelected != iItem) {
|
||||||
infoPtr->iSelected=iItem;
|
infoPtr->iSelected=iItem;
|
||||||
TAB_EnsureSelectionVisible(infoPtr);
|
TAB_EnsureSelectionVisible(infoPtr);
|
||||||
|
@ -270,8 +264,9 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
|
||||||
|
|
||||||
static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT iItem)
|
static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT iItem)
|
||||||
{
|
{
|
||||||
if (iItem < 0 || iItem >= infoPtr->uNumItem) return 0;
|
if (iItem < 0)
|
||||||
|
infoPtr->uFocus = -1;
|
||||||
|
else if (iItem < infoPtr->uNumItem) {
|
||||||
if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) {
|
if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) {
|
||||||
FIXME("Should set input focus\n");
|
FIXME("Should set input focus\n");
|
||||||
} else {
|
} else {
|
||||||
|
@ -290,6 +285,7 @@ static LRESULT TAB_SetCurFocus (TAB_INFO *infoPtr, INT iItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -663,9 +663,7 @@ static void test_getters_setters(INT nTabs)
|
||||||
/* Testing CurFocus with negative value */
|
/* Testing CurFocus with negative value */
|
||||||
SendMessage(hTab, TCM_SETCURFOCUS, -10, 0);
|
SendMessage(hTab, TCM_SETCURFOCUS, -10, 0);
|
||||||
focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||||
todo_wine{
|
|
||||||
expect(-1, focusIndex);
|
expect(-1, focusIndex);
|
||||||
}
|
|
||||||
|
|
||||||
/* Testing CurFocus with value larger than number of tabs */
|
/* Testing CurFocus with value larger than number of tabs */
|
||||||
focusIndex = SendMessage(hTab, TCM_SETCURSEL, 1, 0);
|
focusIndex = SendMessage(hTab, TCM_SETCURSEL, 1, 0);
|
||||||
|
@ -697,15 +695,12 @@ static void test_getters_setters(INT nTabs)
|
||||||
/* Testing CurSel with negative value */
|
/* Testing CurSel with negative value */
|
||||||
SendMessage(hTab, TCM_SETCURSEL, -10, 0);
|
SendMessage(hTab, TCM_SETCURSEL, -10, 0);
|
||||||
selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
|
selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
|
||||||
todo_wine{
|
|
||||||
expect(-1, selectionIndex);
|
expect(-1, selectionIndex);
|
||||||
}
|
|
||||||
|
|
||||||
/* Testing CurSel with value larger than number of tabs */
|
/* Testing CurSel with value larger than number of tabs */
|
||||||
selectionIndex = SendMessage(hTab, TCM_SETCURSEL, 1, 0);
|
selectionIndex = SendMessage(hTab, TCM_SETCURSEL, 1, 0);
|
||||||
todo_wine{
|
|
||||||
expect(-1, selectionIndex);
|
expect(-1, selectionIndex);
|
||||||
}
|
|
||||||
selectionIndex = SendMessage(hTab, TCM_SETCURSEL, nTabs+1, 0);
|
selectionIndex = SendMessage(hTab, TCM_SETCURSEL, nTabs+1, 0);
|
||||||
expect(-1, selectionIndex);
|
expect(-1, selectionIndex);
|
||||||
selectionIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
selectionIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
||||||
|
|
Loading…
Reference in New Issue