aboutsummaryrefslogtreecommitdiff
path: root/src/Basemenu.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Basemenu.cc')
-rw-r--r--src/Basemenu.cc64
1 files changed, 34 insertions, 30 deletions
diff --git a/src/Basemenu.cc b/src/Basemenu.cc
index 354f4e6..46a5735 100644
--- a/src/Basemenu.cc
+++ b/src/Basemenu.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Basemenu.cc,v 1.22 2002/04/28 15:54:59 fluxgen Exp $ 25// $Id: Basemenu.cc,v 1.23 2002/05/15 09:35:49 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -95,12 +95,12 @@ m_alignment(ALIGNDONTCARE) {
95 95
96 if (i18n->multibyte()) { 96 if (i18n->multibyte()) {
97 menu.width = menu.title_h = menu.item_w = menu.frame_h = 97 menu.width = menu.title_h = menu.item_w = menu.frame_h =
98 m_screen->getMenuStyle()->titlefont->getFontSetExtents()->max_ink_extent.height + 98 m_screen->getMenuStyle()->titlefont.getFontSetExtents()->max_ink_extent.height +
99 (menu.bevel_w * 2); 99 (menu.bevel_w * 2);
100 } else { 100 } else {
101 menu.width = menu.title_h = menu.item_w = menu.frame_h = 101 menu.width = menu.title_h = menu.item_w = menu.frame_h =
102 m_screen->getMenuStyle()->titlefont->getFontStruct()->ascent + 102 m_screen->getMenuStyle()->titlefont.getFontStruct()->ascent +
103 m_screen->getMenuStyle()->titlefont->getFontStruct()->descent + 103 m_screen->getMenuStyle()->titlefont.getFontStruct()->descent +
104 (menu.bevel_w * 2); 104 (menu.bevel_w * 2);
105 } 105 }
106 106
@@ -109,11 +109,11 @@ m_alignment(ALIGNDONTCARE) {
109 menu.minsub = 0; 109 menu.minsub = 0;
110 110
111 if (i18n->multibyte()) { 111 if (i18n->multibyte()) {
112 menu.item_h = m_screen->getMenuStyle()->framefont->getFontSetExtents()->max_ink_extent.height + 112 menu.item_h = m_screen->getMenuStyle()->framefont.getFontSetExtents()->max_ink_extent.height +
113 (menu.bevel_w); 113 (menu.bevel_w);
114 } else { 114 } else {
115 menu.item_h = m_screen->getMenuStyle()->framefont->getFontStruct()->ascent + 115 menu.item_h = m_screen->getMenuStyle()->framefont.getFontStruct()->ascent +
116 m_screen->getMenuStyle()->framefont->getFontStruct()->descent + 116 m_screen->getMenuStyle()->framefont.getFontStruct()->descent +
117 (menu.bevel_w); 117 (menu.bevel_w);
118 } 118 }
119 menu.height = menu.title_h + m_screen->getBorderWidth() + menu.frame_h; 119 menu.height = menu.title_h + m_screen->getBorderWidth() + menu.frame_h;
@@ -260,16 +260,16 @@ void Basemenu::update(void) {
260 I18n *i18n = I18n::instance(); 260 I18n *i18n = I18n::instance();
261 261
262 if (i18n->multibyte()) { 262 if (i18n->multibyte()) {
263 menu.item_h = m_screen->getMenuStyle()->framefont->getFontSetExtents()->max_ink_extent.height + 263 menu.item_h = m_screen->getMenuStyle()->framefont.getFontSetExtents()->max_ink_extent.height +
264 menu.bevel_w; 264 menu.bevel_w;
265 menu.title_h = m_screen->getMenuStyle()->titlefont->getFontSetExtents()->max_ink_extent.height + 265 menu.title_h = m_screen->getMenuStyle()->titlefont.getFontSetExtents()->max_ink_extent.height +
266 (menu.bevel_w * 2); 266 (menu.bevel_w * 2);
267 } else { 267 } else {
268 menu.item_h = m_screen->getMenuStyle()->framefont->getFontStruct()->ascent + 268 menu.item_h = m_screen->getMenuStyle()->framefont.getFontStruct()->ascent +
269 m_screen->getMenuStyle()->framefont->getFontStruct()->descent + 269 m_screen->getMenuStyle()->framefont.getFontStruct()->descent +
270 menu.bevel_w; 270 menu.bevel_w;
271 menu.title_h = m_screen->getMenuStyle()->titlefont->getFontStruct()->ascent + 271 menu.title_h = m_screen->getMenuStyle()->titlefont.getFontStruct()->ascent +
272 m_screen->getMenuStyle()->titlefont->getFontStruct()->descent + 272 m_screen->getMenuStyle()->titlefont.getFontStruct()->descent +
273 (menu.bevel_w * 2); 273 (menu.bevel_w * 2);
274 } 274 }
275 275
@@ -279,14 +279,15 @@ void Basemenu::update(void) {
279 FBNLS::BasemenuSet, FBNLS::BasemenuBlackboxMenu, 279 FBNLS::BasemenuSet, FBNLS::BasemenuBlackboxMenu,
280 "fluxbox Menu"); 280 "fluxbox Menu");
281 int l = strlen(s); 281 int l = strlen(s);
282 282
283 283 /*
284 if (i18n->multibyte()) { 284 if (i18n->multibyte()) {
285 XRectangle ink, logical; 285 XRectangle ink, logical;
286 XmbTextExtents(m_screen->getMenuStyle()->titlefont->getFontSet(), s, l, &ink, &logical); 286 XmbTextExtents(m_screen->getMenuStyle()->titlefont.getFontSet(), s, l, &ink, &logical);
287 menu.item_w = logical.width; 287 menu.item_w = logical.width;
288 } else 288 } else*/
289 menu.item_w = XTextWidth(m_screen->getMenuStyle()->titlefont->getFontStruct(), s, l); 289 menu.item_w = m_screen->getMenuStyle()->titlefont.getTextWidth(s, l);
290 //XTextWidth(m_screen->getMenuStyle()->titlefont.getFontStruct(), s, l);
290 291
291 menu.item_w += (menu.bevel_w * 2); 292 menu.item_w += (menu.bevel_w * 2);
292 } else 293 } else
@@ -301,12 +302,15 @@ void Basemenu::update(void) {
301 const char *s = itmp->label().c_str(); 302 const char *s = itmp->label().c_str();
302 int l = itmp->label().size(); 303 int l = itmp->label().size();
303 304
304 if (i18n->multibyte()) { 305 /*if (i18n->multibyte()) {
305 XRectangle ink, logical; 306 XRectangle ink, logical;
306 XmbTextExtents(m_screen->getMenuStyle()->framefont->getFontSet(), s, l, &ink, &logical); 307 XmbTextExtents(m_screen->getMenuStyle()->framefont.getFontSet(), s, l, &ink, &logical);
307 ii = logical.width; 308 ii = logical.width;
308 } else 309 } else
309 ii = XTextWidth(m_screen->getMenuStyle()->framefont->getFontStruct(), s, l); 310 ii = XTextWidth(m_screen->getMenuStyle()->framefont.getFontStruct(), s, l);
311 */
312 ii = screen()->getMenuStyle()->framefont.getTextWidth(s, l);
313
310 314
311 ii += (menu.bevel_w * 2) + (menu.item_h * 2); 315 ii += (menu.bevel_w * 2) + (menu.item_h * 2);
312 316
@@ -485,7 +489,7 @@ void Basemenu::redrawTitle(void) {
485 int dx = menu.bevel_w, len = strlen(text); 489 int dx = menu.bevel_w, len = strlen(text);
486 unsigned int l; 490 unsigned int l;
487 491
488 l = m_screen->getMenuStyle()->titlefont->getTextWidth(text, len); 492 l = m_screen->getMenuStyle()->titlefont.getTextWidth(text, len);
489 493
490 l += (menu.bevel_w * 2); 494 l += (menu.bevel_w * 2);
491 495
@@ -503,13 +507,13 @@ void Basemenu::redrawTitle(void) {
503 } 507 }
504 508
505 if (i18n->multibyte()) 509 if (i18n->multibyte())
506 XmbDrawString(m_display, menu.title, m_screen->getMenuStyle()->titlefont->getFontSet(), 510 XmbDrawString(m_display, menu.title, m_screen->getMenuStyle()->titlefont.getFontSet(),
507 m_screen->getMenuStyle()->t_text_gc, dx, menu.bevel_w - 511 m_screen->getMenuStyle()->t_text_gc, dx, menu.bevel_w -
508 m_screen->getMenuStyle()->titlefont->getFontSetExtents()->max_ink_extent.y, 512 m_screen->getMenuStyle()->titlefont.getFontSetExtents()->max_ink_extent.y,
509 text, len); 513 text, len);
510 else 514 else
511 XDrawString(m_display, menu.title, m_screen->getMenuStyle()->t_text_gc, dx, 515 XDrawString(m_display, menu.title, m_screen->getMenuStyle()->t_text_gc, dx,
512 m_screen->getMenuStyle()->titlefont->getFontStruct()->ascent + menu.bevel_w, 516 m_screen->getMenuStyle()->titlefont.getFontStruct()->ascent + menu.bevel_w,
513 text, len); 517 text, len);
514} 518}
515 519
@@ -654,14 +658,14 @@ void Basemenu::drawItem(unsigned int index, bool highlight, bool clear,
654 I18n *i18n = I18n::instance(); 658 I18n *i18n = I18n::instance();
655 659
656 if (text) { 660 if (text) {
657 text_w = m_screen->getMenuStyle()->framefont->getTextWidth(text, len); 661 text_w = m_screen->getMenuStyle()->framefont.getTextWidth(text, len);
658 662
659 if (m_screen->getMenuStyle()->framefont->multibyte()) { 663 if (m_screen->getMenuStyle()->framefont.multibyte()) {
660 text_y = item_y + (menu.bevel_w / 2) - 664 text_y = item_y + (menu.bevel_w / 2) -
661 m_screen->getMenuStyle()->framefont->getFontSetExtents()->max_ink_extent.y; 665 m_screen->getMenuStyle()->framefont.getFontSetExtents()->max_ink_extent.y;
662 } else { 666 } else {
663 text_y = item_y + 667 text_y = item_y +
664 m_screen->getMenuStyle()->framefont->getFontStruct()->ascent + 668 m_screen->getMenuStyle()->framefont.getFontStruct()->ascent +
665 (menu.bevel_w / 2); 669 (menu.bevel_w / 2);
666 } 670 }
667 671
@@ -753,7 +757,7 @@ void Basemenu::drawItem(unsigned int index, bool highlight, bool clear,
753 757
754 if (dotext && text) { 758 if (dotext && text) {
755 if (i18n->multibyte()) { 759 if (i18n->multibyte()) {
756 XmbDrawString(m_display, menu.frame, m_screen->getMenuStyle()->framefont->getFontSet(), 760 XmbDrawString(m_display, menu.frame, m_screen->getMenuStyle()->framefont.getFontSet(),
757 tgc, text_x, text_y, text, len); 761 tgc, text_x, text_y, text, len);
758 } else 762 } else
759 XDrawString(m_display, menu.frame, tgc, text_x, text_y, text, len); 763 XDrawString(m_display, menu.frame, tgc, text_x, text_y, text, len);