]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Timeout_pimpl.C
Bugfixes: checkboxes to radiobuttons (from J�rgen S) and remove a little
[lyx.git] / src / frontends / xforms / Timeout_pimpl.C
1 /**
2  * \file Timeout_pimpl.C
3  * Copyright 2001 LyX Team
4  * Read COPYING
5  *
6  * \author Lars Gullik Bjønnes
7  * \author John Levon
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 void Timeout::Pimpl::start()
52 {
53         if (timeout_id != -1)
54                 lyxerr << "Timeout::start: already running!" << endl;
55         timeout_id = fl_add_timeout(owner_->timeout_ms,
56                                     C_intern_timeout_cb, owner_);
57 }
58
59
60 void Timeout::Pimpl::stop()
61 {
62         if (timeout_id != -1) {
63                 fl_remove_timeout(timeout_id);
64                 timeout_id = -1;
65         }
66 }