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