Browse Source

Added colour IDs for ToggleButton tick colour

tags/2021-05-28
jules 9 years ago
parent
commit
3d1cf531e0
2 changed files with 8 additions and 3 deletions
  1. +3
    -1
      modules/juce_gui_basics/buttons/juce_ToggleButton.h
  2. +5
    -2
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp

+ 3
- 1
modules/juce_gui_basics/buttons/juce_ToggleButton.h View File

@@ -69,7 +69,9 @@ public:
*/ */
enum ColourIds enum ColourIds
{ {
textColourId = 0x1006501 /**< The colour to use for the button's text. */
textColourId = 0x1006501, /**< The colour to use for the button's text. */
tickColourId = 0x1006502, /**< The colour to use for the tick mark. */
tickDisabledColourId = 0x1006503 /**< The colour to use for the disabled tick mark. */
}; };
protected: protected:


+ 5
- 2
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp View File

@@ -69,6 +69,8 @@ LookAndFeel_V2::LookAndFeel_V2()
TextButton::textColourOffId, 0xff000000, TextButton::textColourOffId, 0xff000000,
ToggleButton::textColourId, 0xff000000, ToggleButton::textColourId, 0xff000000,
ToggleButton::tickColourId, 0xff000000,
ToggleButton::tickDisabledColourId, 0xff808080,
TextEditor::backgroundColourId, 0xffffffff, TextEditor::backgroundColourId, 0xffffffff,
TextEditor::textColourId, 0xff000000, TextEditor::textColourId, 0xff000000,
@@ -295,10 +297,11 @@ void LookAndFeel_V2::drawTickBox (Graphics& g, Component& component,
tick.lineTo (3.0f, 6.0f); tick.lineTo (3.0f, 6.0f);
tick.lineTo (6.0f, 0.0f); tick.lineTo (6.0f, 0.0f);
g.setColour (isEnabled ? Colours::black : Colours::grey);
g.setColour (component.findColour (isEnabled ? ToggleButton::tickColourId
: ToggleButton::tickDisabledColourId));
const AffineTransform trans (AffineTransform::scale (w / 9.0f, h / 9.0f) const AffineTransform trans (AffineTransform::scale (w / 9.0f, h / 9.0f)
.translated (x, y));
.translated (x, y));
g.strokePath (tick, PathStrokeType (2.5f), trans); g.strokePath (tick, PathStrokeType (2.5f), trans);
} }


Loading…
Cancel
Save