From a5cc0d492e47bdcba6e83e425ec2b9621e11db36 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 17 Feb 2014 17:55:15 +0000 Subject: [PATCH] Added some colour ID constants for PropertyComponent. --- .../lookandfeel/juce_LookAndFeel_V2.cpp | 17 ++++++++--------- .../properties/juce_PropertyComponent.h | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp index 408f752a7f..dc24b59de6 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp @@ -104,6 +104,9 @@ LookAndFeel_V2::LookAndFeel_V2() ComboBox::backgroundColourId, 0xffffffff, ComboBox::arrowColourId, 0x99000000, + PropertyComponent::backgroundColourId, 0x66ffffff, + PropertyComponent::labelTextColourId, 0xff000000, + TextPropertyComponent::backgroundColourId, 0xffffffff, TextPropertyComponent::textColourId, 0xff000000, TextPropertyComponent::outlineColourId, standardOutlineColour, @@ -2302,20 +2305,16 @@ void LookAndFeel_V2::drawPropertyPanelSectionHeader (Graphics& g, const String& g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true); } -void LookAndFeel_V2::drawPropertyComponentBackground (Graphics& g, int width, int height, - PropertyComponent&) +void LookAndFeel_V2::drawPropertyComponentBackground (Graphics& g, int width, int height, PropertyComponent& component) { - g.setColour (Colour (0x66ffffff)); + g.setColour (component.findColour (PropertyComponent::backgroundColourId)); g.fillRect (0, 0, width, height - 1); } -void LookAndFeel_V2::drawPropertyComponentLabel (Graphics& g, int, int height, - PropertyComponent& component) +void LookAndFeel_V2::drawPropertyComponentLabel (Graphics& g, int, int height, PropertyComponent& component) { - g.setColour (Colours::black); - - if (! component.isEnabled()) - g.setOpacity (0.6f); + g.setColour (component.findColour (PropertyComponent::labelTextColourId) + .withMultipliedAlpha (component.isEnabled() ? 1.0f : 0.6f)); g.setFont (jmin (height, 24) * 0.65f); diff --git a/modules/juce_gui_basics/properties/juce_PropertyComponent.h b/modules/juce_gui_basics/properties/juce_PropertyComponent.h index de45f3296a..2fd3d7adc4 100644 --- a/modules/juce_gui_basics/properties/juce_PropertyComponent.h +++ b/modules/juce_gui_basics/properties/juce_PropertyComponent.h @@ -102,6 +102,22 @@ public: /** By default, this just repaints the component. */ void enablementChanged() override; + //============================================================================== + /** A set of colour IDs to use to change the colour of various aspects of the combo box. + + These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() + methods. + + To change the colours of the menu that pops up + + @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour + */ + enum ColourIds + { + backgroundColourId = 0x1008300, /**< The background colour to fill the component with. */ + labelTextColourId = 0x1008301, /**< The colour for the property's label text. */ + }; + //============================================================================== /** This abstract base class is implemented by LookAndFeel classes. */ struct JUCE_API LookAndFeelMethods