summaryrefslogtreecommitdiff
path: root/recmenuitem.c
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2014-01-14 18:00:32 +0100
committerlouis <louis.braun@gmx.de>2014-01-14 18:00:32 +0100
commita8b7c9543477fddb42e7a2bac38a0d139c7de962 (patch)
tree9c681eb0de7fd584f8e50683ffb8aabc0fa716f4 /recmenuitem.c
parentd0651a4a507bbd633b30105f1fa01abe1172b311 (diff)
downloadvdr-plugin-tvguide-a8b7c9543477fddb42e7a2bac38a0d139c7de962.tar.gz
vdr-plugin-tvguide-a8b7c9543477fddb42e7a2bac38a0d139c7de962.tar.bz2
Favorites menu with EPG Search favorite timers with blue key
Diffstat (limited to 'recmenuitem.c')
-rw-r--r--recmenuitem.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/recmenuitem.c b/recmenuitem.c
index f7d485e..24a0166 100644
--- a/recmenuitem.c
+++ b/recmenuitem.c
@@ -2658,3 +2658,83 @@ eRecMenuState cRecMenuItemSearchTimer::ProcessKey(eKeys Key) {
}
return rmsNotConsumed;
}
+
+// --- cRecMenuItemFavorite -------------------------------------------------------
+cRecMenuItemFavorite::cRecMenuItemFavorite(cTVGuideSearchTimer favorite,
+ eRecMenuState action1,
+ bool active) {
+ this->favorite = favorite;
+ this->action = action1;
+ pixmapText = NULL;
+ pixmapIcons = NULL;
+ selectable = true;
+ this->active = active;
+ height = 2 * font->Height();;
+}
+
+cRecMenuItemFavorite::~cRecMenuItemFavorite(void) {
+ if (pixmapText)
+ osdManager.releasePixmap(pixmapText);
+ if (pixmapIcons)
+ osdManager.releasePixmap(pixmapIcons);
+}
+
+void cRecMenuItemFavorite::SetPixmaps(void) {
+ if (!pixmap) {
+ pixmap = osdManager.requestPixmap(4, cRect(x, y, width, height));
+ pixmapText = osdManager.requestPixmap(5, cRect(x, y, width, height));
+ pixmapIcons = osdManager.requestPixmap(6, cRect(x, y, width, height));
+ } else {
+ pixmap->SetViewPort(cRect(x, y, width, height));
+ pixmapText->SetViewPort(cRect(x, y, width, height));
+ pixmapIcons->SetViewPort(cRect(x, y, width, height));
+ }
+}
+
+void cRecMenuItemFavorite::Draw(void) {
+ int textX = DrawIcons();
+ if (!drawn) {
+ pixmapText->Fill(clrTransparent);
+ textX += 20;
+ cString label = cString::sprintf("\"%s\"", favorite.SearchString().c_str());
+ pixmapText->DrawText(cPoint(textX, (height - fontLarge->Height())/2), *label, colorText, clrTransparent, fontLarge);
+ drawn = true;
+ }
+}
+
+void cRecMenuItemFavorite::Hide(void) {
+ if (pixmap) pixmap->SetLayer(-1);
+ if (pixmapText) pixmapText->SetLayer(-1);
+ if (pixmapIcons) pixmapIcons->SetLayer(-1);
+}
+
+void cRecMenuItemFavorite::Show(void) {
+ if (pixmap) pixmap->SetLayer(4);
+ if (pixmapText) pixmapText->SetLayer(5);
+ if (pixmapIcons) pixmapIcons->SetLayer(6);
+}
+
+int cRecMenuItemFavorite::DrawIcons(void) {
+ pixmapIcons->Fill(clrTransparent);
+ int iconsX = 10;
+ int iconSize = height / 2;
+ int iconY = (height - iconSize) / 2;
+ std::string iconSearch;
+ iconSearch = active ? "search_active" : "search_inactive" ;
+ cImage *imgSearch = imgCache.GetIcon(iconSearch, iconSize, iconSize);
+ if (imgSearch) {
+ pixmapIcons->DrawImage(cPoint(iconsX, iconY), *imgSearch);
+ iconsX += iconSize + 10;
+ }
+ return iconsX;
+}
+
+eRecMenuState cRecMenuItemFavorite::ProcessKey(eKeys Key) {
+ switch (Key & ~k_Repeat) {
+ case kOk:
+ return action;
+ default:
+ break;
+ }
+ return rmsNotConsumed;
+} \ No newline at end of file