]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Timeout_pimpl.C
doxygen fixes
[lyx.git] / src / frontends / xforms / Timeout_pimpl.C
1 /**
2  * \file xforms/Timeout_pimpl.C
3  * Copyright 2001 LyX Team
4  * Read COPYING
5  *
6  * \author Lars Gullik Bjønnes, larsbj@lyx.org
7  * \author John Levon, moz@compsoc.man.ac.uk
8  */
9
10 #include <config.h>
11
12 #include FORMS_H_LOCATION
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "Timeout_pimpl.h"
19 #include "debug.h"
20
21 using std::endl;
22
23 namespace {
24
25 extern "C" {
26         
27         static
28         void C_intern_timeout_cb(int, void * data)
29         {
30                 Timeout * to = static_cast<Timeout *>(data);
31                 to->emit();
32         }
33
34 }
35
36 } // namespace anon
37
38
39 Timeout::Pimpl::Pimpl(Timeout * owner)
40         : owner_(owner), timeout_id(-1)
41 {
42 }
43
44
45 void Timeout::Pimpl::reset()
46 {
47         timeout_id = -1;
48 }
49
50
51 bool Timeout::Pimpl::running() const
52 {
53         return timeout_id != -1;
54 }
55
56
57 void Timeout::Pimpl::start()
58 {
59         if (timeout_id != -1)
60                 lyxerr << "Timeout::start: already running!" << endl;
61         timeout_id = fl_add_timeout(owner_->timeout_ms,
62                                     C_intern_timeout_cb, owner_);
63 }
64
65
66 void Timeout::Pimpl::stop()
67 {
68         if (timeout_id != -1) {
69                 fl_remove_timeout(timeout_id);
70                 timeout_id = -1;
71         }
72 }