diff options
author | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2019-11-09 11:22:02 +0100 |
---|---|---|
committer | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2022-06-18 17:03:02 +0200 |
commit | ce690366f8a52cee5f0c9dcb1335835996c4c79f (patch) | |
tree | 5673aaa1d8e2b31b74a6a080138c2deb3f22a31a /recmenuitem.c | |
parent | 9565eda1aaab09f1516f0dd60b86fcaf780ea0eb (diff) | |
download | vdr-plugin-tvguide-ce690366f8a52cee5f0c9dcb1335835996c4c79f.tar.gz vdr-plugin-tvguide-ce690366f8a52cee5f0c9dcb1335835996c4c79f.tar.bz2 |
Refactor cRecMenuConfirmTimer
Diffstat (limited to 'recmenuitem.c')
-rw-r--r-- | recmenuitem.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/recmenuitem.c b/recmenuitem.c index b52526e..4a79e1b 100644 --- a/recmenuitem.c +++ b/recmenuitem.c @@ -266,15 +266,41 @@ cRecMenuItemInfo::cRecMenuItemInfo(const char *text, bool largeFont) { selectable = false; active = false; this->text = text; + this->line1 = ""; + this->line2 = ""; + this->line3 = ""; + this->line4 = ""; + this->numLines = 1; fontInfo = (largeFont) ? fontLarge : font; border = 10; } +cRecMenuItemInfo::cRecMenuItemInfo(std::string line1, int numLines, std::string line2, std::string line3, std::string line4, int width, bool largeFont) { + selectable = false; + fontInfo = (largeFont) ? fontLarge : font; + border = 10; + this->numLines = numLines; + this->line2 = line2; + this->line3 = line3; + this->line4 = line4; + if (numLines == 1) { + this->line1 = line1; + } else if (numLines == 2) { + this->line1 = cString::sprintf("%s\n%s", line1.c_str(), line2.c_str()); + } else if (numLines == 3) { + this->line1 = cString::sprintf("%s\n%s\n%s", line1.c_str(), line2.c_str(), line3.c_str()); + } else if (numLines == 4) { + this->line1 = cString::sprintf("%s\n%s\n%s\n%s", line1.c_str(), line2.c_str(), line3.c_str(), line4.c_str()); + } + this->active = false; + CalculateHeight(width); +} + cRecMenuItemInfo::~cRecMenuItemInfo(void) { } void cRecMenuItemInfo::CalculateHeight(int textWidth) { - wrapper.Set(*text, fontInfo, textWidth); + wrapper.Set((line1 == "") ? *text : line1.c_str(), fontInfo, textWidth); height = fontInfo->Height() * wrapper.Lines() + 2 * border; } |