neutrino: add possibility to specify minimal menu width

A static window width was specified in pixels before, which is
"problematic". Then it was ignored and menus were automatically
sized to their largest menu item.
Due to popular demand, add the possibility to specify a minimal
window width in percent of screen width. If set to 0 (default),
menus will autosize as before.
Main menu is set to 22% screenwidth.

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@288 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
seife
2010-02-07 12:05:02 +00:00
parent 184d009ca6
commit 18dca0f47d
13 changed files with 40 additions and 34 deletions

View File

@@ -100,7 +100,7 @@ CMenuWidget::CMenuWidget(const char* Name, const std::string & Icon, const int m
Init(Icon, mwidth, mheight);
}
void CMenuWidget::Init(const std::string & Icon, const int /*mwidth*/, const int /*mheight*/)
void CMenuWidget::Init(const std::string & Icon, const int mwidth, const int /*mheight*/)
{
frameBuffer = CFrameBuffer::getInstance();
iconfile = Icon;
@@ -108,6 +108,11 @@ void CMenuWidget::Init(const std::string & Icon, const int /*mwidth*/, const int
needed_width = 0; /* is set in addItem() */
width = 0; /* is set in paint() */
if (mwidth > 100) /* warn about abuse until we found all offenders... */
fprintf(stderr, "CMenuWidget::Init (%s) (%s) mwidth over 100%: %d\n", nameString.c_str(), Icon.c_str(), mwidth);
else
needed_width = frameBuffer->getScreenWidth() * mwidth / 100;
/* set the max height to 9/10 of usable screen height
debatable, if the callers need a possibility to set this */
height = frameBuffer->getScreenHeight() / 20 * 18; /* make sure its a multiple of 2 */