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;
/* Clip UpDown control to not draw over it */
if (infoPtr->needsScrolling)
{
GetWindowRect(hwnd, &rC); GetWindowRect(hwnd, &rC);
GetWindowRect(infoPtr->hwndUpDown, &r); GetWindowRect(infoPtr->hwndUpDown, &r);
ExcludeClipRect(hdc, r.left - rC.left, r.top - rC.top, r.right - rC.left, r.bottom - rC.top); 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,6 +1354,10 @@ static void TAB_SetItemBounds (HWND hwnd)
* Justify the rows * Justify the rows
*/ */
{ {
INT widthDiff, iIndexStart=0, iIndexEnd=0;
INT remainder;
INT iCount=0;
while(iIndexStart < infoPtr->uNumItem) while(iIndexStart < infoPtr->uNumItem)
{ {
/* /*
@ -1360,14 +1383,12 @@ static void TAB_SetItemBounds (HWND hwnd)
/* 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; for (iIndex=iIndexStart, iCount=0; iIndex < iIndexEnd; iIndex++, iCount++)
iIndex++,iCount++)
{ {
infoPtr->items[iIndex].rect.left += iCount * widthDiff; infoPtr->items[iIndex].rect.left += iCount * widthDiff;
infoPtr->items[iIndex].rect.right += (iCount + 1) * widthDiff; infoPtr->items[iIndex].rect.right += (iCount + 1) * widthDiff;
@ -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 */
if (infoPtr->needsScrolling)
{
GetWindowRect(hwnd, &rC); GetWindowRect(hwnd, &rC);
GetWindowRect(infoPtr->hwndUpDown, &rUD); GetWindowRect(infoPtr->hwndUpDown, &rUD);
ExcludeClipRect(hdc, rUD.left - rC.left, rUD.top - rC.top, rUD.right - rC.left, rUD.bottom - rC.top); 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