]> git.lyx.org Git - lyx.git/blob - src/frontends/Dialogs.C
This file is part of LyX, the document processor.
[lyx.git] / src / frontends / Dialogs.C
1 /**
2  * \file Dialogs.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  * \author Angus Leeming 
6  *
7  * Full author contact details are available in file CREDITS
8  *
9  * Common to all frontends' Dialogs
10  */
11
12 #include <config.h>
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "Dialogs.h"
19
20 // Note that static boost signals break some compilers, so this wrapper
21 // initialises the signal dynamically when it is first invoked.
22 template<typename Signal>
23 class BugfixSignal {
24 public:
25         Signal & operator()() { return thesignal(); }
26         Signal const & operator()() const { return thesignal(); }
27
28 private:
29         Signal & thesignal() const
30         {
31                 if (!signal_.get())
32                         signal_.reset(new Signal);
33                 return *signal_;
34         }
35
36         mutable boost::scoped_ptr<Signal> signal_;
37 };
38
39
40 boost::signal0<void> & Dialogs::redrawGUI()
41 {
42         static BugfixSignal<boost::signal0<void> > thesignal;
43         return thesignal();
44 }