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

Introjucer: colours and refactoring.

This commit is contained in:
jules 2012-07-10 12:08:35 +01:00
parent 6fe9e2db73
commit 44e454f0b7
25 changed files with 368 additions and 340 deletions

View file

@ -49,7 +49,7 @@ Font JucerTreeViewBase::getFont() const
void JucerTreeViewBase::paintItem (Graphics& g, int width, int height)
{
if (isSelected())
g.fillAll (Colour (0x401111ee));
g.fillAll (getOwnerView()->findColour (treeviewHighlightColourId));
}
float JucerTreeViewBase::getIconSize() const
@ -66,14 +66,35 @@ void JucerTreeViewBase::paintOpenCloseButton (Graphics& g, int width, int height
else
p.addTriangle (width * 0.25f, height * 0.25f, width * 0.8f, height * 0.5f, width * 0.25f, height * 0.75f);
g.setColour (Colours::lightgrey);
g.setColour (getContrastingColour (0.3f));
g.fillPath (p);
}
Colour JucerTreeViewBase::getBackgroundColour() const
{
Colour background (getOwnerView()->findColour (projectPanelBackgroundColourId));
if (isSelected())
background = background.overlaidWith (getOwnerView()->findColour (treeviewHighlightColourId));
return background;
}
Colour JucerTreeViewBase::getContrastingColour (float contrast) const
{
return getBackgroundColour().contrasting (contrast);
}
Colour JucerTreeViewBase::getContrastingColour (const Colour& target, float minContrast) const
{
return getBackgroundColour().contrasting (target, minContrast);
}
void JucerTreeViewBase::paintContent (Graphics& g, const Rectangle<int>& area)
{
g.setFont (getFont());
g.setColour (isMissing() ? Colours::red : Colours::black);
g.setColour (isMissing() ? getContrastingColour (Colours::red, 0.8f)
: getContrastingColour (0.8f));
g.drawFittedText (getDisplayName(),
area.getX(), area.getY(), area.getWidth(), area.getHeight(),