STR 2711: another try at fixing the text position in Menu_Button. The label does move a little bit to the left, so it may be necessary to make these buttons larger for long text. It does reduce the risk of overlapping text though.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9668 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2012-08-16 21:35:14 +00:00
parent 590c315081
commit d751db12ff

View File

@ -23,21 +23,23 @@
static Fl_Menu_Button *pressed_menu_button_ = 0;
void Fl_Menu_Button::draw() {
if (!box() || type()) return;
int H = (labelsize()-3)&-2;
int X = x()+w()-H-Fl::box_dx(box())-Fl::box_dw(box())-1;
int Y = y()+(h()-H)/2;
draw_box(pressed_menu_button_ == this ? fl_down(box()) : box(), color());
draw_label();
draw_label(x()+Fl::box_dx(box()), y(), X-x()+2, h());
if (Fl::focus() == this) draw_focus();
// ** if (box() == FL_FLAT_BOX) return; // for XForms compatibility
int H = (labelsize()-3)&-2;
int X = x()+w()-H*2;
int Y = y()+(h()-H)/2;
fl_color(active_r() ? FL_DARK3 : fl_inactive(FL_DARK3));
fl_line(X+H/2, Y+H, X, Y, X+H, Y);
fl_color(active_r() ? FL_LIGHT3 : fl_inactive(FL_LIGHT3));
fl_line(X+H, Y, X+H/2, Y+H);
}
/**
Act exactly as though the user clicked the button or typed the
shortcut key. The menu appears, it waits for the user to pick an item,