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.
21 #include <boost/utility.hpp>
22 #include <boost/signals/signal0.hpp>
23 #include <boost/signals/trackable.hpp>
25 #include "forms_fwd.h" // Can't forward-declare FL_OBJECT
36 class Tooltips : boost::noncopyable, public boost::signals::trackable {
40 /// Initialise a tooltip for this ob.
41 void init(FL_OBJECT * ob, string const & tip);
43 /// Are the tooltips on or off?
44 static bool enabled() { return enabled_; }
46 /// This method is connected to the tooltipsToggled signal.
49 #if FL_VERSION < 1 && FL_REVISION < 89
51 /** Return the tooltip associated with this object.
52 * Required by an xforms callback routine.
54 string const get(FL_OBJECT *) const;
60 /// Are the tooltips on or off?
63 /** This method is connected to Dialogs::toggleTooltips and toggles
64 * the state of enabled_.
66 static void toggleEnabled();
68 /** Once enabled_ is changed, then this signal is emitted to update
71 static boost::signal0<void> toggled;
73 /// The tooltips are stored so that they can be turned on and off.
74 typedef std::map<FL_OBJECT *, string> TooltipsMap;
76 TooltipsMap tooltipsMap;
78 #if FL_VERSION < 1 && FL_REVISION < 89
80 /** A timer is started once the mouse enters an object, so that the
81 * tip appears a short delay afterwards.
83 FL_OBJECT * tooltip_timer_;