summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2012-08-16 21:35:14 +0000
committerMatthias Melcher <fltk@matthiasm.com>2012-08-16 21:35:14 +0000
commitd751db12ffbce8f739a2bc838bc83c6108ae3ab9 (patch)
tree7226f77ee7c3280143386bdff797cd52810ebd1d
parent590c31508196bcb444349c941bc729a8ec3f7cea (diff)
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
-rw-r--r--src/Fl_Menu_Button.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Fl_Menu_Button.cxx b/src/Fl_Menu_Button.cxx
index f77035697..74bf62430 100644
--- a/src/Fl_Menu_Button.cxx
+++ b/src/Fl_Menu_Button.cxx
@@ -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,