4 * Read the file COPYING
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS
11 /* Tooltips for xforms. xforms 0.89 supports them directly, but 0.88 needs
12 * a bit of jiggery pokery. This class wraps it all up in a neat interface.
13 * Based on code originally in Toolbar_pimpl.C that appears to have been
14 * written by Matthias Ettrich and Jean-Marc Lasgouttes.
22 #include <boost/utility.hpp>
23 #include <boost/signals/signal0.hpp>
24 #include <boost/signals/trackable.hpp>
26 #include "forms_fwd.h" // Can't forward-declare FL_OBJECT
34 class Tooltips : boost::noncopyable, public boost::signals::trackable {
39 /// Initialise a tooltip for this ob.
40 void init(FL_OBJECT * ob, string const & tip);
42 /// Are the tooltips on or off?
43 static bool enabled() { return enabled_; }
45 /// This method is connected to the tooltipsToggled signal.
48 #if FL_VERSION < 1 && FL_REVISION < 89
50 /** Return the tooltip associated with this object.
51 * Required by an xforms callback routine.
53 string const get(FL_OBJECT *) const;
57 /** This method is connected to Dialogs::toggleTooltips and toggles
58 * the state of enabled_.
60 static void toggleEnabled();
64 /// Are the tooltips on or off?
67 /** Once enabled_ is changed, then this signal is emitted to update
70 static boost::signal0<void> toggled;
72 /// The tooltips are stored so that they can be turned on and off.
73 typedef std::map<FL_OBJECT *, string> TooltipsMap;
75 TooltipsMap tooltipsMap;
77 #if FL_VERSION < 1 && FL_REVISION < 89
79 /** A timer is started once the mouse enters an object, so that the
80 * tip appears a short delay afterwards.
82 FL_OBJECT * tooltip_timer_;