4 * Copyright 2002 the LyX Team
5 * Read the file COPYING
7 * \author Angus Leeming, a.leeming@ic.ac.uk
10 /* Tooltips for xforms. xforms 0.89 supports them directly, but 0.88 needs
11 * a bit of jiggery pokery. This class wraps it all up in a neat interface.
12 * Based on code originally in Toolbar_pimpl.C that appears to have been
13 * written by Matthias Ettrich and Jean-Marc Lasgouttes.
20 #include <boost/utility.hpp>
21 #include <sigc++/signal_system.h>
23 #include FORMS_H_LOCATION // Can't forward-declare FL_OBJECT
29 class Tooltips : boost::noncopyable, public SigC::Object {
33 /// Initialise a tooltip for this ob.
34 void initTooltip(FL_OBJECT * ob, string const & tip);
36 /// Are the tooltips on or off?
37 static bool enabled() { return enabled_; }
41 /** Return the tooltip associated with this object.
42 * Required by an xforms callback routine.
44 string const getTooltip(FL_OBJECT *) const;
50 /// Are the tooltips on or off?
53 /** This method is connected to Dialogs::toggleTooltips and toggles
54 * the state of enabled_.
56 static void toggleEnabled();
58 /** Once enabled_ is changed, then this signal is emitted to update
61 static SigC::Signal0<void> tooltipsToggled;
63 /// This method is connected to the tooltipsToggled signal.
64 void toggleTooltips();
66 /// The tooltips are stored so that they can be turned on and off.
67 typedef std::map<FL_OBJECT *, string> TooltipsMap;
69 TooltipsMap tooltipsMap;
73 /** A timer is started once the mouse enters an object, so that the
74 * tip appears a short delay afterwards.
76 FL_OBJECT * tooltip_timer_;