Mercurial > dillo_port1.3
changeset 2119:4b65c2dd3d47
Cancel the tooltip window when a popup menu is shown
author | Jorge Arellano Cid <jcid@dillo.org> |
---|---|
date | Fr, 08 Jul 2011 22:07:59 -0400 |
parents | 0b39c3255490 |
children | 9482fb83d185 |
files | dw/fltkplatform.cc dw/fltkplatform.hh dw/fltkviewbase.cc dw/layout.hh dw/platform.hh |
diffstat | 5 files changed, 30 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/dw/fltkplatform.cc Fr Jul 08 11:56:45 2011 -0400 +++ b/dw/fltkplatform.cc Fr Jul 08 22:07:59 2011 -0400 @@ -272,7 +272,7 @@ 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 @@ } /* - * 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;
--- a/dw/fltkplatform.hh Fr Jul 08 11:56:45 2011 -0400 +++ b/dw/fltkplatform.hh Fr Jul 08 22:07:59 2011 -0400 @@ -65,6 +65,7 @@ char *escaped_str; public: static FltkTooltip *create(const char *text); + static void cancel(); void onEnter(); void onLeave(); void onMotion(); @@ -165,6 +166,7 @@ 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);
--- a/dw/fltkviewbase.cc Fr Jul 08 11:56:45 2011 -0400 +++ b/dw/fltkviewbase.cc Fr Jul 08 22:07:59 2011 -0400 @@ -229,6 +229,9 @@ */ switch(event) { case FL_PUSH: + /* Hide the tooltip */ + theLayout->cancelTooltip(); + processed = theLayout->buttonPress (this, Fl::event_clicks () + 1, translateViewXToCanvasX (Fl::event_x ()),
--- a/dw/layout.hh Fr Jul 08 11:56:45 2011 -0400 +++ b/dw/layout.hh Fr Jul 08 22:07:59 2011 -0400 @@ -337,6 +337,11 @@ 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);
--- a/dw/platform.hh Fr Jul 08 11:56:45 2011 -0400 +++ b/dw/platform.hh Fr Jul 08 22:07:59 2011 -0400 @@ -131,6 +131,11 @@ */ virtual style::Tooltip *createTooltip (const char *text) = 0; + /** + * \brief Cancel a tooltip (either shown or requested) + */ + virtual void cancelTooltip () = 0; + /* * -------------------- * Image Buffers