diff options
author | louis <louis.braun@gmx.de> | 2013-05-31 13:58:22 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2013-05-31 13:58:22 +0200 |
commit | 4f960c48cb2d99a78ac0fa8ee1dd687fd213ef2b (patch) | |
tree | 399aebc6fa54aad39fe3e712f44aa7ec3275f783 /footer.c | |
parent | 4f93ac2516dacdec5e142aaf60a06c6e1c16daf3 (diff) | |
download | vdr-plugin-tvguide-4f960c48cb2d99a78ac0fa8ee1dd687fd213ef2b.tar.gz vdr-plugin-tvguide-4f960c48cb2d99a78ac0fa8ee1dd687fd213ef2b.tar.bz2 |
Added channel group support
Diffstat (limited to 'footer.c')
-rw-r--r-- | footer.c | 51 |
1 files changed, 36 insertions, 15 deletions
@@ -1,6 +1,8 @@ #include "footer.h"
-cFooter::cFooter() {
+cFooter::cFooter(cChannelGroups *channelGroups) {
+ this->channelGroups = channelGroups;
+ currentGroup = -1;
buttonBorder = 20;
buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeLineWidth - 5*buttonBorder)/4;
buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder;
@@ -18,6 +20,23 @@ cFooter::~cFooter(void) { osdManager.releasePixmap(footer);
}
+void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int num) {
+ tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
+ int left = num * buttonWidth + (num + 1) * buttonBorder;
+ footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor);
+ if (tvguideConfig.useBlending) {
+ cImageLoader imgLoader;
+ imgLoader.DrawBackground(theme.Color(clrButtonBlend), color, buttonWidth-4, buttonHeight-4);
+ footer->DrawImage(cPoint(left+2, buttonY+2), imgLoader.GetImage());
+ } else {
+ footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor);
+ footer->DrawRectangle(cRect(left+2, buttonY+2, buttonWidth-4, buttonHeight-4), color);
+ }
+ int textWidth = tvguideConfig.FontButton->Width(text);
+ int textHeight = tvguideConfig.FontButton->Height();
+ footer->DrawText(cPoint(left + (buttonWidth-textWidth)/2, buttonY + (buttonHeight-textHeight)/2), text, theme.Color(clrFontButtons), colorTextBack, tvguideConfig.FontButton);
+}
+
void cFooter::drawRedButton() {
cString text(tr("Set Timer"));
DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), 0);
@@ -28,29 +47,31 @@ void cFooter::drawGreenButton() { DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), 1);
}
+void cFooter::drawGreenButton(const char *text) {
+ std::string cuttedText = CutText(text, buttonWidth-6, tvguideConfig.FontButton);
+ DrawButton(cuttedText.c_str(), theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), 1);
+}
+
void cFooter::drawYellowButton() {
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward"));
DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), 2);
}
+void cFooter::drawYellowButton(const char *text) {
+ std::string cuttedText = CutText(text, buttonWidth-6, tvguideConfig.FontButton);
+ DrawButton(cuttedText.c_str(), theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), 2);
+}
+
void cFooter::drawBlueButton() {
cString text(tr("Switch to Channel"));
DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), 3);
}
-void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int num) {
- tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
- int left = num * buttonWidth + (num + 1) * buttonBorder;
- footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor);
- if (tvguideConfig.useBlending) {
- cImageLoader imgLoader;
- imgLoader.DrawBackground(theme.Color(clrButtonBlend), color, buttonWidth-4, buttonHeight-4);
- footer->DrawImage(cPoint(left+2, buttonY+2), imgLoader.GetImage());
- } else {
- footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor);
- footer->DrawRectangle(cRect(left+2, buttonY+2, buttonWidth-4, buttonHeight-4), color);
+void cFooter::UpdateGroupButtons(const cChannel *channel) {
+ int group = channelGroups->GetGroup(channel);
+ if (group != currentGroup) {
+ currentGroup = group;
+ drawGreenButton(channelGroups->GetPrev(group));
+ drawYellowButton(channelGroups->GetNext(group));
}
- int textWidth = tvguideConfig.FontButton->Width(text);
- int textHeight = tvguideConfig.FontButton->Height();
- footer->DrawText(cPoint(left + (buttonWidth-textWidth)/2, buttonY + (buttonHeight-textHeight)/2), text, theme.Color(clrFontButtons), colorTextBack, tvguideConfig.FontButton);
}
\ No newline at end of file |