Commit 2c0f14af authored by Yuxi Zhang's avatar Yuxi Zhang Committed by Alexandre Julliard

Stephen Mereu

TabCtrl leftmostVisible is not updated properly. It caused the QP application bar on the bottom fail to bring back the items when there is no need to scrolling. Also fixed a bug that when an item is inserted, setItemBounds should be called first, then it's time to invalidate.
parent 920d9c6f
...@@ -131,11 +131,11 @@ TAB_SetCurFocus (HWND hwnd,WPARAM wParam) ...@@ -131,11 +131,11 @@ TAB_SetCurFocus (HWND hwnd,WPARAM wParam)
if ((iItem < 0) || (iItem >= infoPtr->uNumItem)) return 0; if ((iItem < 0) || (iItem >= infoPtr->uNumItem)) return 0;
infoPtr->uFocus=iItem;
if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BUTTONS) { if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_BUTTONS) {
FIXME("Should set input focus\n"); FIXME("Should set input focus\n");
} else { } else {
if (infoPtr->iSelected != iItem) { if (infoPtr->iSelected != iItem || infoPtr->uFocus == -1 ) {
infoPtr->uFocus=iItem;
if (TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)!=TRUE) { if (TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)!=TRUE) {
infoPtr->iSelected = iItem; infoPtr->iSelected = iItem;
TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE); TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE);
...@@ -575,6 +575,10 @@ static void TAB_SetupScrolling( ...@@ -575,6 +575,10 @@ static void TAB_SetupScrolling(
*/ */
if (infoPtr->hwndUpDown==0) if (infoPtr->hwndUpDown==0)
{ {
/*
* I use a scrollbar since it seems to be more stable than the Updown
* control.
*/
infoPtr->hwndUpDown = CreateWindowA("msctls_updown32", infoPtr->hwndUpDown = CreateWindowA("msctls_updown32",
"", "",
WS_VISIBLE | WS_CHILD | UDS_HORZ, WS_VISIBLE | WS_CHILD | UDS_HORZ,
...@@ -783,6 +787,10 @@ static void TAB_SetItemBounds (HWND hwnd) ...@@ -783,6 +787,10 @@ static void TAB_SetItemBounds (HWND hwnd)
infoPtr->needsScrolling = (curItemLeftPos + (2*SELECTED_TAB_OFFSET) > infoPtr->needsScrolling = (curItemLeftPos + (2*SELECTED_TAB_OFFSET) >
clientRect.right); clientRect.right);
/* Don't need scrolling, then update infoPtr->leftmostVisible */
if(!infoPtr->needsScrolling)
infoPtr->leftmostVisible = 0;
TAB_SetupScrolling(hwnd, infoPtr, &clientRect); TAB_SetupScrolling(hwnd, infoPtr, &clientRect);
/* /*
...@@ -1172,6 +1180,13 @@ static void TAB_Refresh (HWND hwnd, HDC hdc) ...@@ -1172,6 +1180,13 @@ static void TAB_Refresh (HWND hwnd, HDC hdc)
* Then, draw the selected item * Then, draw the selected item
*/ */
TAB_DrawItem (hwnd, hdc, infoPtr->iSelected); TAB_DrawItem (hwnd, hdc, infoPtr->iSelected);
/*
* If we haven't set the current focus yet, set it now.
* Only happens when we first paint the tab controls.
*/
if (infoPtr->uFocus == -1)
TAB_SetCurFocus(hwnd, infoPtr->iSelected);
} }
SelectObject (hdc, hOldFont); SelectObject (hdc, hOldFont);
...@@ -1374,12 +1389,12 @@ TAB_InsertItem (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -1374,12 +1389,12 @@ TAB_InsertItem (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (pti->mask & TCIF_PARAM) if (pti->mask & TCIF_PARAM)
infoPtr->items[iItem].lParam = pti->lParam; infoPtr->items[iItem].lParam = pti->lParam;
TAB_SetItemBounds(hwnd);
TAB_InvalidateTabArea(hwnd, infoPtr); TAB_InvalidateTabArea(hwnd, infoPtr);
TRACE("[%04x]: added item %d '%s'\n", TRACE("[%04x]: added item %d '%s'\n",
hwnd, iItem, infoPtr->items[iItem].pszText); hwnd, iItem, infoPtr->items[iItem].pszText);
TAB_SetItemBounds(hwnd);
return iItem; return iItem;
} }
...@@ -1657,7 +1672,7 @@ TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -1657,7 +1672,7 @@ TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->items = 0; infoPtr->items = 0;
infoPtr->hcurArrow = LoadCursorA (0, IDC_ARROWA); infoPtr->hcurArrow = LoadCursorA (0, IDC_ARROWA);
infoPtr->iSelected = -1; infoPtr->iSelected = -1;
infoPtr->uFocus = 0; infoPtr->uFocus = -1;
infoPtr->hwndToolTip = 0; infoPtr->hwndToolTip = 0;
infoPtr->DoRedraw = TRUE; infoPtr->DoRedraw = TRUE;
infoPtr->needsScrolling = FALSE; infoPtr->needsScrolling = FALSE;
...@@ -1923,7 +1938,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -1923,7 +1938,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
default: default:
if (uMsg >= WM_USER) if (uMsg >= WM_USER)
ERR("unknown msg %04x wp=%08x lp=%08lx\n", WARN("unknown msg %04x wp=%08x lp=%08lx\n",
uMsg, wParam, lParam); uMsg, wParam, lParam);
return DefWindowProcA (hwnd, uMsg, wParam, lParam); return DefWindowProcA (hwnd, uMsg, wParam, lParam);
} }
......
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