summaryrefslogtreecommitdiff
path: root/src/interface/Button.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-04 19:55:59 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-04 19:55:59 (GMT)
commit5a2da01a5b1d59bae3d1f00132230835e6803301 (patch)
treea580fe32daa8bac4acb002d32f51552a00c30e72 /src/interface/Button.cpp
parent82d2bcc7c2fe7ae5ba40b915ce22422a36d68639 (diff)
downloadpowder-5a2da01a5b1d59bae3d1f00132230835e6803301.zip
powder-5a2da01a5b1d59bae3d1f00132230835e6803301.tar.gz
Tags, fixes #55
Diffstat (limited to 'src/interface/Button.cpp')
-rw-r--r--src/interface/Button.cpp39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/interface/Button.cpp b/src/interface/Button.cpp
index 996c02f..a9b0606 100644
--- a/src/interface/Button.cpp
+++ b/src/interface/Button.cpp
@@ -86,32 +86,45 @@ void Button::Draw(const Point& screenPos)
Graphics * g = ui::Engine::Ref().g;
Point Position = screenPos;
ui::Colour bgColour(0, 0, 0);
+
+ ui::Colour textColour = Appearance.TextInactive;
+ ui::Colour borderColour = Appearance.BorderInactive;
+ ui::Colour backgroundColour = Appearance.BackgroundInactive;
+
if(Enabled)
{
if(isButtonDown || (isTogglable && toggle))
{
- bgColour = Appearance.BackgroundActive;
- g->fillrect(Position.X+1, Position.Y+1, Size.X-2, Size.Y-2, Appearance.BackgroundActive.Red, Appearance.BackgroundActive.Green, Appearance.BackgroundActive.Blue, 255);
- g->drawrect(Position.X, Position.Y, Size.X, Size.Y, Appearance.BorderActive.Red, Appearance.BorderActive.Green, Appearance.BorderActive.Blue, 255);
- g->drawtext(Position.X+textPosition.X, Position.Y+textPosition.Y, buttonDisplayText, Appearance.TextActive.Red, Appearance.TextActive.Green, Appearance.TextActive.Blue, 255);
+ textColour = Appearance.TextActive;
+ borderColour = Appearance.BorderActive;
+ backgroundColour = Appearance.BackgroundActive;
+ }
+ else if (isMouseInside)
+ {
+ textColour = Appearance.TextHover;
+ borderColour = Appearance.BorderHover;
+ backgroundColour = Appearance.BackgroundHover;
}
else
{
- bgColour = Appearance.BackgroundInactive;
- g->fillrect(Position.X+1, Position.Y+1, Size.X-2, Size.Y-2, Appearance.BackgroundInactive.Red, Appearance.BackgroundInactive.Green, Appearance.BackgroundInactive.Blue, 255);
- g->drawrect(Position.X, Position.Y, Size.X, Size.Y, Appearance.BorderInactive.Red, Appearance.BorderInactive.Green, Appearance.BorderInactive.Blue, 255);
- g->drawtext(Position.X+textPosition.X, Position.Y+textPosition.Y, buttonDisplayText, Appearance.TextInactive.Red, Appearance.TextInactive.Green, Appearance.TextInactive.Blue, 255);
+ textColour = Appearance.TextInactive;
+ borderColour = Appearance.BorderInactive;
+ backgroundColour = Appearance.BackgroundInactive;
}
}
else
{
- bgColour = Appearance.BackgroundInactive;
- g->fillrect(Position.X+1, Position.Y+1, Size.X-2, Size.Y-2, Appearance.BackgroundInactive.Red, Appearance.BackgroundInactive.Green, Appearance.BackgroundInactive.Blue, 180);
- g->drawrect(Position.X, Position.Y, Size.X, Size.Y, Appearance.BackgroundDisabled.Red, Appearance.BackgroundDisabled.Green, Appearance.BackgroundDisabled.Blue, Appearance.BackgroundDisabled.Alpha);
- g->drawtext(Position.X+textPosition.X, Position.Y+textPosition.Y, buttonDisplayText, 180, 180, 180, 255);
+ textColour = Appearance.TextDisabled;
+ borderColour = Appearance.BorderDisabled;
+ backgroundColour = Appearance.BackgroundDisabled;
}
- bool iconInvert = (bgColour.Blue + (3*bgColour.Green) + (2*bgColour.Red))>544?true:false;
+ bgColour = Appearance.BackgroundInactive;
+ g->fillrect(Position.X+1, Position.Y+1, Size.X-2, Size.Y-2, backgroundColour.Red, backgroundColour.Green, backgroundColour.Blue, backgroundColour.Alpha);
+ g->drawrect(Position.X, Position.Y, Size.X, Size.Y, borderColour.Red, borderColour.Green, borderColour.Blue, borderColour.Alpha);
+ g->drawtext(Position.X+textPosition.X, Position.Y+textPosition.Y, buttonDisplayText, textColour.Red, textColour.Green, textColour.Blue, textColour.Alpha);
+
+ bool iconInvert = (backgroundColour.Blue + (3*backgroundColour.Green) + (2*backgroundColour.Red))>544?true:false;
if(Appearance.icon)
{