summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--menuitem.c36
-rw-r--r--menuitem.h1
3 files changed, 35 insertions, 3 deletions
diff --git a/HISTORY b/HISTORY
index 8b7af1e..63b7a2d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -168,3 +168,4 @@ Version 0.1.1
- Display grapical progress bar in every default style VDR menu, fixed
progress bar detection
- Added Channel Number in Channel Menu
+- Improved display of non selectable header lines in default menus
diff --git a/menuitem.c b/menuitem.c
index ce09535..311f88f 100644
--- a/menuitem.c
+++ b/menuitem.c
@@ -1137,6 +1137,30 @@ int cNopacityDefaultMenuItem::CheckScrollable(bool hasIcon) {
return 0;
}
+bool cNopacityDefaultMenuItem::DrawHeaderElement(void) {
+ const char *c = Text + 3;
+ while (*c == '-')
+ c++;
+ if (*c == ' ' || *c == '\t') {
+ // it's a headline
+ while (*c == ' ' || *c == '\t') // find start of headline text
+ c++;
+
+ // find end of headline text
+ char *c2 = (char*)(c + strlen(c) - 1);
+ while (*c2 == '-')
+ c2--;
+ while (*c2 == ' ' || *c2 == '\t')
+ c2--;
+ *(c2 + 1) = 0;
+
+ int left = 5 + tabWidth[0];
+ pixmap->DrawText(cPoint(left, (height - font->Height()) / 2), c, Theme.Color(clrMenuFontMenuItemSep), clrTransparent, font);
+ return true;
+ }
+ return false;
+}
+
void cNopacityDefaultMenuItem::Render() {
pixmap->Fill(Theme.Color(clrMenuBorder));
int handleBgrd = (current)?handleBackgrounds[1]:handleBackgrounds[0];
@@ -1144,6 +1168,10 @@ void cNopacityDefaultMenuItem::Render() {
pixmap->DrawImage(cPoint(1, 1), handleBgrd);
if (config.roundedCorners)
DrawRoundedCorners(Theme.Color(clrMenuBorder));
+ if (!selectable && (strncmp(Text, "---", 3) == 0)) {
+ if (DrawHeaderElement())
+ return;
+ }
int colWidth = 0;
int colTextWidth = 0;
cString itemText("");
@@ -1157,11 +1185,13 @@ void cNopacityDefaultMenuItem::Render() {
colTextWidth = font->Width(*itemTabs[i]);
if (colTextWidth > colWidth) {
cTextWrapper itemTextWrapped;
- itemTextWrapped.Set(*itemTabs[i], font, colWidth - font->Width("... "));
- if (selectable)
+ if (selectable) {
+ itemTextWrapped.Set(*itemTabs[i], font, colWidth - font->Width("... "));
itemText = cString::sprintf("%s... ", itemTextWrapped.GetLine(0));
- else
+ } else {
+ itemTextWrapped.Set(*itemTabs[i], font, colWidth);
itemText = cString::sprintf("%s", itemTextWrapped.GetLine(0));
+ }
} else {
itemText = itemTabs[i];
}
diff --git a/menuitem.h b/menuitem.h
index bbabec0..3309986 100644
--- a/menuitem.h
+++ b/menuitem.h
@@ -176,6 +176,7 @@ class cNopacityDefaultMenuItem : public cNopacityMenuItem {
private:
bool CheckProgressBar(const char *text);
void DrawProgressBar(int x, int width, const char *bar, tColor color);
+ bool DrawHeaderElement(void);
std::string strEntry;
std::string strEntryFull;
int scrollCol;