2001-08-02 01:24:49 +04:00
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// "$Id$"
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|
2001-08-02 01:24:49 +04:00
|
|
|
// Tooltip header file for the Fast Light Tool Kit (FLTK).
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|
2011-02-08 23:59:46 +03:00
|
|
|
// Copyright 1998-2011 by Bill Spitzak and others.
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/COPYING.php
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|
2005-04-16 04:13:17 +04:00
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|
|
|
|
|
2008-10-15 17:46:06 +04:00
|
|
|
/* \file
|
2008-09-16 11:26:22 +04:00
|
|
|
Fl_Tooltip widget . */
|
|
|
|
|
2002-05-13 09:05:11 +04:00
|
|
|
#ifndef Fl_Tooltip_H
|
|
|
|
#define Fl_Tooltip_H
|
2001-08-02 01:24:49 +04:00
|
|
|
|
|
|
|
#include <FL/Fl.H>
|
|
|
|
#include <FL/Fl_Widget.H>
|
|
|
|
|
2008-09-15 20:39:05 +04:00
|
|
|
/**
|
|
|
|
The Fl_Tooltip class provides tooltip support for
|
2008-09-16 00:56:17 +04:00
|
|
|
all FLTK widgets. It contains only static methods.
|
2012-05-17 03:19:37 +04:00
|
|
|
|
|
|
|
\image html tooltip-options.png "Fl_Tooltip Options"
|
|
|
|
\image latex src/tooltip-options.png "Fl_Tooltip Options" width=6cm
|
|
|
|
|
2008-09-15 20:39:05 +04:00
|
|
|
*/
|
2001-08-03 06:28:32 +04:00
|
|
|
class FL_EXPORT Fl_Tooltip {
|
2018-03-15 12:34:20 +03:00
|
|
|
friend class Fl_TooltipBox;
|
2001-08-02 01:24:49 +04:00
|
|
|
public:
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Gets the tooltip delay. The default delay is 1.0 seconds. */
|
2008-09-16 00:56:17 +04:00
|
|
|
static float delay() { return delay_; }
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Sets the tooltip delay. The default delay is 1.0 seconds. */
|
2002-05-13 09:05:11 +04:00
|
|
|
static void delay(float f) { delay_ = f; }
|
2008-09-15 20:39:05 +04:00
|
|
|
/**
|
2008-09-16 00:56:17 +04:00
|
|
|
Gets the tooltip hover delay, the delay between tooltips.
|
2008-09-15 20:39:05 +04:00
|
|
|
The default delay is 0.2 seconds.
|
|
|
|
*/
|
2003-09-14 18:11:06 +04:00
|
|
|
static float hoverdelay() { return hoverdelay_; }
|
2008-09-15 20:39:05 +04:00
|
|
|
/**
|
2008-09-16 00:56:17 +04:00
|
|
|
Sets the tooltip hover delay, the delay between tooltips.
|
2008-09-15 20:39:05 +04:00
|
|
|
The default delay is 0.2 seconds.
|
|
|
|
*/
|
2003-09-14 18:11:06 +04:00
|
|
|
static void hoverdelay(float f) { hoverdelay_ = f; }
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Returns non-zero if tooltips are enabled. */
|
2010-12-12 22:52:26 +03:00
|
|
|
static int enabled() { return Fl::option(Fl::OPTION_SHOW_TOOLTIPS); }
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Enables tooltips on all widgets (or disables if <i>b</i> is false). */
|
2011-01-23 01:38:55 +03:00
|
|
|
static void enable(int b = 1) { Fl::option(Fl::OPTION_SHOW_TOOLTIPS, (b!=0));}
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Same as enable(0), disables tooltips on all widgets. */
|
2010-12-12 22:52:26 +03:00
|
|
|
static void disable() { enable(0); }
|
2002-05-13 09:05:11 +04:00
|
|
|
static void (*enter)(Fl_Widget* w);
|
|
|
|
static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
|
|
|
|
static void (*exit)(Fl_Widget *w);
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Gets the current widget target */
|
2002-10-29 22:45:10 +03:00
|
|
|
static Fl_Widget* current() {return widget_;}
|
|
|
|
static void current(Fl_Widget*);
|
2002-05-13 09:05:11 +04:00
|
|
|
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Gets the typeface for the tooltip text. */
|
2008-04-23 23:09:28 +04:00
|
|
|
static Fl_Font font() { return font_; }
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Sets the typeface for the tooltip text. */
|
2008-04-23 23:09:28 +04:00
|
|
|
static void font(Fl_Font i) { font_ = i; }
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Gets the size of the tooltip text. */
|
2011-02-08 23:59:46 +03:00
|
|
|
static Fl_Fontsize size() { return (size_ == -1 ? FL_NORMAL_SIZE : size_); }
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Sets the size of the tooltip text. */
|
2008-08-16 01:11:21 +04:00
|
|
|
static void size(Fl_Fontsize s) { size_ = s; }
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Gets the background color for tooltips. The default background color is a pale yellow. */
|
2009-09-27 15:06:56 +04:00
|
|
|
static Fl_Color color() { return color_; }
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Sets the background color for tooltips. The default background color is a pale yellow. */
|
2009-09-27 15:06:56 +04:00
|
|
|
static void color(Fl_Color c) { color_ = c; }
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Gets the color of the text in the tooltip. The default is black. */
|
2009-09-27 15:06:56 +04:00
|
|
|
static Fl_Color textcolor() { return textcolor_; }
|
2008-09-15 20:39:05 +04:00
|
|
|
/** Sets the color of the text in the tooltip. The default is black. */
|
2009-09-27 15:06:56 +04:00
|
|
|
static void textcolor(Fl_Color c) { textcolor_ = c; }
|
2012-05-17 03:19:37 +04:00
|
|
|
/** Gets the amount of extra space left/right of the tooltip's text. Default is 3. */
|
|
|
|
static int margin_width() { return margin_width_; }
|
|
|
|
/** Sets the amount of extra space left/right of the tooltip's text. Default is 3. */
|
|
|
|
static void margin_width(int v) { margin_width_ = v; }
|
|
|
|
/** Gets the amount of extra space above and below the tooltip's text. Default is 3. */
|
|
|
|
static int margin_height() { return margin_height_; }
|
|
|
|
/** Sets the amount of extra space above and below the tooltip's text. Default is 3. */
|
|
|
|
static void margin_height(int v) { margin_height_ = v; }
|
|
|
|
/** Gets the maximum width for tooltip's text before it word wraps. Default is 400. */
|
|
|
|
static int wrap_width() { return wrap_width_; }
|
|
|
|
/** Sets the maximum width for tooltip's text before it word wraps. Default is 400. */
|
|
|
|
static void wrap_width(int v) { wrap_width_ = v; }
|
2016-02-13 15:57:00 +03:00
|
|
|
/** Returns the window that is used for tooltips */
|
2010-12-02 02:12:06 +03:00
|
|
|
static Fl_Window* current_window(void);
|
2004-09-13 00:26:23 +04:00
|
|
|
|
|
|
|
// These should not be public, but Fl_Widget::tooltip() needs them...
|
2008-09-16 00:56:17 +04:00
|
|
|
// fabien: made it private with only a friend function access
|
|
|
|
private:
|
|
|
|
friend void Fl_Widget::tooltip(const char *);
|
2010-12-02 20:58:58 +03:00
|
|
|
friend void Fl_Widget::copy_tooltip(const char *);
|
2004-09-13 00:26:23 +04:00
|
|
|
static void enter_(Fl_Widget* w);
|
|
|
|
static void exit_(Fl_Widget *w);
|
2010-12-02 20:58:58 +03:00
|
|
|
static void set_enter_exit_once_();
|
2004-09-13 00:26:23 +04:00
|
|
|
|
2002-05-13 09:05:11 +04:00
|
|
|
private:
|
2008-09-16 00:56:17 +04:00
|
|
|
static float delay_; //!< delay before a tooltip is shown
|
|
|
|
static float hoverdelay_; //!< delay between tooltips
|
2009-09-27 15:06:56 +04:00
|
|
|
static Fl_Color color_;
|
|
|
|
static Fl_Color textcolor_;
|
2008-04-23 23:09:28 +04:00
|
|
|
static Fl_Font font_;
|
2008-08-16 01:11:21 +04:00
|
|
|
static Fl_Fontsize size_;
|
2008-09-16 00:56:17 +04:00
|
|
|
static Fl_Widget* widget_; //!< Keeps track of the current target widget
|
2012-05-17 03:19:37 +04:00
|
|
|
static int margin_width_; //!< distance around tooltip text left+right
|
|
|
|
static int margin_height_; //!< distance around tooltip text top+bottom
|
|
|
|
static int wrap_width_; //!< maximum width of tooltip text before it word wraps
|
2018-03-15 12:34:20 +03:00
|
|
|
static const int draw_symbols_; // 1 = draw @-symbols in tooltips, 0 = no
|
2001-08-02 01:24:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// End of "$Id$".
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|