summaryrefslogtreecommitdiff
path: root/dw/fltkplatform.cc
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2009-10-03 02:22:31 +0000
committercorvid <corvid@lavabit.com>2009-10-03 02:22:31 +0000
commit74c690bc83186311a0567b5d35edd30961104ed4 (patch)
tree237cccf6a1b46b8499bb085bd92619e967f1749a /dw/fltkplatform.cc
parent21979bd9dc1bc58ee8537d92d172ba4b23745a46 (diff)
some tooltips
Diffstat (limited to 'dw/fltkplatform.cc')
-rw-r--r--dw/fltkplatform.cc46
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);