X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FBasemenu.cc;h=57c10fcb65223defa2e2615fc55418b538247e95;hb=6b3f5abde4139d044312d5a3ab53c63e1acf371b;hp=8feb737218ee4daf61b46e37fa72a8cc425f2d72;hpb=1525520dd177f7274ac5e2d2e95c5fa9027e0f48;p=chaz%2Fopenbox diff --git a/src/Basemenu.cc b/src/Basemenu.cc index 8feb7372..57c10fcb 100644 --- a/src/Basemenu.cc +++ b/src/Basemenu.cc @@ -86,8 +86,7 @@ Basemenu::Basemenu(BScreen *scrn) { menu.frame_pixmap = menu.title_pixmap = - menu.hilite_pixmap = - menu.sel_pixmap = None; + menu.hilite_pixmap = None; menu.bevel_w = screen->getBevelWidth(); @@ -176,9 +175,6 @@ Basemenu::~Basemenu(void) { if (menu.hilite_pixmap) image_ctrl->removeImage(menu.hilite_pixmap); - if (menu.sel_pixmap) - image_ctrl->removeImage(menu.sel_pixmap); - blackbox->removeMenuSearch(menu.title); XDestroyWindow(display, menu.title); @@ -202,7 +198,7 @@ int Basemenu::insert(BasemenuItem *item, int pos) { if (pos < 0) { menuitems.push_back(item); } else { - assert(pos < static_cast(menuitems.size())); + assert(pos <= static_cast(menuitems.size())); menuitems.insert((menuitems.begin() + pos), item); } return menuitems.size(); @@ -341,16 +337,6 @@ void Basemenu::update(void) { } if (tmp) image_ctrl->removeImage(tmp); - tmp = menu.sel_pixmap; - if (texture->texture() == (BTexture::Flat | BTexture::Solid)) { - menu.sel_pixmap = None; - } else { - int hw = menu.item_h / 2; - menu.sel_pixmap = - image_ctrl->renderImage(hw, hw, *texture); - } - if (tmp) image_ctrl->removeImage(tmp); - XResizeWindow(display, menu.window, menu.width, menu.height); if (title_vis) @@ -571,8 +557,11 @@ void Basemenu::drawItem(int index, bool highlight, bool clear, } MenuStyle *style = screen->getMenuStyle(); - BPen pen((highlight || item->isSelected()) ? style->h_text : style->f_text), - hipen(style->hilite.color()); + BPen hipen(style->hilite.color()); + // match the text color + BPen pen((highlight ? style->h_text : + (item->isEnabled() ? style->f_text : + style->d_text))); sel_x = item_x; @@ -618,13 +607,39 @@ void Basemenu::drawItem(int index, bool highlight, bool clear, else XFillRectangle(display, menu.frame, hipen.gc(), hilite_x, hilite_y, hilite_w, hilite_h); - } else if (dosel && item->isSelected() && - (menu.sel_pixmap != ParentRelative)) { - if (menu.sel_pixmap) - XCopyArea(display, menu.sel_pixmap, menu.frame, hipen.gc(), 0, 0, - half_w, half_w, sel_x, sel_y); - else - XFillRectangle(display, menu.frame, hipen.gc(), sel_x, sel_y, half_w, half_w); + } + + if (dosel && item->isSelected()) { + XPoint pts[6]; + + // put the check mark on the opposite side of the menu + int x = sel_x; + if (screen->getMenuStyle()->bullet_pos == Right) + x -= (menu.item_w - menu.item_h - menu.bevel_w); + else + x += (menu.item_w - menu.item_h - menu.bevel_w); + + pts[0].x = x + 0; + pts[0].y = sel_y + 2; + + pts[1].x = 0; + pts[1].y = 3; + + pts[2].x = 2; + pts[2].y = 3; + + pts[3].x = 5; + pts[3].y = -5; + + + pts[4].x = 0; + pts[4].y = -3; + + pts[5].x = -5; + pts[5].y = 5; + + XFillPolygon(display, menu.frame, pen.gc(), pts, 6, Nonconvex, + CoordModePrevious); } if (dotext && text) {