]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Timeout_pimpl.C
Add fl_set_input_return to input_paperoption.
[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 void C_intern_timeout_cb(int, void * data)
27 {
28         Timeout * to = static_cast<Timeout *>(data);
29         to->emit();
30 }
31
32 } // namespace anon
33
34
35 Timeout::Pimpl::Pimpl(Timeout * owner)
36         : owner_(owner), timeout_id(-1)
37 {
38 }
39
40
41 void Timeout::Pimpl::reset()
42 {
43         timeout_id = -1;
44 }
45
46
47 void Timeout::Pimpl::start()
48 {
49         if (timeout_id != -1)
50                 lyxerr << "Timeout::start: already running!" << endl;
51         timeout_id = fl_add_timeout(owner_->timeout_ms,
52                                     C_intern_timeout_cb, owner_);
53 }
54
55
56 void Timeout::Pimpl::stop()
57 {
58         if (timeout_id != -1) {
59                 fl_remove_timeout(timeout_id);
60                 timeout_id = -1;
61         }
62 }