summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx1
-rw-r--r--src/Fl_Group.cxx22
-rw-r--r--src/fl_draw.cxx7
3 files changed, 19 insertions, 11 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index c2e0c3eaf..ec5750617 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1414,6 +1414,7 @@ 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) {
diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx
index a84cd2d7e..c25e7fffc 100644
--- a/src/Fl_Group.cxx
+++ b/src/Fl_Group.cxx
@@ -789,38 +789,44 @@ void Fl_Group::draw_outside_label(const Fl_Widget& widget) const {
int Y = widget.y();
int W = widget.w();
int H = widget.h();
+ int wx, wy;
+ if (const_cast<Fl_Group*>(this)->as_window()) {
+ wx = wy = 0;
+ } else {
+ wx = x(); wy = y();
+ }
if ( (a & 0x0f) == FL_ALIGN_LEFT_TOP ) {
a = (a &~0x0f ) | FL_ALIGN_TOP_RIGHT;
- X = x();
+ X = wx;
W = widget.x()-X-3;
} else if ( (a & 0x0f) == FL_ALIGN_LEFT_BOTTOM ) {
a = (a &~0x0f ) | FL_ALIGN_BOTTOM_RIGHT;
- X = x();
+ X = wx;
W = widget.x()-X-3;
} else if ( (a & 0x0f) == FL_ALIGN_RIGHT_TOP ) {
a = (a &~0x0f ) | FL_ALIGN_TOP_LEFT;
X = X+W+3;
- W = x()+this->w()-X;
+ W = wx+this->w()-X;
} else if ( (a & 0x0f) == FL_ALIGN_RIGHT_BOTTOM ) {
a = (a &~0x0f ) | FL_ALIGN_BOTTOM_LEFT;
X = X+W+3;
- W = x()+this->w()-X;
+ W = wx+this->w()-X;
} else if (a & FL_ALIGN_TOP) {
a ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP);
- Y = y();
+ Y = wy;
H = widget.y()-Y;
} else if (a & FL_ALIGN_BOTTOM) {
a ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP);
Y = Y+H;
- H = y()+h()-Y;
+ H = wy+h()-Y;
} else if (a & FL_ALIGN_LEFT) {
a ^= (FL_ALIGN_LEFT|FL_ALIGN_RIGHT);
- X = x();
+ X = wx;
W = widget.x()-X-3;
} else if (a & FL_ALIGN_RIGHT) {
a ^= (FL_ALIGN_LEFT|FL_ALIGN_RIGHT);
X = X+W+3;
- W = x()+this->w()-X;
+ W = wx+this->w()-X;
}
widget.draw_label(X,Y,W,H,(Fl_Align)a);
}
diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx
index 36a4e5cb7..5e07aaf69 100644
--- a/src/fl_draw.cxx
+++ b/src/fl_draw.cxx
@@ -193,7 +193,7 @@ void fl_draw(
char buf[MAXBUF];
int buflen;
char symbol[2][255], *symptr;
- int symwidth[2], symoffset, symtotal;
+ int symwidth[2], symoffset, symtotal, imgtotal;
// count how many lines and put the last one into the buffer:
int lines;
@@ -226,13 +226,14 @@ void fl_draw(
}
symtotal = symwidth[0] + symwidth[1];
+ imgtotal = (img && (align&FL_ALIGN_IMAGE_NEXT_TO_TEXT)) ? img->w() : 0;
int strw = 0;
int strh;
if (str) {
for (p = str, lines=0; p;) {
- e = fl_expand_text(p, buf, MAXBUF, w - symtotal, buflen, width,
+ e = fl_expand_text(p, buf, MAXBUF, w - symtotal - imgtotal, buflen, width,
align&FL_ALIGN_WRAP, draw_symbols);
if (strw<width) strw = (int)width;
lines++;
@@ -299,7 +300,7 @@ void fl_draw(
if (str) {
int desc = fl_descent();
for (p=str; ; ypos += height) {
- if (lines>1) e = fl_expand_text(p, buf, MAXBUF, w - symtotal, buflen,
+ if (lines>1) e = fl_expand_text(p, buf, MAXBUF, w - symtotal - imgtotal, buflen,
width, align&FL_ALIGN_WRAP, draw_symbols);
else e = "";