diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Group.cxx | 28 | ||||
| -rw-r--r-- | src/fl_labeltype.cxx | 12 |
2 files changed, 26 insertions, 14 deletions
diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx index 7b10dc9f3..b4ef6d91c 100644 --- a/src/Fl_Group.cxx +++ b/src/Fl_Group.cxx @@ -793,36 +793,40 @@ void Fl_Group::draw_outside_label(const Fl_Widget& widget) const { } else { wx = x(); wy = y(); } - if ( (a & 0x0f) == FL_ALIGN_LEFT_TOP ) { - a = (a &~0x0f ) | FL_ALIGN_TOP_RIGHT; + if ( (a & FL_ALIGN_POSITION_MASK) == FL_ALIGN_LEFT_TOP ) { + a = (a &(~FL_ALIGN_POSITION_MASK) ) | FL_ALIGN_TOP_RIGHT; X = wx; W = widget.x()-X-3; - } else if ( (a & 0x0f) == FL_ALIGN_LEFT_BOTTOM ) { - a = (a &~0x0f ) | FL_ALIGN_BOTTOM_RIGHT; + } else if ( (a & FL_ALIGN_POSITION_MASK) == FL_ALIGN_LEFT_BOTTOM ) { + a = (a &(~FL_ALIGN_POSITION_MASK) ) | FL_ALIGN_BOTTOM_RIGHT; X = wx; W = widget.x()-X-3; - } else if ( (a & 0x0f) == FL_ALIGN_RIGHT_TOP ) { - a = (a &~0x0f ) | FL_ALIGN_TOP_LEFT; + } else if ( (a & FL_ALIGN_POSITION_MASK) == FL_ALIGN_RIGHT_TOP ) { + a = (a &(~FL_ALIGN_POSITION_MASK) ) | FL_ALIGN_TOP_LEFT; X = X+W+3; W = wx+this->w()-X; - } else if ( (a & 0x0f) == FL_ALIGN_RIGHT_BOTTOM ) { - a = (a &~0x0f ) | FL_ALIGN_BOTTOM_LEFT; + } else if ( (a & FL_ALIGN_POSITION_MASK) == FL_ALIGN_RIGHT_BOTTOM ) { + a = (a &(~FL_ALIGN_POSITION_MASK) ) | FL_ALIGN_BOTTOM_LEFT; X = X+W+3; W = wx+this->w()-X; } else if (a & FL_ALIGN_TOP) { - a ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP); + a ^= FL_ALIGN_TOP; + a |= FL_ALIGN_BOTTOM; Y = wy; H = widget.y()-Y; } else if (a & FL_ALIGN_BOTTOM) { - a ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP); + a ^= FL_ALIGN_BOTTOM; + a |= FL_ALIGN_TOP; Y = Y+H; H = wy+h()-Y; } else if (a & FL_ALIGN_LEFT) { - a ^= (FL_ALIGN_LEFT|FL_ALIGN_RIGHT); + a ^= FL_ALIGN_LEFT; + a |= FL_ALIGN_RIGHT; X = wx; W = widget.x()-X-3; } else if (a & FL_ALIGN_RIGHT) { - a ^= (FL_ALIGN_LEFT|FL_ALIGN_RIGHT); + a ^= FL_ALIGN_RIGHT; + a |= FL_ALIGN_LEFT; X = X+W+3; W = wx+this->w()-X; } 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; + } } } |
