menu.frame_pixmap =
menu.title_pixmap =
- menu.hilite_pixmap =
- menu.sel_pixmap = None;
+ menu.hilite_pixmap = None;
menu.bevel_w = screen->getBevelWidth();
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);
if (pos < 0) {
menuitems.push_back(item);
} else {
- assert(pos < static_cast<signed>(menuitems.size()));
+ assert(pos <= static_cast<signed>(menuitems.size()));
menuitems.insert((menuitems.begin() + pos), item);
}
return menuitems.size();
}
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)
void Basemenu::redrawTitle(void) {
const char *text = (! menu.label.empty()) ? getLabel() :
i18n(BasemenuSet, BasemenuBlackboxMenu, "Blackbox Menu");
- int dx = menu.bevel_w, len = strlen(text);
+ int dx = menu.bevel_w;
unsigned int l;
MenuStyle *style = screen->getMenuStyle();
int sbl = index / menu.persub, i = index - (sbl * menu.persub);
int item_x = (sbl * menu.item_w), item_y = (i * menu.item_h);
int hilite_x = item_x, hilite_y = item_y, hoff_x = 0, hoff_y = 0;
- int text_x = 0, text_y = 0, len = strlen(text), sel_x = 0, sel_y = 0;
+ int text_x = 0, text_y = 0, sel_x = 0, sel_y = 0;
unsigned int hilite_w = menu.item_w, hilite_h = menu.item_h, text_w = 0,
text_h = 0;
unsigned int half_w = menu.item_h / 2, quarter_w = menu.item_h / 4;
}
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;
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) {
}
if (dosel && item->submenu()) {
+ const int bullet_size = 3;
+
switch (screen->getMenuStyle()->bullet) {
case Square:
- XDrawRectangle(display, menu.frame, pen.gc(), sel_x, sel_y, half_w, half_w);
+ XDrawRectangle(display, menu.frame, pen.gc(), sel_x, sel_y,
+ bullet_size * 2, bullet_size * 2);
break;
case Triangle:
XPoint tri[3];
if (screen->getMenuStyle()->bullet_pos == Right) {
- tri[0].x = sel_x + quarter_w - 2;
- tri[0].y = sel_y + quarter_w - 2;
- tri[1].x = 4;
- tri[1].y = 2;
- tri[2].x = -4;
- tri[2].y = 2;
+ tri[0].x = sel_x + quarter_w - bullet_size;
+ tri[0].y = sel_y + quarter_w - bullet_size;
+ tri[1].x = 2 * bullet_size;
+ tri[1].y = bullet_size;
+ tri[2].x = -(2 * bullet_size);
+ tri[2].y = bullet_size;
} else {
- tri[0].x = sel_x + quarter_w - 2;
+ tri[0].x = sel_x + quarter_w - bullet_size;
tri[0].y = item_y + half_w;
- tri[1].x = 4;
- tri[1].y = 2;
+ tri[1].x = 2 * bullet_size;
+ tri[1].y = bullet_size;
tri[2].x = 0;
- tri[2].y = -4;
+ tri[2].y = -(2 * bullet_size);
}
XFillPolygon(display, menu.frame, pen.gc(), tri, 3, Convex,
case Diamond:
XPoint dia[4];
- dia[0].x = sel_x + quarter_w - 3;
+ dia[0].x = sel_x + quarter_w - bullet_size;
dia[0].y = item_y + half_w;
- dia[1].x = 3;
- dia[1].y = -3;
- dia[2].x = 3;
- dia[2].y = 3;
- dia[3].x = -3;
- dia[3].y = 3;
+ dia[1].x = bullet_size;
+ dia[1].y = -bullet_size;
+ dia[2].x = bullet_size;
+ dia[2].y = bullet_size;
+ dia[3].x = -bullet_size;
+ dia[3].y = bullet_size;
XFillPolygon(display, menu.frame, pen.gc(), dia, 4, Convex,
CoordModePrevious);