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
|
|
|
//
|
2010-11-29 00:06:39 +03:00
|
|
|
// Copyright 1998-2010 by Bill Spitzak and others.
|
2001-08-02 01:24:49 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Library General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Library General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Library General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
// USA.
|
|
|
|
//
|
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.
|
2008-09-15 20:39:05 +04:00
|
|
|
*/
|
2001-08-03 06:28:32 +04:00
|
|
|
class FL_EXPORT Fl_Tooltip {
|
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). */
|
2010-12-12 22:52:26 +03:00
|
|
|
static void enable(int b = 1) { Fl::option(Fl::OPTION_SHOW_TOOLTIPS, b);}
|
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. */
|
|
|
|
static Fl_Fontsize size() { return size_; }
|
|
|
|
/** 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; }
|
2010-12-02 02:12:06 +03:00
|
|
|
#ifdef __APPLE__
|
|
|
|
// the unique tooltip window
|
|
|
|
static Fl_Window* current_window(void);
|
|
|
|
#endif
|
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
|
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
|
|
|
//
|