FLTK 1.3.3
Fl_Tooltip.H
1 //
2 // "$Id: Fl_Tooltip.H 9706 2012-11-06 20:46:14Z matt $"
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. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
19 /* \file
20  Fl_Tooltip widget . */
21 
22 #ifndef Fl_Tooltip_H
23 #define Fl_Tooltip_H
24 
25 #include <FL/Fl.H>
26 #include <FL/Fl_Widget.H>
27 
36 class FL_EXPORT Fl_Tooltip {
37 public:
39  static float delay() { return delay_; }
41  static void delay(float f) { delay_ = f; }
46  static float hoverdelay() { return hoverdelay_; }
51  static void hoverdelay(float f) { hoverdelay_ = f; }
53  static int enabled() { return Fl::option(Fl::OPTION_SHOW_TOOLTIPS); }
55  static void enable(int b = 1) { Fl::option(Fl::OPTION_SHOW_TOOLTIPS, (b!=0));}
57  static void disable() { enable(0); }
58  static void (*enter)(Fl_Widget* w);
59  static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
60  static void (*exit)(Fl_Widget *w);
62  static Fl_Widget* current() {return widget_;}
63  static void current(Fl_Widget*);
64 
66  static Fl_Font font() { return font_; }
68  static void font(Fl_Font i) { font_ = i; }
70  static Fl_Fontsize size() { return (size_ == -1 ? FL_NORMAL_SIZE : size_); }
72  static void size(Fl_Fontsize s) { size_ = s; }
74  static Fl_Color color() { return color_; }
76  static void color(Fl_Color c) { color_ = c; }
78  static Fl_Color textcolor() { return textcolor_; }
80  static void textcolor(Fl_Color c) { textcolor_ = c; }
81 #if FLTK_ABI_VERSION >= 10301
82 
83  static int margin_width() { return margin_width_; }
85  static void margin_width(int v) { margin_width_ = v; }
87  static int margin_height() { return margin_height_; }
89  static void margin_height(int v) { margin_height_ = v; }
91  static int wrap_width() { return wrap_width_; }
93  static void wrap_width(int v) { wrap_width_ = v; }
94 #else
95  static int margin_width() { return 3; }
96  static int margin_height() { return 3; }
97  static int wrap_width() { return 400; }
98 #endif
99 
100 #ifdef __APPLE__
101  // the unique tooltip window
102  static Fl_Window* current_window(void);
103 #endif
104 
105  // These should not be public, but Fl_Widget::tooltip() needs them...
106  // fabien: made it private with only a friend function access
107 private:
108  friend void Fl_Widget::tooltip(const char *);
109  friend void Fl_Widget::copy_tooltip(const char *);
110  static void enter_(Fl_Widget* w);
111  static void exit_(Fl_Widget *w);
112  static void set_enter_exit_once_();
113 
114 private:
115  static float delay_;
116  static float hoverdelay_;
117  static Fl_Color color_;
118  static Fl_Color textcolor_;
119  static Fl_Font font_;
120  static Fl_Fontsize size_;
121  static Fl_Widget* widget_;
122 #if FLTK_ABI_VERSION >= 10301
123  static int margin_width_;
124  static int margin_height_;
125  static int wrap_width_;
126 #endif
127 };
128 
129 #endif
130 
131 //
132 // End of "$Id: Fl_Tooltip.H 9706 2012-11-06 20:46:14Z matt $".
133 //
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:100
This widget produces an actual window.
Definition: Fl_Window.H:57
static void hoverdelay(float f)
Sets the tooltip hover delay, the delay between tooltips.
Definition: Fl_Tooltip.H:51
const char * tooltip() const
Gets the current tooltip text.
Definition: Fl_Widget.H:541
static void delay(float f)
Sets the tooltip delay.
Definition: Fl_Tooltip.H:41
Fl static class.
static int enabled()
Returns non-zero if tooltips are enabled.
Definition: Fl_Tooltip.H:53
static void size(Fl_Fontsize s)
Sets the size of the tooltip text.
Definition: Fl_Tooltip.H:72
static Fl_Color color()
Gets the background color for tooltips.
Definition: Fl_Tooltip.H:74
void copy_tooltip(const char *text)
Sets the current tooltip text.
Definition: Fl_Tooltip.cxx:336
static void color(Fl_Color c)
Sets the background color for tooltips.
Definition: Fl_Tooltip.H:76
If tooltips are enabled (default), hovering the mouse over a widget with a tooltip text will open a l...
Definition: Fl.H:207
static Fl_Color textcolor()
Gets the color of the text in the tooltip.
Definition: Fl_Tooltip.H:78
static void enable(int b=1)
Enables tooltips on all widgets (or disables if b is false).
Definition: Fl_Tooltip.H:55
static Fl_Widget * current()
Gets the current widget target.
Definition: Fl_Tooltip.H:62
static float hoverdelay()
Gets the tooltip hover delay, the delay between tooltips.
Definition: Fl_Tooltip.H:46
static void font(Fl_Font i)
Sets the typeface for the tooltip text.
Definition: Fl_Tooltip.H:68
static Fl_Fontsize size()
Gets the size of the tooltip text.
Definition: Fl_Tooltip.H:70
static bool option(Fl_Option opt)
FLTK library options management.
Definition: Fl.cxx:2095
static float delay()
Gets the tooltip delay.
Definition: Fl_Tooltip.H:39
static Fl_Font font()
Gets the typeface for the tooltip text.
Definition: Fl_Tooltip.H:66
Fl_Widget, Fl_Label classes .
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:768
static void disable()
Same as enable(0), disables tooltips on all widgets.
Definition: Fl_Tooltip.H:57
static void textcolor(Fl_Color c)
Sets the color of the text in the tooltip.
Definition: Fl_Tooltip.H:80
FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE
normal font size
Definition: Fl_Widget.cxx:102
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition: Enumerations.H:796
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:739
The Fl_Tooltip class provides tooltip support for all FLTK widgets.
Definition: Fl_Tooltip.H:36