FLTK 1.3.0
Fl_Tooltip.H
00001 //
00002 // "$Id$"
00003 //
00004 // Tooltip header file for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright 1998-2011 by Bill Spitzak and others.
00007 //
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU Library General Public
00010 // License as published by the Free Software Foundation; either
00011 // version 2 of the License, or (at your option) any later version.
00012 //
00013 // This library is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 // Library General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU Library General Public
00019 // License along with this library; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00021 // USA.
00022 //
00023 // Please report all bugs and problems on the following page:
00024 //
00025 //     http://www.fltk.org/str.php
00026 //
00027 
00028 /* \file
00029    Fl_Tooltip widget . */
00030 
00031 #ifndef Fl_Tooltip_H
00032 #define Fl_Tooltip_H
00033 
00034 #include <FL/Fl.H>
00035 #include <FL/Fl_Widget.H>
00036 
00041 class FL_EXPORT Fl_Tooltip {
00042 public:
00044   static float delay() { return delay_; }
00046   static void delay(float f) { delay_ = f; }
00051   static float hoverdelay() { return hoverdelay_; }
00056   static void hoverdelay(float f) { hoverdelay_ = f; }
00058   static int enabled() { return Fl::option(Fl::OPTION_SHOW_TOOLTIPS); }
00060   static void enable(int b = 1) { Fl::option(Fl::OPTION_SHOW_TOOLTIPS, (b!=0));}
00062   static void disable() { enable(0); }
00063   static void (*enter)(Fl_Widget* w);
00064   static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
00065   static void (*exit)(Fl_Widget *w);
00067   static Fl_Widget* current() {return widget_;}
00068   static void current(Fl_Widget*);
00069 
00071   static Fl_Font font() { return font_; }
00073   static void font(Fl_Font i) { font_ = i; }
00075   static Fl_Fontsize size() { return (size_ == -1 ? FL_NORMAL_SIZE : size_); }
00077   static void size(Fl_Fontsize s) { size_ = s; }
00079   static Fl_Color color() { return color_; }
00081   static void color(Fl_Color c) { color_ = c; }
00083   static Fl_Color textcolor() { return textcolor_; }
00085   static void textcolor(Fl_Color c) { textcolor_ = c; }
00086 #ifdef __APPLE__
00087   // the unique tooltip window
00088   static Fl_Window* current_window(void);
00089 #endif
00090 
00091   // These should not be public, but Fl_Widget::tooltip() needs them...
00092   // fabien: made it private with only a friend function access
00093 private:
00094   friend void Fl_Widget::tooltip(const char *);
00095   friend void Fl_Widget::copy_tooltip(const char *);
00096   static void enter_(Fl_Widget* w);
00097   static void exit_(Fl_Widget *w);
00098   static void set_enter_exit_once_();
00099 
00100 private:
00101   static float delay_; 
00102   static float hoverdelay_; 
00103   static Fl_Color color_;
00104   static Fl_Color textcolor_;
00105   static Fl_Font font_;
00106   static Fl_Fontsize size_;
00107   static Fl_Widget* widget_; 
00108 };
00109 
00110 #endif
00111 
00112 //
00113 // End of "$Id$".
00114 //