2013-08-09 19:01:51 +03:00
|
|
|
// Various authors.
|
|
|
|
// License: GPL version 2 or later.
|
|
|
|
|
|
|
|
#include "background.h"
|
|
|
|
|
|
|
|
#include "gmenu2x.h"
|
|
|
|
|
|
|
|
|
2014-08-10 05:26:59 +03:00
|
|
|
Background::Background(GMenu2X& gmenu2x)
|
2013-08-09 19:01:51 +03:00
|
|
|
: gmenu2x(gmenu2x)
|
|
|
|
, battery(gmenu2x.sc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-08-10 05:26:59 +03:00
|
|
|
void Background::paint(Surface& s) {
|
2013-08-09 19:01:51 +03:00
|
|
|
Font &font = *gmenu2x.font;
|
|
|
|
SurfaceCollection &sc = gmenu2x.sc;
|
|
|
|
|
2014-08-10 05:26:59 +03:00
|
|
|
sc["bgmain"]->blit(s, 0, 0);
|
2013-08-09 19:01:51 +03:00
|
|
|
|
2014-08-10 05:26:59 +03:00
|
|
|
font.write(s, clock.getTime(),
|
2013-08-09 19:01:51 +03:00
|
|
|
s.width() / 2, gmenu2x.bottomBarTextY,
|
|
|
|
Font::HAlignCenter, Font::VAlignMiddle);
|
|
|
|
|
2014-08-10 05:26:59 +03:00
|
|
|
battery.getIcon().blit(s, s.width() - 19, gmenu2x.bottomBarIconY);
|
2013-08-09 19:01:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Background::handleButtonPress(InputManager::Button button) {
|
|
|
|
switch (button) {
|
|
|
|
case InputManager::CANCEL:
|
|
|
|
gmenu2x.showHelpPopup();
|
|
|
|
return true;
|
|
|
|
case InputManager::SETTINGS:
|
|
|
|
gmenu2x.showSettings();
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-10 05:26:59 +03:00
|
|
|
bool Background::handleTouchscreen(Touchscreen&) {
|
2013-08-09 19:01:51 +03:00
|
|
|
return false;
|
|
|
|
}
|