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

Made Label take its editing colours from the L+F.

This commit is contained in:
jules 2014-07-31 10:54:45 +01:00
parent bdeb0765ea
commit fdf6f12185

View file

@ -289,20 +289,21 @@ bool Label::isBeingEdited() const noexcept
return editor != nullptr;
}
static void copyColourIfSpecified (Label& l, TextEditor& ed, int colourID, int targetColourID)
{
if (l.isColourSpecified (colourID) || l.getLookAndFeel().isColourSpecified (colourID))
ed.setColour (targetColourID, l.findColour (colourID));
}
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));
copyColourIfSpecified (*this, *ed, textWhenEditingColourId, TextEditor::textColourId);
copyColourIfSpecified (*this, *ed, backgroundWhenEditingColourId, TextEditor::backgroundColourId);
copyColourIfSpecified (*this, *ed, outlineWhenEditingColourId, TextEditor::outlineColourId);
return ed;
}