summaryrefslogtreecommitdiff
path: root/plugingui/powerbutton.cc
diff options
context:
space:
mode:
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);
}
}