diff options
-rw-r--r-- | dw/fltkplatform.cc | 18 | ||||
-rw-r--r-- | dw/fltkplatform.hh | 1 |
2 files changed, 18 insertions, 1 deletions
diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc index 00e1d07e..6d0b2ec4 100644 --- a/dw/fltkplatform.cc +++ b/dw/fltkplatform.cc @@ -191,10 +191,26 @@ FltkColor * FltkColor::create (int col) FltkTooltip::FltkTooltip (const char *text) : Tooltip(text) { + if (!strchr(text, '@')) { + escaped_str = NULL; + } else { + /* FLTK likes to interpret symbols, and so they must be escaped */ + const char *src = text; + char *dest = escaped_str = (char *) malloc(strlen(text) * 2 + 1); + + while (*src) { + if (*src == '@') + *dest++ = *src; + *dest++ = *src++; + } + *dest = '\0'; + } } FltkTooltip::~FltkTooltip () { + if (escaped_str) + free(escaped_str); } FltkTooltip *FltkTooltip::create (const char *text) @@ -207,7 +223,7 @@ void FltkTooltip::onEnter() Fl_Widget *widget = Fl::belowmouse(); Fl_Tooltip::enter_area(widget, widget->x(), widget->y(), widget->w(), - widget->h(), str); + widget->h(), escaped_str ? escaped_str : str); } void FltkTooltip::onLeave() diff --git a/dw/fltkplatform.hh b/dw/fltkplatform.hh index 62bc3e0e..134b5c54 100644 --- a/dw/fltkplatform.hh +++ b/dw/fltkplatform.hh @@ -59,6 +59,7 @@ class FltkTooltip: public core::style::Tooltip private: FltkTooltip (const char *text); ~FltkTooltip (); + char *escaped_str; public: static FltkTooltip *create(const char *text); void onEnter(); |