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

Added a colour ID TreeView::selectedItemBackgroundColourId, and changed the TreeView to fill selected items with this. (The colour is set to transparent by default so this won't affect existing code).

Updated the LookAndFeel::drawTreeviewPlusMinusBox and TreeViewItem::paintOpenCloseButton methods to provide more flexibility.
This commit is contained in:
jules 2013-10-27 12:49:17 +00:00
parent 020f138d20
commit 56ec1d1400
10 changed files with 71 additions and 57 deletions

View file

@ -84,28 +84,14 @@ Font JucerTreeViewBase::getFont() const
return Font (getItemHeight() * 0.6f);
}
void JucerTreeViewBase::paintItem (Graphics& g, int /*width*/, int /*height*/)
{
if (isSelected())
g.fillAll (getOwnerView()->findColour (treeviewHighlightColourId));
}
float JucerTreeViewBase::getIconSize() const
{
return jmin (getItemHeight() - 4.0f, 18.0f);
}
void JucerTreeViewBase::paintOpenCloseButton (Graphics& g, int width, int height, bool /*isMouseOver*/)
void JucerTreeViewBase::paintOpenCloseButton (Graphics& g, const Rectangle<float>& area, Colour /*backgroundColour*/, bool isMouseOver)
{
Path p;
if (isOpen())
p.addTriangle (width * 0.2f, height * 0.25f, width * 0.8f, height * 0.25f, width * 0.5f, height * 0.75f);
else
p.addTriangle (width * 0.25f, height * 0.25f, width * 0.8f, height * 0.5f, width * 0.25f, height * 0.75f);
g.setColour (getOwnerView()->findColour (mainBackgroundColourId).contrasting (0.3f));
g.fillPath (p);
TreeViewItem::paintOpenCloseButton (g, area, getOwnerView()->findColour (mainBackgroundColourId), isMouseOver);
}
Colour JucerTreeViewBase::getBackgroundColour() const
@ -113,7 +99,7 @@ Colour JucerTreeViewBase::getBackgroundColour() const
Colour background (getOwnerView()->findColour (mainBackgroundColourId));
if (isSelected())
background = background.overlaidWith (getOwnerView()->findColour (treeviewHighlightColourId));
background = background.overlaidWith (getOwnerView()->findColour (TreeView::selectedItemBackgroundColourId));
return background;
}