item and title height specified by style

This commit is contained in:
fluxgen 2004-06-07 21:02:49 +00:00
parent 8eb2ea889d
commit 2bb46b0020
2 changed files with 15 additions and 7 deletions

View file

@ -1,5 +1,5 @@
// MenuTheme.cc for FbTk
// Copyright (c) 2002-2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
// Copyright (c) 2002-2004 Henrik Kinnunen (fluxgen at users.sourceforge.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: MenuTheme.cc,v 1.15 2004/04/26 15:04:37 rathnor Exp $
// $Id: MenuTheme.cc,v 1.16 2004/06/07 21:02:49 fluxgen Exp $
#include "MenuTheme.hh"
@ -30,6 +30,7 @@
#include "StringUtil.hh"
#include <cstdio>
#include <algorithm>
namespace FbTk {
@ -48,6 +49,8 @@ MenuTheme::MenuTheme(int screen_num):
titlefont_justify(*this, "menu.title.justify", "Menu.Title.Justify"),
bullet_pos(*this, "menu.bullet.position", "Menu.Bullet.Position"),
m_bullet(*this, "menu.bullet", "Menu.Bullet"),
m_title_height(*this, "menu.titleHeight", "Menu.TitleHeight"),
m_item_height(*this, "menu.itemHeight", "Menu.ItemHeight"),
m_border_width(*this, "menu.borderWidth", "Menu.BorderWidth"),
m_bevel_width(*this, "menu.bevelWidth", "Menu.BevelWidth"),
m_border_color(*this, "menu.borderColor", "Menu.BorderColor"),
@ -90,9 +93,11 @@ void MenuTheme::reconfigTheme() {
if (*m_border_width > 20)
*m_border_width = 20;
m_bullet_pixmap->scale(frameFont().height(), frameFont().height());
m_selected_pixmap->scale(frameFont().height(), frameFont().height());
m_unselected_pixmap->scale(frameFont().height(), frameFont().height());
int item_height = std::max(itemHeight(), frameFont().height() + bevelWidth());
m_bullet_pixmap->scale(item_height, item_height);
m_selected_pixmap->scale(item_height, item_height);
m_unselected_pixmap->scale(item_height, item_height);
t_text_gc.setForeground(*t_text);
f_text_gc.setForeground(*f_text);

View file

@ -1,5 +1,5 @@
// MenuTheme.hh for FbTk
// Copyright (c) 2002-2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
// Copyright (c) 2002-2004 Henrik Kinnunen (fluxgen at users.sourceforge.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: MenuTheme.hh,v 1.13 2003/12/17 00:43:22 fluxgen Exp $
// $Id: MenuTheme.hh,v 1.14 2004/06/07 21:02:49 fluxgen Exp $
#ifndef FBTK_MENUTHEME_HH
#define FBTK_MENUTHEME_HH
@ -102,6 +102,8 @@ public:
BulletType bullet() const { return *m_bullet; }
FbTk::Justify bulletPos() const { return *bullet_pos; }
unsigned int titleHeight() const { return *m_title_height; }
unsigned int itemHeight() const { return *m_item_height; }
unsigned int borderWidth() const { return *m_border_width; }
unsigned int bevelWidth() const { return *m_bevel_width; }
@ -126,6 +128,7 @@ private:
FbTk::ThemeItem<FbTk::Justify> framefont_justify, titlefont_justify;
FbTk::ThemeItem<FbTk::Justify> bullet_pos;
FbTk::ThemeItem<BulletType> m_bullet;
FbTk::ThemeItem<unsigned int> m_title_height, m_item_height;
FbTk::ThemeItem<unsigned int> m_border_width;
FbTk::ThemeItem<unsigned int> m_bevel_width;
FbTk::ThemeItem<FbTk::Color> m_border_color;