mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Moved DrawableButton painting into a new method LookAndFeel::drawDrawableButton()
This commit is contained in:
parent
74390295ad
commit
cfe45720cc
4 changed files with 42 additions and 29 deletions
|
|
@ -447,6 +447,33 @@ void LookAndFeel::changeToggleButtonWidthToFitText (ToggleButton& button)
|
|||
button.getHeight());
|
||||
}
|
||||
|
||||
void LookAndFeel::drawDrawableButton (Graphics& g, DrawableButton& button,
|
||||
bool /*isMouseOverButton*/, bool /*isButtonDown*/)
|
||||
{
|
||||
bool toggleState = button.getToggleState();
|
||||
|
||||
g.fillAll (button.findColour (toggleState ? DrawableButton::backgroundOnColourId
|
||||
: DrawableButton::backgroundColourId));
|
||||
|
||||
const int textH = (button.getStyle() == DrawableButton::ImageAboveTextLabel)
|
||||
? jmin (16, button.proportionOfHeight (0.25f))
|
||||
: 0;
|
||||
|
||||
if (textH > 0)
|
||||
{
|
||||
g.setFont ((float) textH);
|
||||
|
||||
g.setColour (button.findColour (toggleState ? DrawableButton::textColourOnId
|
||||
: DrawableButton::textColourId)
|
||||
.withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.4f));
|
||||
|
||||
g.drawFittedText (button.getButtonText(),
|
||||
2, button.getHeight() - textH - 1,
|
||||
button.getWidth() - 4, textH,
|
||||
Justification::centred, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
AlertWindow* LookAndFeel::createAlertWindow (const String& title,
|
||||
const String& message,
|
||||
|
|
|
|||
|
|
@ -182,6 +182,11 @@ public:
|
|||
bool isMouseOverButton,
|
||||
bool isButtonDown);
|
||||
|
||||
virtual void drawDrawableButton (Graphics& g,
|
||||
DrawableButton& button,
|
||||
bool isMouseOverButton,
|
||||
bool isButtonDown);
|
||||
|
||||
//==============================================================================
|
||||
// AlertWindow handling..
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue