diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2015-06-27 15:20:23 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2015-06-27 15:20:23 +0000 |
| commit | a7670ae8d4d786df2c7936bfbbb7d4ba87d714be (patch) | |
| tree | 49cbec1bb00e6b1ed0fd789b1ad0e7a2f980d4b7 /src | |
| parent | 9801bb7839ae30cf448c40385610a72d758c2a73 (diff) | |
Fix button label clipping (STR #3237).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10775 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Light_Button.cxx | 16 | ||||
| -rw-r--r-- | src/Fl_Return_Button.cxx | 9 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/Fl_Light_Button.cxx b/src/Fl_Light_Button.cxx index 3044f802a..33ecbc116 100644 --- a/src/Fl_Light_Button.cxx +++ b/src/Fl_Light_Button.cxx @@ -33,13 +33,12 @@ void Fl_Light_Button::draw() { if (box()) draw_box(this==Fl::pushed() ? fl_down(box()) : box(), color()); Fl_Color col = value() ? (active_r() ? selection_color() : fl_inactive(selection_color())) : color(); - int W; - int dx, dy; - W = labelsize(); - dx = Fl::box_dx(box()) + 2; - dy = (h() - W) / 2; - // if (dy < 0) dy = 0; // neg. offset o.k. for vertical centering + int W = labelsize(); + int bx = Fl::box_dx(box()); // box frame width + int dx = bx + 2; // relative position of check mark etc. + int dy = (h() - W) / 2; // neg. offset o.k. for vertical centering + int lx = 0; // relative label position (STR #3237) if (down_box()) { // 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); break; } + lx = dx + W + 2; } else { // if down_box() is zero, draw light button style: int hh = h()-2*dy - 2; @@ -133,9 +133,9 @@ void Fl_Light_Button::draw() { } else { 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(); } diff --git a/src/Fl_Return_Button.cxx b/src/Fl_Return_Button.cxx index 9e144b8ec..c816db0f7 100644 --- a/src/Fl_Return_Button.cxx +++ b/src/Fl_Return_Button.cxx @@ -40,12 +40,13 @@ int fl_return_arrow(int x, int y, int w, int h) { void Fl_Return_Button::draw() { if (type() == FL_HIDDEN_BUTTON) return; - draw_box(value() ? (down_box()?down_box():fl_down(box())) : box(), - value() ? selection_color() : color()); + Fl_Boxtype bt = value() ? (down_box()?down_box():fl_down(box())) : box(); + int dx = Fl::box_dx(bt); + draw_box(bt, value() ? selection_color() : color()); int W = h(); if (w()/3 < W) W = w()/3; - fl_return_arrow(x()+w()-W-4, y(), W, h()); - draw_label(x(), y(), w()-W+4, h()); + fl_return_arrow(x()+w()-(W+dx), y(), W, h()); + draw_label(x()+dx, y(), w()-(dx+W+dx), h()); if (Fl::focus() == this) draw_focus(); } |
