MenuItems::const_iterator it = menuitems.begin();
while (it != menuitems.end()) {
BasemenuItem *item = *it;
- if ((! internal_menu)) {
+ if (! internal_menu) {
Basemenu *tmp = (Basemenu *) item->submenu();
if (tmp) {
if (! tmp->internal_menu) {
BasemenuItem *item = find(index);
if (! item) return -1;
- if ((! internal_menu)) {
+ if (! internal_menu) {
Basemenu *tmp = (Basemenu *) item->submenu();
if (tmp) {
if (! tmp->internal_menu) {
void Basemenu::update(void) {
MenuStyle *style = screen->getMenuStyle();
- menu.item_h = style->f_font->height() + menu.bevel_w;
+ menu.item_h = (style->f_font->height() < 9 ? 9 : style->f_font->height()) +
+ menu.bevel_w; // 9 for the menu pixmaps (checkmarks)
menu.title_h = style->t_font->height() + menu.bevel_w * 2;
if (title_vis) {
void Basemenu::hide(void) {
- if ((! torn) && hide_tree && parent && parent->isVisible()) {
+ if (! torn && hide_tree && parent && parent->isVisible()) {
Basemenu *p = parent;
- while (p->isVisible() && (! p->torn) && p->parent) p = p->parent;
+ while (p->isVisible() && ! p->torn && p->parent) p = p->parent;
p->internal_hide();
} else {
internal_hide();
if (tmp)
tmp->submenu()->internal_hide();
- if (parent && (! torn)) {
+ if (parent && ! torn) {
parent->drawItem(parent->which_sub, False, True);
parent->which_sub = -1;
}
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;
if (dosel && item->isSelected()) {
XPoint pts[6];
- pts[0].x = sel_x + 0;
+ // 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[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, Complex,
+ XFillPolygon(display, menu.frame, pen.gc(), pts, 6, Nonconvex,
CoordModePrevious);
}
if (me->window == menu.title && (me->state & Button1Mask)) {
if (movable) {
if (! moving) {
- if (parent && (! torn)) {
+ if (parent && ! torn) {
parent->drawItem(parent->which_sub, False, True);
parent->which_sub = -1;
}
drawSubmenu(which_sub);
}
}
- } else if ((! (me->state & Button1Mask)) && me->window == menu.frame &&
+ } else if (! (me->state & Button1Mask) && me->window == menu.frame &&
me->x >= 0 && me->x < static_cast<signed>(menu.width) &&
me->y >= 0 && me->y < static_cast<signed>(menu.frame_h)) {
int sbl = (me->x / menu.item_w), i = (me->y / menu.item_h),
drawItem(p, False, True);
if (item->submenu())
if (item->submenu()->isVisible() &&
- (! item->submenu()->isTorn())) {
+ ! item->submenu()->isTorn()) {
item->submenu()->internal_hide();
which_sub = -1;
}
int sbl = (ce->x / menu.item_w), i = (ce->y / menu.item_h),
w = (sbl * menu.persub) + i;
- if (w != which_sub && (! tmp->submenu()->isTorn())) {
+ if (w != which_sub && ! tmp->submenu()->isTorn()) {
tmp->submenu()->internal_hide();
drawItem(which_sub, False, True);