changeset 2126:b276589a8833

tooltip label measurement and alignment
author corvid <corvid@lavabit.com>
date Mo, 11 Jul 2011 21:37:33 +0000
parents 1805403bb868
children 27c002d2267a
files dw/fltkplatform.cc
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dw/fltkplatform.cc	Mo Jul 11 21:31:11 2011 +0000
+++ b/dw/fltkplatform.cc	Mo Jul 11 21:37:33 2011 +0000
@@ -292,7 +292,7 @@
       b->color(fl_color_cube(FL_NUM_RED-1, FL_NUM_GREEN-1, FL_NUM_BLUE-2));
       b->labelfont(FL_HELVETICA);
       b->labelsize(14);
-      b->align(FL_ALIGN_WRAP);
+      b->align(FL_ALIGN_WRAP|FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
       tt_window->resizable(b);
       tt_window->end();
    }
@@ -303,11 +303,11 @@
    box->label(str);
    Fl::get_mouse(x,y); y += 6;
    /* calculate window size */
-   fl_font(box->labelfont(), box->labelsize());
    int ww, hh;
    ww = 800; // max width;
-   fl_measure(str,ww,hh,FL_ALIGN_LEFT|FL_ALIGN_WRAP|FL_ALIGN_INSIDE);
-   ww += 6; hh += 6;
+   box->measure_label(ww, hh);
+   ww += 6 + 2 * Fl::box_dx(box->box());
+   hh += 6 + 2 * Fl::box_dy(box->box());
    tt_window->resize(x,y,ww,hh);
    tt_window->show();
    in_tooltip = 1;