]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Tooltips.h
Change glob() API to accept a dir parameter.
[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/signal.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 namespace lyx {
29 namespace frontend {
30
31 class Tooltips : boost::noncopyable, public boost::signals::trackable {
32 public:
33         ///
34         Tooltips();
35
36         /// Initialise a tooltip for this ob.
37         void init(FL_OBJECT * ob, std::string const & tip);
38
39         /// Are the tooltips on or off?
40         static bool enabled() { return enabled_; }
41
42         /** This method is connected to Dialogs::toggleTooltips and toggles
43          *  the state of enabled_.
44          */
45         static void toggleEnabled();
46
47 private:
48
49         /// This method is connected to the Tooltips::toggled signal.
50         void set();
51
52         /// Are the tooltips on or off?
53         static bool enabled_;
54
55         /** Once enabled_ is changed, then this signal is emitted to update
56          *  all the tooltips.
57          */
58         static boost::signal<void()> toggled;
59
60         /// The tooltips are stored so that they can be turned on and off.
61         typedef std::map<FL_OBJECT *, std::string> TooltipsMap;
62
63         TooltipsMap tooltipsMap;
64 };
65
66 } // namespace frontend
67 } // namespace lyx
68
69 #endif // TOOLTIPS_H