]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/Tooltips.h
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / Tooltips.h
index 36d2f8b8ac2b97dbb34ced6b2c49f3ccea926a49..2cc357ffd57b1999d1d28135e0cc1d9c08ea610c 100644 (file)
@@ -1,12 +1,15 @@
 // -*- C++ -*-
-/*
+/**
  * \file Tooltips.h
- * Copyright 2002 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * \author Angus Leeming, a.leeming@ic.ac.uk
+ * \author Angus Leeming
  *
- * Tooltips for xforms. xforms 0.89 supports them directly, but 0.88 needs
+ * Full author contact details are available in file CREDITS.
+ */
+
+/* Tooltips for xforms. xforms 0.89 supports them directly, but 0.88 needs
  * a bit of jiggery pokery. This class wraps it all up in a neat interface.
  * Based on code originally in Toolbar_pimpl.C that appears to have been
  * written by Matthias Ettrich and Jean-Marc Lasgouttes.
 #ifndef TOOLTIPS_H
 #define TOOLTIPS_H
 
-#include "LString.h"
-#include <boost/utility.hpp>
-#include <sigc++/signal_system.h>
-#include FORMS_H_LOCATION // Can't forward-declare FL_OBJECT
+#include <boost/signal.hpp>
+#include <boost/signals/trackable.hpp>
 
-#ifdef __GNUG__
-#pragma interface
-#endif
+#include "forms_fwd.h" // Can't forward-declare FL_OBJECT
 
-class Tooltips : boost::noncopyable {
-public:
-       /// Activate tooltips for this ob
-       void activateTooltip(FL_OBJECT * ob);
-       /** Connect this signal to the function returning the tooltip for ob
-           Eg, string FormBase::getTooltip(FL_OBJECT const *)
-           Note that SigC is unable to create a Signal1 returning string const
-           or to connect it to a const method.
-        */
-       SigC::Signal1<string, FL_OBJECT const *> getTooltip;
+#include <map>
 
-       // We use the old method because we want to change tooltips on the fly
-//#if FL_REVISION < 89
+namespace lyx {
+namespace frontend {
+
+class Tooltips : boost::noncopyable, public boost::signals::trackable {
+public:
        ///
-       Tooltips() : tooltip_timer_(0) {}
+       Tooltips();
+
+       /// Initialise a tooltip for this ob.
+       void init(FL_OBJECT * ob, std::string const & tip);
+
+       /// Are the tooltips on or off?
+       static bool enabled() { return enabled_; }
+
+       /** This method is connected to Dialogs::toggleTooltips and toggles
+        *  the state of enabled_.
+        */
+       static void toggleEnabled();
 
 private:
 
-       FL_OBJECT * tooltip_timer_;
-//#endif
+       /// This method is connected to the Tooltips::toggled signal.
+       void set();
+
+       /// Are the tooltips on or off?
+       static bool enabled_;
+
+       /** Once enabled_ is changed, then this signal is emitted to update
+        *  all the tooltips.
+        */
+       static boost::signal<void()> toggled;
+
+       /// The tooltips are stored so that they can be turned on and off.
+       typedef std::map<FL_OBJECT *, std::string> TooltipsMap;
+
+       TooltipsMap tooltipsMap;
 };
 
+} // namespace frontend
+} // namespace lyx
+
 #endif // TOOLTIPS_H