]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Tooltips.h
Remove work-arounds for xforms < 0.89.5.
[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 #ifdef __GNUG__
22 #pragma interface
23 #endif
24
25 #include "LString.h"
26
27 #include <boost/utility.hpp>
28 #include <boost/signals/signal0.hpp>
29 #include <boost/signals/trackable.hpp>
30
31 #include "forms_fwd.h" // Can't forward-declare FL_OBJECT
32
33 #include <map>
34
35 class Tooltips : boost::noncopyable, public boost::signals::trackable {
36 public:
37         ///
38         Tooltips();
39
40         /// Initialise a tooltip for this ob.
41         void init(FL_OBJECT * ob, string const & tip);
42
43         /// Are the tooltips on or off?
44         static bool enabled() { return enabled_; }
45
46         /** This method is connected to Dialogs::toggleTooltips and toggles
47          *  the state of enabled_.
48          */
49         static void toggleEnabled();
50
51 private:
52
53         /// This method is connected to the Tooltips::toggled signal.
54         void set();
55
56         /// Are the tooltips on or off?
57         static bool enabled_;
58
59         /** Once enabled_ is changed, then this signal is emitted to update
60          *  all the tooltips.
61          */
62         static boost::signal0<void> toggled;
63
64         /// The tooltips are stored so that they can be turned on and off.
65         typedef std::map<FL_OBJECT *, string> TooltipsMap;
66
67         TooltipsMap tooltipsMap;
68 };
69
70 #endif // TOOLTIPS_H