summaryrefslogtreecommitdiff
path: root/src/fl_labeltype.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2017-02-27 17:00:41 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2017-02-27 17:00:41 +0000
commita60f99d4a1a94bd19125dce89555983f2fa4841c (patch)
treee726a8933bfb3e6c901aff3fb2d19835f09b4034 /src/fl_labeltype.cxx
parent2d18660f5cf06acff7446dd9983e3f76b97cb420 (diff)
Improve label alignment docs and border case implementations.
Make clear that some alignment bit combinations are "illegal" and yield undefined behavior that can be changed without notice. Fix label alignment in some border cases where illegal bit combinations like FL_ALIGN_LEFT and FL_ALIGN_RIGHT or FL_ALIGN_TOP and FL_ALIGN_BOTTOM are both set, respectively. Todo: There appears to be inconsistent handling WRT these "illegal" cases, for instance with inside labels as opposed to outside labels, such that the behavior seems to be unpredictable. See test/label.cxx. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12181 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_labeltype.cxx')
-rw-r--r--src/fl_labeltype.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/fl_labeltype.cxx b/src/fl_labeltype.cxx
index ce86e7f33..b8c84f46e 100644
--- a/src/fl_labeltype.cxx
+++ b/src/fl_labeltype.cxx
@@ -42,8 +42,16 @@ fl_normal_measure(const Fl_Label* o, int& W, int& H) {
fl_font(o->font, o->size);
fl_measure(o->value, W, H);
if (o->image) {
- if (o->image->w() > W) W = o->image->w();
- H += o->image->h();
+ int iw = o->image->w(), ih = o->image->h();
+ if (o->align_ & FL_ALIGN_IMAGE_BACKDROP) { // backdrop: ignore
+ // ignore backdrop image for calculation
+ } else if (o->align_ & FL_ALIGN_IMAGE_NEXT_TO_TEXT) { // text and image side by side
+ W += iw;
+ if (ih > H) H = ih;
+ } else {
+ if (iw > W) W = iw;
+ H += ih;
+ }
}
}