diff options
Diffstat (limited to 'dw/fltkplatform.cc')
-rw-r--r-- | dw/fltkplatform.cc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc index 4ceca58d..e4d9a874 100644 --- a/dw/fltkplatform.cc +++ b/dw/fltkplatform.cc @@ -25,6 +25,8 @@ #include <fltk/run.h> #include <fltk/events.h> #include <fltk/Monitor.h> +#include <fltk/InvisibleBox.h> +#include <fltk/Tooltip.h> #include <fltk/utf.h> #include <stdio.h> @@ -143,6 +145,45 @@ FltkColor * FltkColor::create (int col) return color; } +::fltk::Widget *FltkTooltip::widget = NULL; + +FltkTooltip::FltkTooltip (const char *text) : Tooltip(text) +{ + /* ::fltk::Tooltip really, really wants a Widget */ + if (!widget) + widget = new ::fltk::InvisibleBox(1, 1, 0, 0, NULL); + shown = false; +} + +FltkTooltip::~FltkTooltip () +{ + if (shown) + ::fltk::Tooltip::exit(); +} + +FltkTooltip *FltkTooltip::create (const char *text) +{ + return new FltkTooltip(text); +} + +void FltkTooltip::onEnter() +{ + Rectangle rect; + widget->get_absolute_rect(&rect); + ::fltk::Tooltip::enter(widget, rect, str); + shown = true; +} + +void FltkTooltip::onLeave() +{ + ::fltk::Tooltip::exit(); + shown = false; +} + +void FltkTooltip::onMotion() +{ +} + void FltkView::addFltkWidget (::fltk::Widget *widget, core::Allocation *allocation) { @@ -384,6 +425,11 @@ core::style::Color *FltkPlatform::createColor (int color) return FltkColor::create (color); } +core::style::Tooltip *FltkPlatform::createTooltip (const char *text) +{ + return FltkTooltip::create (text); +} + void FltkPlatform::copySelection(const char *text) { fltk::copy(text, strlen(text), false); |