Browse Source

Added some extra Label colour IDs to allow control over the text editor colours while it's being edited.

tags/2021-05-28
jules 11 years ago
parent
commit
1b7c4ea6a4
2 changed files with 17 additions and 4 deletions
  1. +10
    -0
      modules/juce_gui_basics/widgets/juce_Label.cpp
  2. +7
    -4
      modules/juce_gui_basics/widgets/juce_Label.h

+ 10
- 0
modules/juce_gui_basics/widgets/juce_Label.cpp View File

@@ -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;
}


+ 7
- 4
modules/juce_gui_basics/widgets/juce_Label.h View File

@@ -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. */
};
//==============================================================================


Loading…
Cancel
Save