diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/Menu.cc | 10 | ||||
-rw-r--r-- | src/FbTk/MenuTheme.cc | 31 | ||||
-rw-r--r-- | src/FbTk/MenuTheme.hh | 4 |
3 files changed, 23 insertions, 22 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 484a399..34cc6ae 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -158,7 +158,7 @@ Menu::Menu(FbTk::ThemeProxy<MenuTheme> &tm, ImageControl &imgctrl): | |||
158 | event_mask |= EnterWindowMask | LeaveWindowMask; | 158 | event_mask |= EnterWindowMask | LeaveWindowMask; |
159 | 159 | ||
160 | int w = width(); | 160 | int w = width(); |
161 | int th = theme()->titleHeight(); | 161 | int th = theme()->titleHeight(!m_title.label.logical().empty()); |
162 | int fh = std::max(m_frame.height, m_frame.height); | 162 | int fh = std::max(m_frame.height, m_frame.height); |
163 | 163 | ||
164 | //create menu title | 164 | //create menu title |
@@ -395,7 +395,7 @@ void Menu::updateMenu() { | |||
395 | int bw = theme()->borderWidth(); | 395 | int bw = theme()->borderWidth(); |
396 | int ih = theme()->itemHeight(); | 396 | int ih = theme()->itemHeight(); |
397 | unsigned int iw = 1; | 397 | unsigned int iw = 1; |
398 | int th = theme()->titleHeight(); | 398 | int th = theme()->titleHeight(!m_title.label.logical().empty()); |
399 | int tbw = m_title.win.borderWidth(); | 399 | int tbw = m_title.win.borderWidth(); |
400 | int w = static_cast<int>(width()); | 400 | int w = static_cast<int>(width()); |
401 | size_t l = m_items.size(); | 401 | size_t l = m_items.size(); |
@@ -668,7 +668,7 @@ void Menu::redrawTitle(FbDrawable &drawable) { | |||
668 | } | 668 | } |
669 | 669 | ||
670 | // difference between height based on font, and style-set height | 670 | // difference between height based on font, and style-set height |
671 | int height_offset = theme()->titleHeight() - (font.height() + 2*dx); | 671 | int height_offset = theme()->titleHeight(!m_title.label.logical().empty()) - (font.height() + 2*dx); |
672 | font.drawText(drawable, screenNumber(), theme()->titleTextGC().gc(), m_title.label, | 672 | font.drawText(drawable, screenNumber(), theme()->titleTextGC().gc(), m_title.label, |
673 | dx, font.ascent() + dx + height_offset/2); // position | 673 | dx, font.ascent() + dx + height_offset/2); // position |
674 | } | 674 | } |
@@ -707,10 +707,10 @@ void Menu::drawSubmenu(unsigned int index) { | |||
707 | int bw = m_window.borderWidth(); | 707 | int bw = m_window.borderWidth(); |
708 | int h = static_cast<int>(height()); | 708 | int h = static_cast<int>(height()); |
709 | int title_bw = m_title.win.borderWidth(); | 709 | int title_bw = m_title.win.borderWidth(); |
710 | int title_height = (m_title.visible ? theme()->titleHeight() + title_bw : 0); | 710 | int title_height = (m_title.visible ? theme()->titleHeight(!m_title.label.logical().empty()) + title_bw : 0); |
711 | 711 | ||
712 | int subm_title_height = (item->submenu()->m_title.visible) ? | 712 | int subm_title_height = (item->submenu()->m_title.visible) ? |
713 | item->submenu()->theme()->titleHeight() + bw : 0; | 713 | item->submenu()->theme()->titleHeight(!m_title.label.logical().empty()) + bw : 0; |
714 | int subm_height = static_cast<int>(item->submenu()->height()); | 714 | int subm_height = static_cast<int>(item->submenu()->height()); |
715 | int subm_width = static_cast<int>(item->submenu()->width()); | 715 | int subm_width = static_cast<int>(item->submenu()->width()); |
716 | int subm_bw = item->submenu()->fbwindow().borderWidth(); | 716 | int subm_bw = item->submenu()->fbwindow().borderWidth(); |
diff --git a/src/FbTk/MenuTheme.cc b/src/FbTk/MenuTheme.cc index db54483..9fc55e4 100644 --- a/src/FbTk/MenuTheme.cc +++ b/src/FbTk/MenuTheme.cc | |||
@@ -86,14 +86,14 @@ MenuTheme::MenuTheme(int screen_num): | |||
86 | 86 | ||
87 | ThemeManager::instance().loadTheme(*this); | 87 | ThemeManager::instance().loadTheme(*this); |
88 | 88 | ||
89 | m_real_item_height = std::max(*m_item_height, | 89 | if (*m_title_height < 1) |
90 | std::max(frameFont().height() + 2*bevelWidth(), | 90 | *m_title_height = 1; |
91 | hiliteFont().height() + 2*bevelWidth())); | 91 | const unsigned int pad = 2*bevelWidth(); |
92 | m_real_title_height = std::max(*m_title_height, | 92 | m_real_item_height = std::max(std::max(pad + 1, *m_item_height), |
93 | titleFont().height() + 2*bevelWidth()); | 93 | std::max(frameFont().height() + pad, |
94 | 94 | hiliteFont().height() + pad)); | |
95 | m_real_item_height = m_real_item_height == 0 ? 1 : m_real_item_height; | 95 | m_real_title_height = std::max(std::max(pad + 1, *m_title_height), |
96 | m_real_title_height = m_real_title_height == 0 ? 1 : m_real_title_height; | 96 | titleFont().height() + pad); |
97 | 97 | ||
98 | t_text_gc.setForeground(*t_text); | 98 | t_text_gc.setForeground(*t_text); |
99 | f_text_gc.setForeground(*f_text); | 99 | f_text_gc.setForeground(*f_text); |
@@ -115,15 +115,14 @@ void MenuTheme::reconfigTheme() { | |||
115 | if (*m_border_width > 20) | 115 | if (*m_border_width > 20) |
116 | *m_border_width = 20; | 116 | *m_border_width = 20; |
117 | 117 | ||
118 | m_real_item_height = std::max(*m_item_height, | ||
119 | std::max(frameFont().height() + 2*bevelWidth(), | ||
120 | hiliteFont().height() + 2*bevelWidth())); | ||
121 | m_real_title_height = std::max(*m_title_height, | ||
122 | titleFont().height() + 2*bevelWidth()); | ||
123 | 118 | ||
124 | unsigned int minsize = 2*bevelWidth()+1; | 119 | const unsigned int pad = 2*bevelWidth(); |
125 | m_real_item_height = m_real_item_height < minsize ? minsize: m_real_item_height; | 120 | m_real_item_height = std::max(std::max(pad + 1, *m_item_height), |
126 | m_real_title_height = m_real_title_height == minsize ? minsize : m_real_title_height; | 121 | std::max(frameFont().height() + pad, |
122 | hiliteFont().height() + pad)); | ||
123 | m_real_title_height = std::max(std::max(pad + 1, *m_title_height), | ||
124 | titleFont().height() + pad); | ||
125 | |||
127 | unsigned int item_pm_height = itemHeight(); | 126 | unsigned int item_pm_height = itemHeight(); |
128 | 127 | ||
129 | m_bullet_pixmap->scale(item_pm_height, item_pm_height); | 128 | m_bullet_pixmap->scale(item_pm_height, item_pm_height); |
diff --git a/src/FbTk/MenuTheme.hh b/src/FbTk/MenuTheme.hh index e217e7c..b03b6fc 100644 --- a/src/FbTk/MenuTheme.hh +++ b/src/FbTk/MenuTheme.hh | |||
@@ -104,7 +104,9 @@ public: | |||
104 | BulletType bullet() const { return *m_bullet; } | 104 | BulletType bullet() const { return *m_bullet; } |
105 | Justify bulletPos() const { return *bullet_pos; } | 105 | Justify bulletPos() const { return *bullet_pos; } |
106 | 106 | ||
107 | unsigned int titleHeight() const { return m_real_title_height; } | 107 | unsigned int titleHeight(bool fontConstrained = false) const { |
108 | return fontConstrained ? m_real_title_height : *m_title_height; | ||
109 | } | ||
108 | unsigned int itemHeight() const { return m_real_item_height; } | 110 | unsigned int itemHeight() const { return m_real_item_height; } |
109 | unsigned int borderWidth() const { return *m_border_width; } | 111 | unsigned int borderWidth() const { return *m_border_width; } |
110 | unsigned int bevelWidth() const { return *m_bevel_width; } | 112 | unsigned int bevelWidth() const { return *m_bevel_width; } |