FLTK 1.3.0
Fl_Tooltip.H
1 //
2 // "$Id: Fl_Tooltip.H 8405 2011-02-08 20:59:46Z manolo $"
3 //
4 // Tooltip header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2011 by Bill Spitzak and others.
7 //
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.
12 //
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.
17 //
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
21 // USA.
22 //
23 // Please report all bugs and problems on the following page:
24 //
25 // http://www.fltk.org/str.php
26 //
27 
28 /* \file
29  Fl_Tooltip widget . */
30 
31 #ifndef Fl_Tooltip_H
32 #define Fl_Tooltip_H
33 
34 #include <FL/Fl.H>
35 #include <FL/Fl_Widget.H>
36 
41 class FL_EXPORT Fl_Tooltip {
42 public:
44  static float delay() { return delay_; }
46  static void delay(float f) { delay_ = f; }
51  static float hoverdelay() { return hoverdelay_; }
56  static void hoverdelay(float f) { hoverdelay_ = f; }
58  static int enabled() { return Fl::option(Fl::OPTION_SHOW_TOOLTIPS); }
60  static void enable(int b = 1) { Fl::option(Fl::OPTION_SHOW_TOOLTIPS, (b!=0));}
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);
67  static Fl_Widget* current() {return widget_;}
68  static void current(Fl_Widget*);
69 
71  static Fl_Font font() { return font_; }
73  static void font(Fl_Font i) { font_ = i; }
75  static Fl_Fontsize size() { return (size_ == -1 ? FL_NORMAL_SIZE : size_); }
77  static void size(Fl_Fontsize s) { size_ = s; }
79  static Fl_Color color() { return color_; }
81  static void color(Fl_Color c) { color_ = c; }
83  static Fl_Color textcolor() { return textcolor_; }
85  static void textcolor(Fl_Color c) { textcolor_ = c; }
86 #ifdef __APPLE__
87  // the unique tooltip window
88  static Fl_Window* current_window(void);
89 #endif
90 
91  // These should not be public, but Fl_Widget::tooltip() needs them...
92  // fabien: made it private with only a friend function access
93 private:
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_();
99 
100 private:
101  static float delay_;
102  static float hoverdelay_;
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_;
108 };
109 
110 #endif
111 
112 //
113 // End of "$Id: Fl_Tooltip.H 8405 2011-02-08 20:59:46Z manolo $".
114 //
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:109
This widget produces an actual window.
Definition: Fl_Window.H:58
static void hoverdelay(float f)
Sets the tooltip hover delay, the delay between tooltips.
Definition: Fl_Tooltip.H:56
const char * tooltip() const
Gets the current tooltip text.
Definition: Fl_Widget.H:548
static void delay(float f)
Sets the tooltip delay.
Definition: Fl_Tooltip.H:46
Fl static class.
static int enabled()
Returns non-zero if tooltips are enabled.
Definition: Fl_Tooltip.H:58
static void size(Fl_Fontsize s)
Sets the size of the tooltip text.
Definition: Fl_Tooltip.H:77
static Fl_Color color()
Gets the background color for tooltips.
Definition: Fl_Tooltip.H:79
void copy_tooltip(const char *text)
Sets the current tooltip text.
Definition: Fl_Tooltip.cxx:337
static void color(Fl_Color c)
Sets the background color for tooltips.
Definition: Fl_Tooltip.H:81
If tooltips are enabled, hovering the mouse over a widget with a tooltip text will open a little tool...
Definition: Fl.H:186
static Fl_Color textcolor()
Gets the color of the text in the tooltip.
Definition: Fl_Tooltip.H:83
static void enable(int b=1)
Enables tooltips on all widgets (or disables if b is false).
Definition: Fl_Tooltip.H:60
static Fl_Widget * current()
Gets the current widget target.
Definition: Fl_Tooltip.H:67
static float hoverdelay()
Gets the tooltip hover delay, the delay between tooltips.
Definition: Fl_Tooltip.H:51
static void font(Fl_Font i)
Sets the typeface for the tooltip text.
Definition: Fl_Tooltip.H:73
static Fl_Fontsize size()
Gets the size of the tooltip text.
Definition: Fl_Tooltip.H:75
static bool option(Fl_Option opt)
FLTK library options management.
Definition: Fl.cxx:1934
static float delay()
Gets the tooltip delay.
Definition: Fl_Tooltip.H:44
static Fl_Font font()
Gets the typeface for the tooltip text.
Definition: Fl_Tooltip.H:71
Fl_Widget, Fl_Label classes .
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:741
static void disable()
Same as enable(0), disables tooltips on all widgets.
Definition: Fl_Tooltip.H:62
static void textcolor(Fl_Color c)
Sets the color of the text in the tooltip.
Definition: Fl_Tooltip.H:85
FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE
normal font size
Definition: Fl_Widget.cxx:111
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:769
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:712
The Fl_Tooltip class provides tooltip support for all FLTK widgets.
Definition: Fl_Tooltip.H:41