comctl32/tab: Selected item should have TCIS_BUTTONPRESSED state.

This commit is contained in:
Nikolay Sivov 2009-03-25 18:34:58 -04:00 committed by Alexandre Julliard
parent db60f69cba
commit 0e5dac618f
2 changed files with 15 additions and 11 deletions

View File

@ -252,6 +252,9 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
return -1;
else {
if (infoPtr->iSelected != iItem) {
infoPtr->items[prevItem].dwState &= ~TCIS_BUTTONPRESSED;
infoPtr->items[iItem].dwState |= TCIS_BUTTONPRESSED;
infoPtr->iSelected=iItem;
infoPtr->uFocus=iItem;
TAB_EnsureSelectionVisible(infoPtr);
@ -489,12 +492,8 @@ static LRESULT TAB_KeyUp(TAB_INFO* infoPtr, WPARAM keyCode)
{
if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING))
{
infoPtr->iSelected = newItem;
infoPtr->uFocus = newItem;
TAB_SetCurSel(infoPtr, newItem);
TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE);
TAB_EnsureSelectionVisible(infoPtr);
TAB_InvalidateTabArea(infoPtr);
}
}
@ -615,13 +614,8 @@ TAB_LButtonDown (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{
if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING))
{
infoPtr->iSelected = newItem;
infoPtr->uFocus = newItem;
TAB_SetCurSel(infoPtr, newItem);
TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE);
TAB_EnsureSelectionVisible(infoPtr);
TAB_InvalidateTabArea(infoPtr);
}
}
return 0;

View File

@ -727,6 +727,7 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs)
{
INT selectionIndex;
INT focusIndex;
TCITEM tcItem;
flush_sequences(sequences, NUM_MSG_SEQUENCES);
@ -756,6 +757,15 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs)
ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_sel_seq, "Getset curSel test sequence", FALSE);
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset curSel test parent sequence", FALSE);
/* selected item should have TCIS_BUTTONPRESSED state
It doesn't depend on button state */
memset(&tcItem, 0, sizeof(TCITEM));
tcItem.mask = TCIF_STATE;
tcItem.dwStateMask = TCIS_BUTTONPRESSED;
selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
SendMessage(hTab, TCM_GETITEM, selectionIndex, (LPARAM) &tcItem);
ok (tcItem.dwState & TCIS_BUTTONPRESSED, "Selected item should have TCIS_BUTTONPRESSED\n");
}
/* Testing ExtendedStyle */