From 1b7c4ea6a449c675d60d23d39d765109bc5df99f Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 28 Jul 2014 22:09:00 +0100 Subject: [PATCH] Added some extra Label colour IDs to allow control over the text editor colours while it's being edited. --- modules/juce_gui_basics/widgets/juce_Label.cpp | 10 ++++++++++ modules/juce_gui_basics/widgets/juce_Label.h | 11 +++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/modules/juce_gui_basics/widgets/juce_Label.cpp b/modules/juce_gui_basics/widgets/juce_Label.cpp index 727aacfb8e..542f71896d 100644 --- a/modules/juce_gui_basics/widgets/juce_Label.cpp +++ b/modules/juce_gui_basics/widgets/juce_Label.cpp @@ -294,6 +294,16 @@ TextEditor* Label::createEditorComponent() TextEditor* const ed = new TextEditor (getName()); ed->applyFontToAllText (getLookAndFeel().getLabelFont (*this)); copyAllExplicitColoursTo (*ed); + + if (isColourSpecified (textWhenEditingColourId)) + ed->setColour (TextEditor::textColourId, findColour (textWhenEditingColourId)); + + if (isColourSpecified (backgroundWhenEditingColourId)) + ed->setColour (TextEditor::backgroundColourId, findColour (backgroundWhenEditingColourId)); + + if (isColourSpecified (outlineWhenEditingColourId)) + ed->setColour (TextEditor::outlineColourId, findColour (outlineWhenEditingColourId)); + return ed; } diff --git a/modules/juce_gui_basics/widgets/juce_Label.h b/modules/juce_gui_basics/widgets/juce_Label.h index a0e2f80c39..e47fb681e6 100644 --- a/modules/juce_gui_basics/widgets/juce_Label.h +++ b/modules/juce_gui_basics/widgets/juce_Label.h @@ -101,10 +101,13 @@ public: */ enum ColourIds { - backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */ - textColourId = 0x1000281, /**< The colour for the text. */ - outlineColourId = 0x1000282 /**< An optional colour to use to draw a border around the label. - Leave this transparent to not have an outline. */ + backgroundColourId = 0x1000280, /**< The background colour to fill the label with. */ + textColourId = 0x1000281, /**< The colour for the text. */ + outlineColourId = 0x1000282, /**< An optional colour to use to draw a border around the label. + Leave this transparent to not have an outline. */ + backgroundWhenEditingColourId = 0x1000283, /**< The background colour when the label is being edited. */ + textWhenEditingColourId = 0x1000284, /**< The colour for the text when the label is being edited. */ + outlineWhenEditingColourId = 0x1000285 /**< An optional border colour when the label is being edited. */ }; //==============================================================================