Skip to content

Commit b609540

Browse files
committed
gui: enhance SimpleButton
1 parent 3b39ac4 commit b609540

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

src/dmt/gui/widget/SimpleButton.h

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ class SimpleButton
5252
using Colour = juce::Colour;
5353
using Image = juce::Image;
5454

55+
const Colour& backgroundColour = Settings::Display::backgroundColour;
56+
5557
public:
5658
SimpleButton(String _name, String _displayString, String _tooltip = "")
5759
: juce::Button(_name)
@@ -81,16 +83,24 @@ class SimpleButton
8183
bool isMouseOverButton,
8284
bool isButtonDown) override
8385
{
86+
87+
const float borderThickness = 1.0f * size;
88+
const float borderRadius = 3.0f * size;
89+
const auto outerBounds = getLocalBounds().toFloat();
90+
const auto innerBounds = outerBounds.reduced(borderThickness);
91+
8492
if (isButtonDown) {
85-
g.fillAll(juce::Colours::magenta);
86-
return;
87-
}
88-
if (isActive) {
89-
g.fillAll(juce::Colours::green);
90-
return;
93+
g.setColour(juce::Colours::white);
94+
g.fillRect(innerBounds);
95+
} else if (isActive) {
96+
g.fillAll(juce::Colours::white);
97+
} else {
98+
g.fillAll(backgroundColour);
99+
g.setColour(juce::Colours::white);
100+
g.drawRect(outerBounds, borderThickness);
91101
}
92102

93-
g.fillAll(juce::Colours::yellow);
103+
g.fillAll(juce::Colours::red);
94104
}
95105

96106
//==============================================================================

0 commit comments

Comments
 (0)