mirror of
https://github.com/fltk/fltk.git
synced 2026-05-22 23:37:02 +08:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
+5
-2
@@ -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 $".
|
||||
//
|
||||
|
||||
@@ -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>
|
||||
|
||||
+8
-4
@@ -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 $".
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user