summaryrefslogtreecommitdiff
path: root/plugingui/powerbutton.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2018-06-07 23:30:40 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2018-06-07 23:30:40 +0200
commit7c50c15ede76869489a94503fa22028180f41cff (patch)
tree26c15ebec97f3ab16168b7d2b1be5452bab6c897 /plugingui/powerbutton.cc
parent887dde747142ed340c3608e98a36b5e0d88c5d93 (diff)
Add disabled visualization to powerbutton.
Diffstat (limited to 'plugingui/powerbutton.cc')
-rw-r--r--plugingui/powerbutton.cc32
1 files changed, 26 insertions, 6 deletions
diff --git a/plugingui/powerbutton.cc b/plugingui/powerbutton.cc
index a91524f..36edc35 100644
--- a/plugingui/powerbutton.cc
+++ b/plugingui/powerbutton.cc
@@ -35,31 +35,51 @@ PowerButton::PowerButton(Widget* parent) : Toggle(parent)
{
}
+void PowerButton::setEnabled(bool enabled)
+{
+ this->enabled = enabled;
+}
+
void PowerButton::repaintEvent(RepaintEvent* repaintEvent)
{
Painter p(*this);
- if(state)
+ // disabled
+ if(!enabled)
{
if(clicked)
{
- p.drawImage(0, 0, on_clicked);
+ p.drawImage(0, 0, disabled_clicked);
}
else
{
- p.drawImage(0, 0, on);
+ p.drawImage(0, 0, disabled);
}
+ return;
}
- else
+
+ // enabled and on
+ if(state)
{
if(clicked)
{
- p.drawImage(0, 0, off_clicked);
+ p.drawImage(0, 0, on_clicked);
}
else
{
- p.drawImage(0, 0, off);
+ p.drawImage(0, 0, on);
}
+ return;
+ }
+
+ // enabled and off
+ if(clicked)
+ {
+ p.drawImage(0, 0, off_clicked);
+ }
+ else
+ {
+ p.drawImage(0, 0, off);
}
}