diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2003-09-14 14:11:06 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2003-09-14 14:11:06 +0000 |
| commit | f6769cebc6734ac38b4732da4997751f6d4cc94c (patch) | |
| tree | 147f947ac1186db68ce2ec628833751579bd7b7d | |
| parent | 8c56fa75c7d2c865778a0e35e242536063acfb4c (diff) | |
Add Fl_Tooltip::hoverdelay() method and code (STR #126)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3102 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | FL/Fl_Tooltip.H | 7 | ||||
| -rw-r--r-- | documentation/Fl_Tooltip.html | 19 | ||||
| -rw-r--r-- | src/Fl_Tooltip.cxx | 12 |
4 files changed, 28 insertions, 12 deletions
@@ -1,5 +1,7 @@ CHANGES IN FLTK 1.1.5rc1 + - Added new hoverdelay() to Fl_Tooltip to control how + quickly recent tooltips appear (STR #126) - FLUID now sets the size range when a window is shown. This seems to be necessary with some window managers (STR #166) diff --git a/FL/Fl_Tooltip.H b/FL/Fl_Tooltip.H index ce7b0721a..6582087b2 100644 --- a/FL/Fl_Tooltip.H +++ b/FL/Fl_Tooltip.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Tooltip.H,v 1.16.2.10 2003/01/30 21:40:28 easysw Exp $" +// "$Id: Fl_Tooltip.H,v 1.16.2.11 2003/09/14 14:11:06 easysw Exp $" // // Tooltip header file for the Fast Light Tool Kit (FLTK). // @@ -33,6 +33,8 @@ class FL_EXPORT Fl_Tooltip { public: static float delay() { return delay_; } static void delay(float f) { delay_ = f; } + static float hoverdelay() { return hoverdelay_; } + static void hoverdelay(float f) { hoverdelay_ = f; } static int enabled() { return enabled_; } static void enable(int b = 1) { enabled_ = b;} static void disable() { enabled_ = 0; } @@ -52,6 +54,7 @@ public: static Fl_Color textcolor() { return (Fl_Color)textcolor_; } private: static float delay_; + static float hoverdelay_; static int enabled_; static unsigned color_; static unsigned textcolor_; @@ -63,5 +66,5 @@ private: #endif // -// End of "$Id: Fl_Tooltip.H,v 1.16.2.10 2003/01/30 21:40:28 easysw Exp $". +// End of "$Id: Fl_Tooltip.H,v 1.16.2.11 2003/09/14 14:11:06 easysw Exp $". // diff --git a/documentation/Fl_Tooltip.html b/documentation/Fl_Tooltip.html index 9ac2a2165..f44c2f0c8 100644 --- a/documentation/Fl_Tooltip.html +++ b/documentation/Fl_Tooltip.html @@ -36,6 +36,7 @@ all FLTK widgets.</P> <LI><A HREF="#Fl_Tooltip.enter_area">enter_area</A></LI> <LI><A HREF="#Fl_Tooltip.exit">exit</A></LI> <LI><A HREF="#Fl_Tooltip.font">font</A></LI> + <LI><A HREF="#Fl_Tooltip.hoverdelay">hoverdelay</A></LI> <LI><A HREF="#Fl_Tooltip.size">size</A></LI> <LI><A HREF="#Fl_Tooltip.textcolor">textcolor</A></LI> @@ -86,21 +87,27 @@ Fl_Color color();</A></H4> <P>Gets or sets the background color for tooltips. The default background color is a pale yellow. -<H4><A NAME="Fl_Tooltip.textcolor">void textcolor(unsigned c);<BR> -Fl_Color textcolor();</A></H4> - -<P>Gets or sets the color of the text in the tooltip. The default is -black. - <H4><A NAME="Fl_Tooltip.font">void font(int i);<BR> int font();</A></H4> <P>Gets or sets the typeface for the tooltip text. +<H4><A NAME="Fl_Tooltip.hoverdelay">void hoverdelay(float f);<BR> +float hoverdelay();</A></H4> + +<P>Gets or sets the tooltip hover delay, the delay between tooltips. +The default delay is 0.2 seconds. + <H4><A NAME="Fl_Tooltip.size">void size(int s);<BR> int size();</A></H4> <P>Gets or sets the size of the tooltip text. +<H4><A NAME="Fl_Tooltip.textcolor">void textcolor(unsigned c);<BR> +Fl_Color textcolor();</A></H4> + +<P>Gets or sets the color of the text in the tooltip. The default is +black. + </BODY> </HTML> diff --git a/src/Fl_Tooltip.cxx b/src/Fl_Tooltip.cxx index 3c8c655ef..73866346d 100644 --- a/src/Fl_Tooltip.cxx +++ b/src/Fl_Tooltip.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Tooltip.cxx,v 1.38.2.27 2003/01/30 21:42:53 easysw Exp $" +// "$Id: Fl_Tooltip.cxx,v 1.38.2.28 2003/09/14 14:11:06 easysw Exp $" // // Tooltip source file for the Fast Light Tool Kit (FLTK). // @@ -30,6 +30,7 @@ #include <stdio.h> float Fl_Tooltip::delay_ = 1.0f; +float Fl_Tooltip::hoverdelay_ = 0.2f; int Fl_Tooltip::enabled_ = 1; unsigned Fl_Tooltip::color_ = fl_color_cube(FL_NUM_RED - 1, FL_NUM_GREEN - 1, @@ -156,7 +157,7 @@ tt_exit(Fl_Widget *w) { if (window) window->hide(); if (recent_tooltip) { if (Fl::event_state() & FL_BUTTONS) recent_tooltip = 0; - else Fl::add_timeout(.2f, recent_timeout); + else Fl::add_timeout(Fl_Tooltip::hoverdelay(), recent_timeout); } } @@ -203,7 +204,10 @@ Fl_Tooltip::enter_area(Fl_Widget* wid, int x,int y,int w,int h, const char* t) // remember it: widget_ = wid; X = x; Y = y; W = w; H = h; tip = t; // popup the tooltip immediately if it was recently up: - if (recent_tooltip || Fl_Tooltip::delay() < .1) { + if (recent_tooltip) { + if (window) window->hide(); + Fl::add_timeout(Fl_Tooltip::hoverdelay(), tooltip_timeout); + } else if (Fl_Tooltip::delay() < .1) { #ifdef WIN32 // possible fix for the Windows titlebar, it seems to want the // window to be destroyed, moving it messes up the parenting: @@ -232,5 +236,5 @@ void Fl_Widget::tooltip(const char *tt) { } // -// End of "$Id: Fl_Tooltip.cxx,v 1.38.2.27 2003/01/30 21:42:53 easysw Exp $". +// End of "$Id: Fl_Tooltip.cxx,v 1.38.2.28 2003/09/14 14:11:06 easysw Exp $". // |
