From 8f3f22bb5d9d6879bb21d0132a3e0d0af4cd5380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Fri, 8 Jun 2018 01:18:02 +0200 Subject: Disable bleed control frame if drumkit doesn't support it. --- plugingui/frame.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'plugingui/frame.cc') diff --git a/plugingui/frame.cc b/plugingui/frame.cc index 81cc3c2..d552ff1 100644 --- a/plugingui/frame.cc +++ b/plugingui/frame.cc @@ -59,7 +59,7 @@ void FrameWidget::repaintEvent(RepaintEvent* repaintEvent) auto title_buf = title.c_str(); // draw the dark grey box - p.setColour(grey_box_colour); + p.setColour(enabled ? grey_box_colour : grey_box_colour_disabled); p.drawFilledRectangle(1, 1, width() - 2, bar_height); // frame @@ -76,8 +76,9 @@ void FrameWidget::repaintEvent(RepaintEvent* repaintEvent) p.drawFilledRectangle(1, bar_height, width() - 2, height() - 2); // draw the label - p.setColour(label_colour); + p.setColour(enabled ? label_colour : label_colour_disabled); p.drawText(center_x - label_width, bar_height - 4, font, title_buf); + power_button.setEnabled(enabled); } void FrameWidget::powerButtonStateChanged(bool new_state) @@ -104,6 +105,14 @@ void FrameWidget::setOnSwitch(bool on) power_button.setChecked(is_switched_on); } +void FrameWidget::setEnabled(bool enabled) +{ + this->enabled = enabled; + onEnabledChanged(enabled); + + redraw(); +} + void FrameWidget::sizeChanged(int width, int height) { if(content) -- cgit v1.2.3