Sync with Wine-20040213:

Vitaliy Margolen <wine-patch@kievinfo.com>
- Fix handling of TCS_RAGGEDRIGHT style.
- Clip UpDown control only if it is present.
- Add ToDos.

svn path=/trunk/; revision=8233
This commit is contained in:
Gé van Geldorp 2004-02-17 22:38:03 +00:00
parent d8aa2b9e91
commit df3569b50b

View file

@ -21,9 +21,18 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* TODO: * TODO:
* Image list support
* Unicode support (under construction) * Unicode support (under construction)
* *
* Styles:
* TCIF_RTLREADING
*
* Messages:
* TCM_SETITEMEXTRA
* TCM_REMOVEIMAGE
* TCM_DESELECTALL
* TCM_GETEXTENDEDSTYLE
* TCM_SETEXTENDEDSTYLE
*
* FIXME: * FIXME:
* UpDown control not displayed until after a tab is clicked on * UpDown control not displayed until after a tab is clicked on
*/ */
@ -652,9 +661,13 @@ TAB_DrawLoneItemInterior(HWND hwnd, TAB_INFO* infoPtr, int iItem)
HDC hdc = GetDC(hwnd); HDC hdc = GetDC(hwnd);
RECT r, rC; RECT r, rC;
GetWindowRect(hwnd, &rC); /* Clip UpDown control to not draw over it */
GetWindowRect(infoPtr->hwndUpDown, &r); if (infoPtr->needsScrolling)
ExcludeClipRect(hdc, r.left - rC.left, r.top - rC.top, r.right - rC.left, r.bottom - rC.top); {
GetWindowRect(hwnd, &rC);
GetWindowRect(infoPtr->hwndUpDown, &r);
ExcludeClipRect(hdc, r.left - rC.left, r.top - rC.top, r.right - rC.left, r.bottom - rC.top);
}
TAB_DrawItemInterior(hwnd, hdc, iItem, NULL); TAB_DrawItemInterior(hwnd, hdc, iItem, NULL);
ReleaseDC(hwnd, hdc); ReleaseDC(hwnd, hdc);
} }
@ -1188,8 +1201,7 @@ static void TAB_SetItemBounds (HWND hwnd)
* Check if this is a multiline tab control and if so * Check if this is a multiline tab control and if so
* check to see if we should wrap the tabs * check to see if we should wrap the tabs
* *
* Because we are going to arange all these tabs evenly * Wrap all these tabs. We will arange them evenly later.
* really we are basically just counting rows at this point
* *
*/ */
@ -1242,19 +1254,26 @@ static void TAB_SetItemBounds (HWND hwnd)
/* Don't need scrolling, then update infoPtr->leftmostVisible */ /* Don't need scrolling, then update infoPtr->leftmostVisible */
if(!infoPtr->needsScrolling) if(!infoPtr->needsScrolling)
infoPtr->leftmostVisible = 0; infoPtr->leftmostVisible = 0;
TAB_SetupScrolling(hwnd, infoPtr, &clientRect);
} }
else
{
/*
* No scrolling in Multiline or Vertical styles.
*/
infoPtr->needsScrolling = FALSE;
infoPtr->leftmostVisible = 0;
}
TAB_SetupScrolling(hwnd, infoPtr, &clientRect);
/* Set the number of rows */ /* Set the number of rows */
infoPtr->uNumRows = curItemRowCount; infoPtr->uNumRows = curItemRowCount;
if (((lStyle & TCS_MULTILINE) || (lStyle & TCS_VERTICAL)) && (infoPtr->uNumItem > 0)) /* Arange all tabs evenly if style says so */
if (!(lStyle & TCS_RAGGEDRIGHT) && ((lStyle & TCS_MULTILINE) || (lStyle & TCS_VERTICAL)) && (infoPtr->uNumItem > 0))
{ {
INT widthDiff, remainder;
INT tabPerRow,remTab; INT tabPerRow,remTab;
INT iRow,iItm; INT iRow,iItm;
INT iIndexStart=0,iIndexEnd=0, iCount=0; INT iCount=0;
/* /*
* Ok windows tries to even out the rows. place the same * Ok windows tries to even out the rows. place the same
@ -1335,66 +1354,68 @@ static void TAB_SetItemBounds (HWND hwnd)
* Justify the rows * Justify the rows
*/ */
{ {
while(iIndexStart < infoPtr->uNumItem) INT widthDiff, iIndexStart=0, iIndexEnd=0;
INT remainder;
INT iCount=0;
while(iIndexStart < infoPtr->uNumItem)
{ {
/* /*
* find the indexs of the row * find the indexs of the row
*/ */
/* find the first item on the next row */ /* find the first item on the next row */
for (iIndexEnd=iIndexStart; for (iIndexEnd=iIndexStart;
(iIndexEnd < infoPtr->uNumItem) && (iIndexEnd < infoPtr->uNumItem) &&
(infoPtr->items[iIndexEnd].rect.top == (infoPtr->items[iIndexEnd].rect.top ==
infoPtr->items[iIndexStart].rect.top) ; infoPtr->items[iIndexStart].rect.top) ;
iIndexEnd++) iIndexEnd++)
/* intentionally blank */; /* intentionally blank */;
/* /*
* we need to justify these tabs so they fill the whole given * we need to justify these tabs so they fill the whole given
* client area * client area
* *
*/ */
/* find the amount of space remaining on this row */ /* find the amount of space remaining on this row */
widthDiff = clientRect.right - (2 * SELECTED_TAB_OFFSET) - widthDiff = clientRect.right - (2 * SELECTED_TAB_OFFSET) -
infoPtr->items[iIndexEnd - 1].rect.right; infoPtr->items[iIndexEnd - 1].rect.right;
/* iCount is the number of tab items on this row */ /* iCount is the number of tab items on this row */
iCount = iIndexEnd - iIndexStart; iCount = iIndexEnd - iIndexStart;
if (iCount > 1)
if (iCount > 1) {
{ remainder = widthDiff % iCount;
remainder = widthDiff % iCount; widthDiff = widthDiff / iCount;
widthDiff = widthDiff / iCount; /* add widthDiff/iCount, or extra space/items on row, to each item on this row */
/* add widthDiff/iCount, or extra space/items on row, to each item on this row */ for (iIndex=iIndexStart, iCount=0; iIndex < iIndexEnd; iIndex++, iCount++)
for (iIndex=iIndexStart,iCount=0; iIndex < iIndexEnd; {
iIndex++,iCount++) infoPtr->items[iIndex].rect.left += iCount * widthDiff;
{ infoPtr->items[iIndex].rect.right += (iCount + 1) * widthDiff;
infoPtr->items[iIndex].rect.left += iCount * widthDiff;
infoPtr->items[iIndex].rect.right += (iCount + 1) * widthDiff;
TRACE("adjusting 1 <%s>, l,r=%ld,%ld\n", TRACE("adjusting 1 <%s>, l,r=%ld,%ld\n",
debugstr_w(infoPtr->items[iIndex].pszText), debugstr_w(infoPtr->items[iIndex].pszText),
infoPtr->items[iIndex].rect.left, infoPtr->items[iIndex].rect.left,
infoPtr->items[iIndex].rect.right); infoPtr->items[iIndex].rect.right);
} }
infoPtr->items[iIndex - 1].rect.right += remainder; infoPtr->items[iIndex - 1].rect.right += remainder;
} }
else /* we have only one item on this row, make it take up the entire row */ else /* we have only one item on this row, make it take up the entire row */
{ {
infoPtr->items[iIndexStart].rect.left = clientRect.left; infoPtr->items[iIndexStart].rect.left = clientRect.left;
infoPtr->items[iIndexStart].rect.right = clientRect.right - 4; infoPtr->items[iIndexStart].rect.right = clientRect.right - 4;
TRACE("adjusting 2 <%s>, l,r=%ld,%ld\n", TRACE("adjusting 2 <%s>, l,r=%ld,%ld\n",
debugstr_w(infoPtr->items[iIndexStart].pszText), debugstr_w(infoPtr->items[iIndexStart].pszText),
infoPtr->items[iIndexStart].rect.left, infoPtr->items[iIndexStart].rect.left,
infoPtr->items[iIndexStart].rect.right); infoPtr->items[iIndexStart].rect.right);
} }
iIndexStart = iIndexEnd; iIndexStart = iIndexEnd;
} }
} }
} }
@ -1865,9 +1886,12 @@ static void TAB_DrawItem(
RECT rUD, rC; RECT rUD, rC;
/* Clip UpDown control to not draw over it */ /* Clip UpDown control to not draw over it */
GetWindowRect(hwnd, &rC); if (infoPtr->needsScrolling)
GetWindowRect(infoPtr->hwndUpDown, &rUD); {
ExcludeClipRect(hdc, rUD.left - rC.left, rUD.top - rC.top, rUD.right - rC.left, rUD.bottom - rC.top); GetWindowRect(hwnd, &rC);
GetWindowRect(infoPtr->hwndUpDown, &rUD);
ExcludeClipRect(hdc, rUD.left - rC.left, rUD.top - rC.top, rUD.right - rC.left, rUD.bottom - rC.top);
}
/* If you need to see what the control is doing, /* If you need to see what the control is doing,
* then override these variables. They will change what * then override these variables. They will change what