diff options
author | louis <louis.braun@gmx.de> | 2013-05-20 11:37:37 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2013-05-20 11:37:37 +0200 |
commit | c611e004582067640111ef2f023410025201157d (patch) | |
tree | 3a71e9893bffa4bf9d38c49389dad5f43d046ec3 /headergrid.c | |
parent | 063094f442c0ac3c592d2e5bb5c416d6820d2602 (diff) | |
download | vdr-plugin-tvguide-c611e004582067640111ef2f023410025201157d.tar.gz vdr-plugin-tvguide-c611e004582067640111ef2f023410025201157d.tar.bz2 |
rewrote epg grid handling and scrolling, added status header
Diffstat (limited to 'headergrid.c')
-rw-r--r-- | headergrid.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/headergrid.c b/headergrid.c new file mode 100644 index 0000000..41a95f4 --- /dev/null +++ b/headergrid.c @@ -0,0 +1,70 @@ +#include "headergrid.h"
+
+cHeaderGrid::cHeaderGrid(void) : cGrid(NULL) {
+ pixmap = NULL;
+ pixmapLogo = NULL;
+}
+
+cHeaderGrid::~cHeaderGrid(void) {
+ osdManager.releasePixmap(pixmapLogo);
+}
+
+void cHeaderGrid::createBackground(int num) {
+ color = theme.Color(clrHeader);
+ colorBlending = theme.Color(clrHeaderBlending);
+ pixmap = osdManager.requestPixmap(2, cRect( tvguideConfig.timeColWidth + num*tvguideConfig.colWidth,
+ tvguideConfig.statusHeaderHeight,
+ tvguideConfig.colWidth,
+ tvguideConfig.headerHeight)
+ , cRect::Null);
+ if (!pixmap) {
+ return;
+ }
+ pixmapLogo = osdManager.requestPixmap(3, cRect( tvguideConfig.timeColWidth + num*tvguideConfig.colWidth,
+ tvguideConfig.statusHeaderHeight,
+ tvguideConfig.colWidth,
+ tvguideConfig.headerHeight)
+ , cRect::Null);
+ if (!pixmapLogo) {
+ return;
+ }
+ pixmapLogo->Fill(clrTransparent);
+ drawBackground();
+}
+
+void cHeaderGrid::drawChannel(const cChannel *channel) {
+ cTextWrapper tw;
+ cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name());
+ tw.Set(*headerText, tvguideConfig.FontHeader, tvguideConfig.colWidth - 8);
+ int lines = tw.Lines();
+ int lineHeight = tvguideConfig.FontHeader->Height();
+ int yStart = (tvguideConfig.headerHeight - lines*lineHeight)/2 + 8;
+ if (!tvguideConfig.hideChannelLogos) {
+ cImageLoader imgLoader;
+ if (imgLoader.LoadLogo(channel->Name())) {
+ cImage logo = imgLoader.GetImage();
+ int logoX = (tvguideConfig.colWidth - tvguideConfig.logoWidth)/2;
+ pixmapLogo->DrawImage(cPoint(logoX, 5), logo);
+ }
+ yStart = tvguideConfig.logoHeight + 8;
+ }
+ for (int i=0; i<lines; i++) {
+ int textWidth = tvguideConfig.FontHeader->Width(tw.GetLine(i));
+ int xText = (tvguideConfig.colWidth - textWidth) / 2;
+ if (xText < 0)
+ xText = 0;
+ pixmap->DrawText(cPoint(xText, yStart + i*lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontHeader);
+ }
+ drawBorder();
+}
+
+void cHeaderGrid::setPosition(int num) {
+ pixmap->SetViewPort(cRect( tvguideConfig.timeColWidth + num*tvguideConfig.colWidth,
+ tvguideConfig.statusHeaderHeight,
+ tvguideConfig.colWidth,
+ tvguideConfig.headerHeight));
+ pixmapLogo->SetViewPort(cRect( tvguideConfig.timeColWidth + num*tvguideConfig.colWidth,
+ tvguideConfig.statusHeaderHeight,
+ tvguideConfig.colWidth,
+ tvguideConfig.headerHeight));
+}
|