diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2010-10-31 19:35:23 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2010-10-31 19:35:23 +0000 |
| commit | 48f107775d2a1363522aa96e92d07c876a6f759a (patch) | |
| tree | 39674326c3901f7b41d32350ff78caf0f5ad6e29 /src | |
| parent | e811ef7138f07ba3e1a97c28ad4b42b74fe328e5 (diff) | |
Fixed outside label redraw damage areas (STR #2436)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7787 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl.cxx | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx index ec5750617..9ebf023f6 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1414,17 +1414,36 @@ void Fl_Widget::redraw_label() { W += 5; // Add a little to the size of the label to cover overflow H += 5; - // FIXME: this does not take all outside label positions into account! - if (align() & FL_ALIGN_BOTTOM) { - window()->damage(FL_DAMAGE_EXPOSE, x(), y() + h(), w(), H); - } else if (align() & FL_ALIGN_TOP) { - window()->damage(FL_DAMAGE_EXPOSE, x(), y() - H, w(), H); - } else if (align() & FL_ALIGN_LEFT) { - window()->damage(FL_DAMAGE_EXPOSE, x() - W, y(), W, h()); - } else if (align() & FL_ALIGN_RIGHT) { - window()->damage(FL_DAMAGE_EXPOSE, x() + w(), y(), W, h()); - } else { - window()->damage(FL_DAMAGE_ALL); + // FIXME: + // This assumes the measure() returns the correct outline, which it does + // not in all possible cases of alignment combinedwith image and symbols. + switch (align() & 0x0f) { + case FL_ALIGN_TOP_LEFT: + window()->damage(FL_DAMAGE_EXPOSE, x(), y()-H, W, H); break; + case FL_ALIGN_TOP: + window()->damage(FL_DAMAGE_EXPOSE, x()+(w()-W)/2, y()-H, W, H); break; + case FL_ALIGN_TOP_RIGHT: + window()->damage(FL_DAMAGE_EXPOSE, x()+w()-W, y()-H, W, H); break; + case FL_ALIGN_LEFT_TOP: + window()->damage(FL_DAMAGE_EXPOSE, x()-W, y(), W, H); break; + case FL_ALIGN_RIGHT_TOP: + window()->damage(FL_DAMAGE_EXPOSE, x()+w(), y(), W, H); break; + case FL_ALIGN_LEFT: + window()->damage(FL_DAMAGE_EXPOSE, x()-W, y()+(h()-H)/2, W, H); break; + case FL_ALIGN_RIGHT: + window()->damage(FL_DAMAGE_EXPOSE, x()+w(), y()+(h()-H)/2, W, H); break; + case FL_ALIGN_LEFT_BOTTOM: + window()->damage(FL_DAMAGE_EXPOSE, x()-W, y()+h()-H, W, H); break; + case FL_ALIGN_RIGHT_BOTTOM: + window()->damage(FL_DAMAGE_EXPOSE, x()+w(), y()+h()-H, W, H); break; + case FL_ALIGN_BOTTOM_LEFT: + window()->damage(FL_DAMAGE_EXPOSE, x(), y()+h(), W, H); break; + case FL_ALIGN_BOTTOM: + window()->damage(FL_DAMAGE_EXPOSE, x()+(w()-W)/2, y()+h(), W, H); break; + case FL_ALIGN_BOTTOM_RIGHT: + window()->damage(FL_DAMAGE_EXPOSE, x()+w()-W, y()+h(), W, H); break; + default: + window()->damage(FL_DAMAGE_ALL); break; } } else { // The label is inside the widget, so just redraw the widget itself... |
