2 // "$Id: Fl_Tooltip.H 8405 2011-02-08 20:59:46Z manolo $"
4 // Tooltip header file for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2011 by Bill Spitzak and others.
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
29 Fl_Tooltip widget . */
35 #include <FL/Fl_Widget.H>
38 The Fl_Tooltip class provides tooltip support for
39 all FLTK widgets. It contains only static methods.
41 class FL_EXPORT Fl_Tooltip {
43 /** Gets the tooltip delay. The default delay is 1.0 seconds. */
44 static float delay() { return delay_; }
45 /** Sets the tooltip delay. The default delay is 1.0 seconds. */
46 static void delay(float f) { delay_ = f; }
48 Gets the tooltip hover delay, the delay between tooltips.
49 The default delay is 0.2 seconds.
51 static float hoverdelay() { return hoverdelay_; }
53 Sets the tooltip hover delay, the delay between tooltips.
54 The default delay is 0.2 seconds.
56 static void hoverdelay(float f) { hoverdelay_ = f; }
57 /** Returns non-zero if tooltips are enabled. */
58 static int enabled() { return Fl::option(Fl::OPTION_SHOW_TOOLTIPS); }
59 /** Enables tooltips on all widgets (or disables if <i>b</i> is false). */
60 static void enable(int b = 1) { Fl::option(Fl::OPTION_SHOW_TOOLTIPS, (b!=0));}
61 /** Same as enable(0), disables tooltips on all widgets. */
62 static void disable() { enable(0); }
63 static void (*enter)(Fl_Widget* w);
64 static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
65 static void (*exit)(Fl_Widget *w);
66 /** Gets the current widget target */
67 static Fl_Widget* current() {return widget_;}
68 static void current(Fl_Widget*);
70 /** Gets the typeface for the tooltip text. */
71 static Fl_Font font() { return font_; }
72 /** Sets the typeface for the tooltip text. */
73 static void font(Fl_Font i) { font_ = i; }
74 /** Gets the size of the tooltip text. */
75 static Fl_Fontsize size() { return (size_ == -1 ? FL_NORMAL_SIZE : size_); }
76 /** Sets the size of the tooltip text. */
77 static void size(Fl_Fontsize s) { size_ = s; }
78 /** Gets the background color for tooltips. The default background color is a pale yellow. */
79 static Fl_Color color() { return color_; }
80 /** Sets the background color for tooltips. The default background color is a pale yellow. */
81 static void color(Fl_Color c) { color_ = c; }
82 /** Gets the color of the text in the tooltip. The default is black. */
83 static Fl_Color textcolor() { return textcolor_; }
84 /** Sets the color of the text in the tooltip. The default is black. */
85 static void textcolor(Fl_Color c) { textcolor_ = c; }
87 // the unique tooltip window
88 static Fl_Window* current_window(void);
91 // These should not be public, but Fl_Widget::tooltip() needs them...
92 // fabien: made it private with only a friend function access
94 friend void Fl_Widget::tooltip(const char *);
95 friend void Fl_Widget::copy_tooltip(const char *);
96 static void enter_(Fl_Widget* w);
97 static void exit_(Fl_Widget *w);
98 static void set_enter_exit_once_();
101 static float delay_; //!< delay before a tooltip is shown
102 static float hoverdelay_; //!< delay between tooltips
103 static Fl_Color color_;
104 static Fl_Color textcolor_;
105 static Fl_Font font_;
106 static Fl_Fontsize size_;
107 static Fl_Widget* widget_; //!< Keeps track of the current target widget
110 extern void (*fl_show_tooltip)( const char *s );
111 extern void (*fl_hide_tooltip)( void );
116 // End of "$Id: Fl_Tooltip.H 8405 2011-02-08 20:59:46Z manolo $".