FLTK 1.4.0
Loading...
Searching...
No Matches
Fl_Tooltip.H
1//
2// Tooltip header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2011 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
17/* \file
18 Fl_Tooltip widget . */
19
20#ifndef Fl_Tooltip_H
21#define Fl_Tooltip_H
22
23#include <FL/Fl.H>
24#include <FL/Fl_Widget.H>
25
34class FL_EXPORT Fl_Tooltip {
35 friend class Fl_TooltipBox;
36public:
38 static float delay() { return delay_; }
40 static void delay(float f) { delay_ = f; }
42 static float hidedelay() { return hidedelay_; }
44 static void hidedelay(float f) { hidedelay_ = f; }
49 static float hoverdelay() { return hoverdelay_; }
54 static void hoverdelay(float f) { hoverdelay_ = f; }
58 static void enable(int b = 1) { Fl::option(Fl::OPTION_SHOW_TOOLTIPS, (b!=0));}
60 static void disable() { enable(0); }
61 static void (*enter)(Fl_Widget* w);
62 static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
63 static void (*exit)(Fl_Widget *w);
65 static Fl_Widget* current() {return widget_;}
66 static void current(Fl_Widget*);
67
69 static Fl_Font font() { return font_; }
71 static void font(Fl_Font i) { font_ = i; }
73 static Fl_Fontsize size() { return (size_ == -1 ? FL_NORMAL_SIZE : size_); }
75 static void size(Fl_Fontsize s) { size_ = s; }
77 static Fl_Color color() { return color_; }
79 static void color(Fl_Color c) { color_ = c; }
81 static Fl_Color textcolor() { return textcolor_; }
83 static void textcolor(Fl_Color c) { textcolor_ = c; }
85 static int margin_width() { return margin_width_; }
87 static void margin_width(int v) { margin_width_ = v; }
89 static int margin_height() { return margin_height_; }
91 static void margin_height(int v) { margin_height_ = v; }
93 static int wrap_width() { return wrap_width_; }
95 static void wrap_width(int v) { wrap_width_ = v; }
97 static Fl_Window* current_window(void);
98
99 // These should not be public, but Fl_Widget::tooltip() needs them...
100 // fabien: made it private with only a friend function access
101private:
102 friend void Fl_Widget::tooltip(const char *);
103 friend void Fl_Widget::copy_tooltip(const char *);
104 static void enter_(Fl_Widget* w);
105 static void exit_(Fl_Widget *w);
106 static void set_enter_exit_once_();
107
108private:
109 static float delay_;
110 static float hidedelay_;
111 static float hoverdelay_;
112 static Fl_Color color_;
113 static Fl_Color textcolor_;
114 static Fl_Font font_;
115 static Fl_Fontsize size_;
116 static Fl_Widget* widget_;
117 static int margin_width_;
118 static int margin_height_;
119 static int wrap_width_;
120 static const int draw_symbols_; // 1 = draw @-symbols in tooltips, 0 = no
121};
122
123#endif
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:1044
unsigned int Fl_Color
An FLTK color value; see also Colors
Definition Enumerations.H:1101
Fl_Fontsize FL_NORMAL_SIZE
normal font size
Definition Fl_Widget.cxx:107
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:1073
Fl static class.
Fl_Widget and Fl_Label classes.
The Fl_Tooltip class provides tooltip support for all FLTK widgets.
Definition Fl_Tooltip.H:34
static void margin_width(int v)
Sets the amount of extra space left/right of the tooltip's text.
Definition Fl_Tooltip.H:87
static float delay()
Gets the tooltip delay.
Definition Fl_Tooltip.H:38
static Fl_Color textcolor()
Gets the color of the text in the tooltip.
Definition Fl_Tooltip.H:81
static void delay(float f)
Sets the tooltip delay.
Definition Fl_Tooltip.H:40
static Fl_Font font()
Gets the typeface for the tooltip text.
Definition Fl_Tooltip.H:69
static int margin_height()
Gets the amount of extra space above and below the tooltip's text.
Definition Fl_Tooltip.H:89
static int enabled()
Returns non-zero if tooltips are enabled.
Definition Fl_Tooltip.H:56
static void color(Fl_Color c)
Sets the background color for tooltips.
Definition Fl_Tooltip.H:79
static float hidedelay()
Gets the time until an open tooltip hides again.
Definition Fl_Tooltip.H:42
static Fl_Widget * current()
Gets the current widget target.
Definition Fl_Tooltip.H:65
static void hidedelay(float f)
Sets the time until an open tooltip hides again.
Definition Fl_Tooltip.H:44
static void enable(int b=1)
Enables tooltips on all widgets (or disables if b is false).
Definition Fl_Tooltip.H:58
static int wrap_width()
Gets the maximum width for tooltip's text before it word wraps.
Definition Fl_Tooltip.H:93
static Fl_Fontsize size()
Gets the size of the tooltip text.
Definition Fl_Tooltip.H:73
static void textcolor(Fl_Color c)
Sets the color of the text in the tooltip.
Definition Fl_Tooltip.H:83
static int margin_width()
Gets the amount of extra space left/right of the tooltip's text.
Definition Fl_Tooltip.H:85
static void hoverdelay(float f)
Sets the tooltip hover delay, the delay between tooltips.
Definition Fl_Tooltip.H:54
static void font(Fl_Font i)
Sets the typeface for the tooltip text.
Definition Fl_Tooltip.H:71
static void wrap_width(int v)
Sets the maximum width for tooltip's text before it word wraps.
Definition Fl_Tooltip.H:95
static Fl_Color color()
Gets the background color for tooltips.
Definition Fl_Tooltip.H:77
static void margin_height(int v)
Sets the amount of extra space above and below the tooltip's text.
Definition Fl_Tooltip.H:91
static float hoverdelay()
Gets the tooltip hover delay, the delay between tooltips.
Definition Fl_Tooltip.H:49
static void size(Fl_Fontsize s)
Sets the size of the tooltip text.
Definition Fl_Tooltip.H:75
static void disable()
Same as enable(0), disables tooltips on all widgets.
Definition Fl_Tooltip.H:60
Fl_Widget is the base class for all widgets in FLTK.
Definition Fl_Widget.H:104
const char * tooltip() const
Gets the current tooltip text.
Definition Fl_Widget.H:692
void copy_tooltip(const char *text)
Sets the current tooltip text.
Definition Fl_Tooltip.cxx:386
This widget produces an actual window.
Definition Fl_Window.H:55
@ OPTION_SHOW_TOOLTIPS
If tooltips are enabled (default), hovering the mouse over a widget with a tooltip text will open a l...
Definition Fl.H:264
static bool option(Fl_Option opt)
FLTK library options management.
Definition Fl.cxx:1957