1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Add optional setDrawsInRightMargin to disable clipping of right edge of TreeViewItems

This commit is contained in:
hogliux 2015-07-20 15:05:58 +01:00
parent a595f19d0f
commit 5265bbf81e
2 changed files with 21 additions and 2 deletions

View file

@ -1150,6 +1150,7 @@ TreeViewItem::TreeViewItem()
drawLinesInside (false),
drawLinesSet (false),
drawsInLeftMargin (false),
drawsInRightMargin (false),
openness (opennessDefault)
{
static int nextUID = 0;
@ -1505,6 +1506,11 @@ void TreeViewItem::setDrawsInLeftMargin (bool canDrawInLeftMargin) noexcept
drawsInLeftMargin = canDrawInLeftMargin;
}
void TreeViewItem::setDrawsInRightMargin (bool canDrawInRightMargin) noexcept
{
drawsInRightMargin = canDrawInRightMargin;
}
namespace TreeViewHelpers
{
static int calculateDepth (const TreeViewItem* item, const bool rootIsVisible) noexcept
@ -1532,7 +1538,7 @@ void TreeViewItem::paintRecursively (Graphics& g, int width)
return;
const int indent = getIndentX();
const int itemW = itemWidth < 0 ? width - indent : itemWidth;
const int itemW = (itemWidth < 0 || drawsInRightMargin) ? width - indent : itemWidth;
{
Graphics::ScopedSaveState ss (g);
@ -1544,7 +1550,7 @@ void TreeViewItem::paintRecursively (Graphics& g, int width)
if (isSelected())
g.fillAll (ownerView->findColour (TreeView::selectedItemBackgroundColourId));
paintItem (g, itemW, itemHeight);
paintItem (g, itemWidth < 0 ? width - indent : itemWidth, itemHeight);
}
}