CHintBox: add member to get maximal required width

Origin commit data
------------------
Commit: 4bdd5e11a9
Author: Thilo Graf <dbt@novatux.de>
Date: 2016-10-31 (Mon, 31 Oct 2016)
This commit is contained in:
2016-10-31 21:38:06 +01:00
parent 1523582d35
commit 0704180bf9
2 changed files with 7 additions and 1 deletions

View File

@@ -259,7 +259,7 @@ void CHintBox::addHintItem(const std::string& Text, const int& text_mode, const
//set required font and line size
hb_font = !font_text ? hb_font : font_text;
width = max(width, min(hb_font->getRenderWidth(Text), HINTBOX_MIN_WIDTH));
width = getMaxWidth(Text, width);
int h_line = hb_font->getHeight();
//init side picon object
@@ -439,6 +439,11 @@ void CHintBox::scroll_down(const uint& hint_id)
Scroll(true, hint_id);
}
int CHintBox::getMaxWidth(const string& Text, const int& minWidth)
{
return max(HINTBOX_MIN_WIDTH, max(minWidth, min(hb_font->getRenderWidth(Text), (int)frameBuffer->getScreenWidth())));
}
int ShowHint(const char * const Caption, const char * const Text, const int Width, int timeout, const char * const Icon, const char * const Picon, const int& header_buttons)
{
int res = messages_return::none;