From 05a1b55901faaec99647e1b64ca78e72acce5c2e Mon Sep 17 00:00:00 2001
From: fluxgen <fluxgen>
Date: Sun, 13 Jun 2004 10:59:54 +0000
Subject: minor fix for title and item height

---
 src/FbTk/MenuTheme.cc | 17 ++++++++++-------
 src/FbTk/MenuTheme.hh |  9 +++++----
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/FbTk/MenuTheme.cc b/src/FbTk/MenuTheme.cc
index fa0977a..ebee2e5 100644
--- a/src/FbTk/MenuTheme.cc
+++ b/src/FbTk/MenuTheme.cc
@@ -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.16 2004/06/07 21:02:49 fluxgen Exp $
+// $Id: MenuTheme.cc,v 1.17 2004/06/13 10:59:54 fluxgen Exp $
 
 #include "MenuTheme.hh"
 
@@ -66,9 +66,10 @@ MenuTheme::MenuTheme(int screen_num):
     m_alpha(255),
     m_menumode(DELAY_OPEN),
     m_delayopen(0), // no delay as default
-    m_delayclose(0) // no delay as default
+    m_delayclose(0), // no delay as default
+    m_real_title_height(*m_title_height),
+    m_real_item_height(*m_item_height)
 { 
-
     // set default values
     *m_border_width = 0;
     *m_bevel_width = 0;
@@ -93,11 +94,13 @@ void MenuTheme::reconfigTheme() {
     if (*m_border_width > 20)
         *m_border_width = 20;
 
-    int item_height = std::max(itemHeight(), frameFont().height() + bevelWidth());
+    m_real_item_height = std::max(*m_item_height, frameFont().height() + 2*bevelWidth());
+    m_real_title_height = std::max(*m_title_height,
+                                   titleFont().height() + 2*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);
+    m_bullet_pixmap->scale(itemHeight(), itemHeight());
+    m_selected_pixmap->scale(itemHeight(), itemHeight());
+    m_unselected_pixmap->scale(itemHeight(), itemHeight());
 
     t_text_gc.setForeground(*t_text);
     f_text_gc.setForeground(*f_text);
diff --git a/src/FbTk/MenuTheme.hh b/src/FbTk/MenuTheme.hh
index 174e0b5..010e694 100644
--- a/src/FbTk/MenuTheme.hh
+++ b/src/FbTk/MenuTheme.hh
@@ -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.15 2004/06/13 00:33:06 fluxgen Exp $
+// $Id: MenuTheme.hh,v 1.16 2004/06/13 10:59:24 fluxgen Exp $
 
 #ifndef FBTK_MENUTHEME_HH
 #define FBTK_MENUTHEME_HH
@@ -102,8 +102,8 @@ public:
     inline BulletType bullet() const { return *m_bullet; }
     inline FbTk::Justify bulletPos() const { return *bullet_pos; }
 
-    inline unsigned int titleHeight() const { return *m_title_height; }
-    inline unsigned int itemHeight() const { return *m_item_height; }
+    inline unsigned int titleHeight() const { return m_real_title_height; }
+    inline unsigned int itemHeight() const { return m_real_item_height; }
     inline unsigned int borderWidth() const { return *m_border_width; }
     inline unsigned int bevelWidth() const { return *m_bevel_width; }
 
@@ -141,7 +141,8 @@ private:
     MenuMode m_menumode;
     unsigned int m_delayopen; ///< in msec
     unsigned int m_delayclose; ///< in msec
-    
+    int m_real_title_height; ///< the calculated item height (from font and menu.titleHeight)
+    int m_real_item_height; ///< the calculated item height (from font and menu.itemHeight)
 };
 
 } // end namespace FbTk
-- 
cgit v0.11.2