From 0dab208fd20fd10b9731f3535dd5a4c866dcce9e Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Fri, 4 Dec 1998 22:15:47 +0000 Subject: [PATCH] Added support for vertical dividers. --- widget/src/xpwidgets/nsHTTreeItem.cpp | 7 ++++++- widget/src/xpwidgets/nsTreeView.cpp | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/widget/src/xpwidgets/nsHTTreeItem.cpp b/widget/src/xpwidgets/nsHTTreeItem.cpp index 2db216981d78..fae54111b6fb 100644 --- a/widget/src/xpwidgets/nsHTTreeItem.cpp +++ b/widget/src/xpwidgets/nsHTTreeItem.cpp @@ -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 diff --git a/widget/src/xpwidgets/nsTreeView.cpp b/widget/src/xpwidgets/nsTreeView.cpp index fc55d0f89da4..e533a7d26ce5 100644 --- a/widget/src/xpwidgets/nsTreeView.cpp +++ b/widget/src/xpwidgets/nsTreeView.cpp @@ -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); + } } } }