summaryrefslogtreecommitdiff
path: root/src/fl_draw.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2010-10-30 21:32:15 +0000
committerMatthias Melcher <fltk@matthiasm.com>2010-10-30 21:32:15 +0000
commitb5a73c78e61c18f4d08aec39a6edf5b19b1dbfd4 (patch)
treea3e4da1f20c29e56a31ac7b3cfd411559ab03634 /src/fl_draw.cxx
parent9b6f68dd7ce28ca42e31af0cf2a9c2535b34553f (diff)
Fixed label alignment (STR #2436)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7782 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_draw.cxx')
-rw-r--r--src/fl_draw.cxx7
1 files changed, 4 insertions, 3 deletions
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 = "";