aboutsummaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
Diffstat (limited to 'dw')
-rw-r--r--dw/fltkplatform.cc17
-rw-r--r--dw/fltkplatform.hh2
-rw-r--r--dw/fltkviewbase.cc3
-rw-r--r--dw/layout.hh5
-rw-r--r--dw/platform.hh5
5 files changed, 30 insertions, 2 deletions
diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc
index 02a64636..b22880b0 100644
--- a/dw/fltkplatform.cc
+++ b/dw/fltkplatform.cc
@@ -272,7 +272,7 @@ FltkTooltip::~FltkTooltip ()
if (escaped_str)
free(escaped_str);
if (in_tooltip || req_tooltip)
- onLeave(); /* cancel tooltip window */
+ cancel(); /* cancel tooltip window */
}
FltkTooltip *FltkTooltip::create (const char *text)
@@ -334,11 +334,24 @@ void FltkTooltip::onEnter()
}
/*
- * Remove a shown tooltip or cancel a pending one
+ * Leaving the widget cancels the tooltip
*/
void FltkTooltip::onLeave()
{
_MSG(" FltkTooltip::onLeave in_tooltip=%d\n", in_tooltip);
+ cancel();
+}
+
+void FltkPlatform::cancelTooltip()
+{
+ FltkTooltip::cancel();
+}
+
+/*
+ * Remove a shown tooltip or cancel a pending one
+ */
+void FltkTooltip::cancel()
+{
if (req_tooltip) {
Fl::remove_timeout(tooltip_tcb);
req_tooltip = 0;
diff --git a/dw/fltkplatform.hh b/dw/fltkplatform.hh
index adf56df0..bd3de4f3 100644
--- a/dw/fltkplatform.hh
+++ b/dw/fltkplatform.hh
@@ -65,6 +65,7 @@ private:
char *escaped_str;
public:
static FltkTooltip *create(const char *text);
+ static void cancel();
void onEnter();
void onLeave();
void onMotion();
@@ -165,6 +166,7 @@ public:
bool fontExists (const char *name);
core::style::Color *createColor (int color);
core::style::Tooltip *createTooltip (const char *text);
+ void cancelTooltip();
core::Imgbuf *createImgbuf (core::Imgbuf::Type type, int width, int height);
diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc
index 066d3354..f2fd96fc 100644
--- a/dw/fltkviewbase.cc
+++ b/dw/fltkviewbase.cc
@@ -229,6 +229,9 @@ int FltkViewBase::handle (int event)
*/
switch(event) {
case FL_PUSH:
+ /* Hide the tooltip */
+ theLayout->cancelTooltip();
+
processed =
theLayout->buttonPress (this, Fl::event_clicks () + 1,
translateViewXToCanvasX (Fl::event_x ()),
diff --git a/dw/layout.hh b/dw/layout.hh
index 0ac1ea5b..98aa4fc1 100644
--- a/dw/layout.hh
+++ b/dw/layout.hh
@@ -337,6 +337,11 @@ public:
return platform->createTooltip (text);
}
+ inline void cancelTooltip ()
+ {
+ return platform->cancelTooltip ();
+ }
+
inline Imgbuf *createImgbuf (Imgbuf::Type type, int width, int height)
{
return platform->createImgbuf (type, width, height);
diff --git a/dw/platform.hh b/dw/platform.hh
index 69d1feab..b79b5346 100644
--- a/dw/platform.hh
+++ b/dw/platform.hh
@@ -131,6 +131,11 @@ public:
*/
virtual style::Tooltip *createTooltip (const char *text) = 0;
+ /**
+ * \brief Cancel a tooltip (either shown or requested)
+ */
+ virtual void cancelTooltip () = 0;
+
/*
* --------------------
* Image Buffers