diff options
author | unknown <unknown> | 2002-01-11 11:59:54 (GMT) |
---|---|---|
committer | unknown <unknown> | 2002-01-11 11:59:54 (GMT) |
commit | 61661d638e34b3ce6c986d5a53b8c08c1051d422 (patch) | |
tree | f0b87676e95070afee163f76902efd0c4d5b5fe6 /src/Basemenu.cc | |
parent | f98c3c9045397bd9497621deb55b310366f8a5de (diff) | |
parent | a3d2a1cf0a5ab724e19a91915fe97842f52260d5 (diff) | |
download | fluxbox-Release-0_1_6.zip fluxbox-Release-0_1_6.tar.bz2 |
This commit was manufactured by cvs2svn to create tagRelease-0_1_6
'Release-0_1_6'.
Diffstat (limited to 'src/Basemenu.cc')
-rw-r--r-- | src/Basemenu.cc | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/src/Basemenu.cc b/src/Basemenu.cc index 170c3c0..659d4d7 100644 --- a/src/Basemenu.cc +++ b/src/Basemenu.cc | |||
@@ -1,4 +1,7 @@ | |||
1 | // Basemenu.cc for fluxbox - an X11 Window manager | 1 | // Basemenu.cc for Fluxbox Window manager |
2 | // Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | ||
3 | // | ||
4 | // Basemenu.cc for blackbox - an X11 Window manager | ||
2 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | 5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) |
3 | // | 6 | // |
4 | // Permission is hereby granted, free of charge, to any person obtaining a | 7 | // Permission is hereby granted, free of charge, to any person obtaining a |
@@ -19,6 +22,8 @@ | |||
19 | // 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 |
20 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
21 | 24 | ||
25 | // $Id: Basemenu.cc,v 1.6 2002/01/11 09:26:33 fluxgen Exp $ | ||
26 | |||
22 | // stupid macros needed to access some functions in version 2 of the GNU C | 27 | // stupid macros needed to access some functions in version 2 of the GNU C |
23 | // library | 28 | // library |
24 | #ifndef _GNU_SOURCE | 29 | #ifndef _GNU_SOURCE |
@@ -33,6 +38,7 @@ | |||
33 | #include "fluxbox.hh" | 38 | #include "fluxbox.hh" |
34 | #include "Basemenu.hh" | 39 | #include "Basemenu.hh" |
35 | #include "Screen.hh" | 40 | #include "Screen.hh" |
41 | #include "StringUtil.hh" | ||
36 | 42 | ||
37 | #ifdef HAVE_STDIO_H | 43 | #ifdef HAVE_STDIO_H |
38 | # include <stdio.h> | 44 | # include <stdio.h> |
@@ -52,7 +58,7 @@ Basemenu::Basemenu(BScreen *scrn) { | |||
52 | image_ctrl = screen->getImageControl(); | 58 | image_ctrl = screen->getImageControl(); |
53 | display = fluxbox->getXDisplay(); | 59 | display = fluxbox->getXDisplay(); |
54 | parent = (Basemenu *) 0; | 60 | parent = (Basemenu *) 0; |
55 | alignment = AlignDontCare; | 61 | alignment = ALIGNDONTCARE; |
56 | 62 | ||
57 | title_vis = | 63 | title_vis = |
58 | movable = | 64 | movable = |
@@ -197,8 +203,8 @@ Basemenu::~Basemenu(void) { | |||
197 | int Basemenu::insert(const char *l, int function, const char *e, int pos) { | 203 | int Basemenu::insert(const char *l, int function, const char *e, int pos) { |
198 | char *label = 0, *exec = 0; | 204 | char *label = 0, *exec = 0; |
199 | 205 | ||
200 | if (l) label = bstrdup(l); | 206 | if (l) label = StringUtil::strdup(l); |
201 | if (e) exec = bstrdup(e); | 207 | if (e) exec = StringUtil::strdup(e); |
202 | 208 | ||
203 | BasemenuItem *item = new BasemenuItem(label, function, exec); | 209 | BasemenuItem *item = new BasemenuItem(label, function, exec); |
204 | menuitems->insert(item, pos); | 210 | menuitems->insert(item, pos); |
@@ -210,7 +216,7 @@ int Basemenu::insert(const char *l, int function, const char *e, int pos) { | |||
210 | int Basemenu::insert(const char *l, Basemenu *submenu, int pos) { | 216 | int Basemenu::insert(const char *l, Basemenu *submenu, int pos) { |
211 | char *label = 0; | 217 | char *label = 0; |
212 | 218 | ||
213 | if (l) label = bstrdup(l); | 219 | if (l) label = StringUtil::strdup(l); |
214 | 220 | ||
215 | BasemenuItem *item = new BasemenuItem(label, submenu); | 221 | BasemenuItem *item = new BasemenuItem(label, submenu); |
216 | menuitems->insert(item, pos); | 222 | menuitems->insert(item, pos); |
@@ -354,7 +360,7 @@ void Basemenu::update(void) { | |||
354 | if (title_vis) { | 360 | if (title_vis) { |
355 | tmp = menu.title_pixmap; | 361 | tmp = menu.title_pixmap; |
356 | texture = &(screen->getMenuStyle()->title); | 362 | texture = &(screen->getMenuStyle()->title); |
357 | if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { | 363 | if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { |
358 | menu.title_pixmap = None; | 364 | menu.title_pixmap = None; |
359 | XSetWindowBackground(display, menu.title, | 365 | XSetWindowBackground(display, menu.title, |
360 | texture->getColor()->getPixel()); | 366 | texture->getColor()->getPixel()); |
@@ -369,7 +375,7 @@ void Basemenu::update(void) { | |||
369 | 375 | ||
370 | tmp = menu.frame_pixmap; | 376 | tmp = menu.frame_pixmap; |
371 | texture = &(screen->getMenuStyle()->frame); | 377 | texture = &(screen->getMenuStyle()->frame); |
372 | if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { | 378 | if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { |
373 | menu.frame_pixmap = None; | 379 | menu.frame_pixmap = None; |
374 | XSetWindowBackground(display, menu.frame, | 380 | XSetWindowBackground(display, menu.frame, |
375 | texture->getColor()->getPixel()); | 381 | texture->getColor()->getPixel()); |
@@ -382,7 +388,7 @@ void Basemenu::update(void) { | |||
382 | 388 | ||
383 | tmp = menu.hilite_pixmap; | 389 | tmp = menu.hilite_pixmap; |
384 | texture = &(screen->getMenuStyle()->hilite); | 390 | texture = &(screen->getMenuStyle()->hilite); |
385 | if (texture->getTexture() == (BImage_Flat | BImage_Solid)) | 391 | if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) |
386 | menu.hilite_pixmap = None; | 392 | menu.hilite_pixmap = None; |
387 | else | 393 | else |
388 | menu.hilite_pixmap = | 394 | menu.hilite_pixmap = |
@@ -390,7 +396,7 @@ void Basemenu::update(void) { | |||
390 | if (tmp) image_ctrl->removeImage(tmp); | 396 | if (tmp) image_ctrl->removeImage(tmp); |
391 | 397 | ||
392 | tmp = menu.sel_pixmap; | 398 | tmp = menu.sel_pixmap; |
393 | if (texture->getTexture() == (BImage_Flat | BImage_Solid)) | 399 | if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) |
394 | menu.sel_pixmap = None; | 400 | menu.sel_pixmap = None; |
395 | else { | 401 | else { |
396 | int hw = menu.item_h / 2; | 402 | int hw = menu.item_h / 2; |
@@ -507,11 +513,11 @@ void Basemenu::redrawTitle(void) { | |||
507 | l += (menu.bevel_w * 2); | 513 | l += (menu.bevel_w * 2); |
508 | 514 | ||
509 | switch (screen->getMenuStyle()->titlefont.justify) { | 515 | switch (screen->getMenuStyle()->titlefont.justify) { |
510 | case FFont::Right: | 516 | case DrawUtil::Font::RIGHT: |
511 | dx += menu.width - l; | 517 | dx += menu.width - l; |
512 | break; | 518 | break; |
513 | 519 | ||
514 | case FFont::Center: | 520 | case DrawUtil::Font::CENTER: |
515 | dx += (menu.width - l) / 2; | 521 | dx += (menu.width - l) / 2; |
516 | break; | 522 | break; |
517 | default: | 523 | default: |
@@ -550,7 +556,7 @@ void Basemenu::drawSubmenu(int index) { | |||
550 | x = menu.x + | 556 | x = menu.x + |
551 | ((menu.item_w * (sbl + 1)) + screen->getBorderWidth()), y; | 557 | ((menu.item_w * (sbl + 1)) + screen->getBorderWidth()), y; |
552 | 558 | ||
553 | if (alignment == AlignTop) { | 559 | if (alignment == ALIGNTOP) { |
554 | y = (((shifted) ? menu.y_shift : menu.y) + | 560 | y = (((shifted) ? menu.y_shift : menu.y) + |
555 | ((title_vis) ? menu.title_h + screen->getBorderWidth() : 0) - | 561 | ((title_vis) ? menu.title_h + screen->getBorderWidth() : 0) - |
556 | ((item->submenu()->title_vis) ? | 562 | ((item->submenu()->title_vis) ? |
@@ -563,7 +569,7 @@ void Basemenu::drawSubmenu(int index) { | |||
563 | item->submenu()->menu.title_h + screen->getBorderWidth() : 0)); | 569 | item->submenu()->menu.title_h + screen->getBorderWidth() : 0)); |
564 | } | 570 | } |
565 | 571 | ||
566 | if (alignment == AlignBottom && | 572 | if (alignment == ALIGNBOTTOM && |
567 | (y + item->submenu()->menu.height) > ((shifted) ? menu.y_shift : | 573 | (y + item->submenu()->menu.height) > ((shifted) ? menu.y_shift : |
568 | menu.y) + menu.height) { | 574 | menu.y) + menu.height) { |
569 | y = (((shifted) ? menu.y_shift : menu.y) + | 575 | y = (((shifted) ? menu.y_shift : menu.y) + |
@@ -644,11 +650,11 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear, | |||
644 | } | 650 | } |
645 | 651 | ||
646 | switch(screen->getMenuStyle()->framefont.justify) { | 652 | switch(screen->getMenuStyle()->framefont.justify) { |
647 | case FFont::Left: | 653 | case DrawUtil::Font::LEFT: |
648 | text_x = item_x + menu.bevel_w + menu.item_h + 1; | 654 | text_x = item_x + menu.bevel_w + menu.item_h + 1; |
649 | break; | 655 | break; |
650 | 656 | ||
651 | case FFont::Right: | 657 | case DrawUtil::Font::RIGHT: |
652 | text_x = item_x + menu.item_w - (menu.item_h + menu.bevel_w + text_w); | 658 | text_x = item_x + menu.item_w - (menu.item_h + menu.bevel_w + text_w); |
653 | break; | 659 | break; |
654 | default: //center | 660 | default: //center |
@@ -669,7 +675,7 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear, | |||
669 | 675 | ||
670 | sel_x = item_x; | 676 | sel_x = item_x; |
671 | 677 | ||
672 | if (screen->getMenuStyle()->bullet_pos == Right) | 678 | if (screen->getMenuStyle()->bullet_pos == RIGHT) |
673 | sel_x += (menu.item_w - menu.item_h - menu.bevel_w); | 679 | sel_x += (menu.item_w - menu.item_h - menu.bevel_w); |
674 | 680 | ||
675 | sel_x += quarter_w; | 681 | sel_x += quarter_w; |
@@ -738,14 +744,14 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear, | |||
738 | 744 | ||
739 | if (dosel && item->submenu()) { | 745 | if (dosel && item->submenu()) { |
740 | switch (screen->getMenuStyle()->bullet) { | 746 | switch (screen->getMenuStyle()->bullet) { |
741 | case Square: | 747 | case SQUARE: |
742 | XDrawRectangle(display, menu.frame, gc, sel_x, sel_y, half_w, half_w); | 748 | XDrawRectangle(display, menu.frame, gc, sel_x, sel_y, half_w, half_w); |
743 | break; | 749 | break; |
744 | 750 | ||
745 | case Triangle: | 751 | case TRIANGLE: |
746 | XPoint tri[3]; | 752 | XPoint tri[3]; |
747 | 753 | ||
748 | if (screen->getMenuStyle()->bullet_pos == Right) { | 754 | if (screen->getMenuStyle()->bullet_pos == RIGHT) { |
749 | tri[0].x = sel_x + quarter_w - 2; | 755 | tri[0].x = sel_x + quarter_w - 2; |
750 | tri[0].y = sel_y + quarter_w - 2; | 756 | tri[0].y = sel_y + quarter_w - 2; |
751 | tri[1].x = 4; | 757 | tri[1].x = 4; |
@@ -765,7 +771,7 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear, | |||
765 | CoordModePrevious); | 771 | CoordModePrevious); |
766 | break; | 772 | break; |
767 | 773 | ||
768 | case Diamond: | 774 | case DIAMOND: |
769 | XPoint dia[4]; | 775 | XPoint dia[4]; |
770 | 776 | ||
771 | dia[0].x = sel_x + quarter_w - 3; | 777 | dia[0].x = sel_x + quarter_w - 3; |
@@ -789,7 +795,7 @@ void Basemenu::setLabel(const char *l) { | |||
789 | if (menu.label) | 795 | if (menu.label) |
790 | delete [] menu.label; | 796 | delete [] menu.label; |
791 | 797 | ||
792 | if (l) menu.label = bstrdup(l); | 798 | if (l) menu.label = StringUtil::strdup(l); |
793 | else menu.label = 0; | 799 | else menu.label = 0; |
794 | } | 800 | } |
795 | 801 | ||