2002-02-06 17:15:28 +00:00
|
|
|
// -*- C++ -*-
|
2002-03-11 17:00:41 +00:00
|
|
|
/**
|
2002-02-06 17:15:28 +00:00
|
|
|
* \file Tooltips.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-02-06 17:15:28 +00:00
|
|
|
*
|
2002-12-01 22:59:25 +00:00
|
|
|
* \author Angus Leeming
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-03-11 17:00:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Tooltips for xforms. xforms 0.89 supports them directly, but 0.88 needs
|
2002-02-06 17:15:28 +00:00
|
|
|
* 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
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <boost/signals/signal0.hpp>
|
|
|
|
#include <boost/signals/trackable.hpp>
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
#include "forms_fwd.h" // Can't forward-declare FL_OBJECT
|
2002-02-06 17:15:28 +00:00
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <map>
|
|
|
|
|
2003-09-07 21:25:37 +00:00
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
class Tooltips : boost::noncopyable, public boost::signals::trackable {
|
2002-02-06 17:15:28 +00:00
|
|
|
public:
|
2002-08-12 14:28:43 +00:00
|
|
|
///
|
|
|
|
Tooltips();
|
2002-03-11 09:54:42 +00:00
|
|
|
|
2002-03-11 17:00:41 +00:00
|
|
|
/// Initialise a tooltip for this ob.
|
2003-10-06 15:43:21 +00:00
|
|
|
void init(FL_OBJECT * ob, std::string const & tip);
|
2002-03-11 09:54:42 +00:00
|
|
|
|
|
|
|
/// Are the tooltips on or off?
|
|
|
|
static bool enabled() { return enabled_; }
|
|
|
|
|
|
|
|
/** This method is connected to Dialogs::toggleTooltips and toggles
|
2002-03-11 17:00:41 +00:00
|
|
|
* the state of enabled_.
|
2002-03-11 09:54:42 +00:00
|
|
|
*/
|
|
|
|
static void toggleEnabled();
|
|
|
|
|
2002-08-12 14:28:43 +00:00
|
|
|
private:
|
|
|
|
|
2002-10-14 16:38:00 +00:00
|
|
|
/// This method is connected to the Tooltips::toggled signal.
|
|
|
|
void set();
|
|
|
|
|
2002-08-12 14:28:43 +00:00
|
|
|
/// Are the tooltips on or off?
|
|
|
|
static bool enabled_;
|
|
|
|
|
2002-03-11 09:54:42 +00:00
|
|
|
/** Once enabled_ is changed, then this signal is emitted to update
|
|
|
|
* all the tooltips.
|
|
|
|
*/
|
2002-05-29 16:21:03 +00:00
|
|
|
static boost::signal0<void> toggled;
|
2002-03-11 09:54:42 +00:00
|
|
|
|
2002-03-11 17:00:41 +00:00
|
|
|
/// The tooltips are stored so that they can be turned on and off.
|
2003-10-06 15:43:21 +00:00
|
|
|
typedef std::map<FL_OBJECT *, std::string> TooltipsMap;
|
2002-03-11 09:54:42 +00:00
|
|
|
|
|
|
|
TooltipsMap tooltipsMap;
|
2002-02-06 17:15:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TOOLTIPS_H
|