]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Tooltips.h
Introduce LFUN_PRINT.
[lyx.git] / src / frontends / xforms / Tooltips.h
1 // -*- C++ -*-
2 /**
3  * \file Tooltips.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 /* Tooltips for xforms. xforms 0.89 supports them directly, but 0.88 needs
13  * a bit of jiggery pokery. This class wraps it all up in a neat interface.
14  * Based on code originally in Toolbar_pimpl.C that appears to have been
15  * written by Matthias Ettrich and Jean-Marc Lasgouttes.
16  */
17
18 #ifndef TOOLTIPS_H
19 #define TOOLTIPS_H
20
21 #include <boost/signals/signal0.hpp>
22 #include <boost/signals/trackable.hpp>
23
24 #include "forms_fwd.h" // Can't forward-declare FL_OBJECT
25
26 #include <map>
27
28
29 class Tooltips : boost::noncopyable, public boost::signals::trackable {
30 public:
31         ///
32         Tooltips();
33
34         /// Initialise a tooltip for this ob.
35         void init(FL_OBJECT * ob, std::string const & tip);
36
37         /// Are the tooltips on or off?
38         static bool enabled() { return enabled_; }
39
40         /** This method is connected to Dialogs::toggleTooltips and toggles
41          *  the state of enabled_.
42          */
43         static void toggleEnabled();
44
45 private:
46
47         /// This method is connected to the Tooltips::toggled signal.
48         void set();
49
50         /// Are the tooltips on or off?
51         static bool enabled_;
52
53         /** Once enabled_ is changed, then this signal is emitted to update
54          *  all the tooltips.
55          */
56         static boost::signal0<void> toggled;
57
58         /// The tooltips are stored so that they can be turned on and off.
59         typedef std::map<FL_OBJECT *, std::string> TooltipsMap;
60
61         TooltipsMap tooltipsMap;
62 };
63
64 #endif // TOOLTIPS_H