Added support for vertical dividers.

This commit is contained in:
hyatt%netscape.com 1998-12-04 22:15:47 +00:00
Родитель 6d6a1940ba
Коммит 0dab208fd2
2 изменённых файлов: 21 добавлений и 3 удалений

Просмотреть файл

@ -76,13 +76,18 @@ void nsHTTreeItem::GetItemStyle(nsIDeviceContext* dc, nsTreeItemStyleInfo& style
styleInfo.showIcon = PR_TRUE;
styleInfo.leftJustifyTrigger = PR_FALSE;
styleInfo.showHorizontalDivider = PR_TRUE;
styleInfo.showVerticalDivider = PR_TRUE;
styleInfo.horizontalDividerColor = NS_RGB(255,255,255);
styleInfo.verticalDividerColor = NS_RGB(255,255,255);
if (styleInfo.showTrigger)
styleInfo.pTriggerImage = GetTriggerImage();
if (styleInfo.showIcon)
styleInfo.pIconImage = GetIconImage();
styleInfo.pBackgroundImage = GetBackgroundImage();
styleInfo.pBackgroundImage = nsnull; //GetBackgroundImage();
}
nsIImage* nsHTTreeItem::GetTriggerImage() const

Просмотреть файл

@ -710,8 +710,11 @@ void nsTreeView::PaintTreeRow(nsIRenderingContext* drawCtx, nsTreeItem* pItem, i
}
// Draw the horizontal divider
drawCtx->SetColor(styleInfo.horizontalDividerColor);
drawCtx->DrawLine(0, yPosition-1, mColumnBarRect.width, yPosition-1);
if (styleInfo.showHorizontalDivider)
{
drawCtx->SetColor(styleInfo.horizontalDividerColor);
drawCtx->DrawLine(0, yPosition-1, mColumnBarRect.width, yPosition-1);
}
// Set to foreground color.
drawCtx->SetColor(styleInfo.foregroundColor);
@ -725,6 +728,8 @@ void nsTreeView::PaintTreeRow(nsIRenderingContext* drawCtx, nsTreeItem* pItem, i
nsTreeColumn* pColumn = mDataModel->GetNthColumn(n);
if (pColumn)
{
drawCtx->SetColor(styleInfo.foregroundColor); // Will be sorting highlighting eventually
// Retrieve the column's current pixel width.
int pixelWidth = pColumn->GetPixelWidth();
@ -767,6 +772,14 @@ void nsTreeView::PaintTreeRow(nsIRenderingContext* drawCtx, nsTreeItem* pItem, i
DrawCroppedString(drawCtx, nodeText, textRect);
currentPosition += pixelWidth;
// Draw the vertical divider
if (styleInfo.showVerticalDivider)
{
drawCtx->SetColor(styleInfo.verticalDividerColor);
drawCtx->DrawLine(textStart+textRect.width + 1, lineRect.y,
textStart+textRect.width + 1, lineRect.y + lineRect.height);
}
}
}
}