Fix button label clipping (STR #3237).

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10775 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser
2015-06-27 15:20:23 +00:00
parent 9801bb7839
commit a7670ae8d4
2 changed files with 13 additions and 12 deletions
+8 -8
View File
@@ -33,13 +33,12 @@ void Fl_Light_Button::draw() {
if (box()) draw_box(this==Fl::pushed() ? fl_down(box()) : box(), color()); if (box()) draw_box(this==Fl::pushed() ? fl_down(box()) : box(), color());
Fl_Color col = value() ? (active_r() ? selection_color() : Fl_Color col = value() ? (active_r() ? selection_color() :
fl_inactive(selection_color())) : color(); fl_inactive(selection_color())) : color();
int W;
int dx, dy;
W = labelsize(); int W = labelsize();
dx = Fl::box_dx(box()) + 2; int bx = Fl::box_dx(box()); // box frame width
dy = (h() - W) / 2; int dx = bx + 2; // relative position of check mark etc.
// if (dy < 0) dy = 0; // neg. offset o.k. for vertical centering int dy = (h() - W) / 2; // neg. offset o.k. for vertical centering
int lx = 0; // relative label position (STR #3237)
if (down_box()) { if (down_box()) {
// draw other down_box() styles: // draw other down_box() styles:
@@ -120,6 +119,7 @@ void Fl_Light_Button::draw() {
draw_box(down_box(), x()+dx, y()+dy, W, W, col); draw_box(down_box(), x()+dx, y()+dy, W, W, col);
break; break;
} }
lx = dx + W + 2;
} else { } else {
// if down_box() is zero, draw light button style: // if down_box() is zero, draw light button style:
int hh = h()-2*dy - 2; int hh = h()-2*dy - 2;
@@ -133,9 +133,9 @@ void Fl_Light_Button::draw() {
} else { } else {
draw_box(FL_THIN_DOWN_BOX, x()+xx, y()+dy+1, ww, hh, col); draw_box(FL_THIN_DOWN_BOX, x()+xx, y()+dy+1, ww, hh, col);
} }
dx = (ww + 2 * dx - W) / 2; lx = dx + ww + 2;
} }
draw_label(x()+W+2*dx, y(), w()-W-2*dx, h()); draw_label(x()+lx, y(), w()-lx-bx, h());
if (Fl::focus() == this) draw_focus(); if (Fl::focus() == this) draw_focus();
} }
+5 -4
View File
@@ -40,12 +40,13 @@ int fl_return_arrow(int x, int y, int w, int h) {
void Fl_Return_Button::draw() { void Fl_Return_Button::draw() {
if (type() == FL_HIDDEN_BUTTON) return; if (type() == FL_HIDDEN_BUTTON) return;
draw_box(value() ? (down_box()?down_box():fl_down(box())) : box(), Fl_Boxtype bt = value() ? (down_box()?down_box():fl_down(box())) : box();
value() ? selection_color() : color()); int dx = Fl::box_dx(bt);
draw_box(bt, value() ? selection_color() : color());
int W = h(); int W = h();
if (w()/3 < W) W = w()/3; if (w()/3 < W) W = w()/3;
fl_return_arrow(x()+w()-W-4, y(), W, h()); fl_return_arrow(x()+w()-(W+dx), y(), W, h());
draw_label(x(), y(), w()-W+4, h()); draw_label(x()+dx, y(), w()-(dx+W+dx), h());
if (Fl::focus() == this) draw_focus(); if (Fl::focus() == this) draw_focus();
} }