]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Timeout_pimpl.C
try this for distinguishing inner and outer tabs
[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 #ifdef __GNUG__
11 #pragma implementation
12 #endif
13
14 #include <config.h>
15
16 #include FORMS_H_LOCATION
17
18 #include "Timeout_pimpl.h"
19 #include "debug.h"
20
21 using std::endl;
22
23 extern "C" {
24         static
25         void C_intern_timeout_cb(int, void * data)
26         {
27                 Timeout * to = static_cast<Timeout *>(data);
28                 to->emit();
29         }
30 }
31
32
33 Timeout::Pimpl::Pimpl(Timeout * owner)
34         : owner_(owner), timeout_id(-1)
35 {
36 }
37
38
39 void Timeout::Pimpl::reset()
40 {
41         timeout_id = -1;
42 }
43
44
45 void Timeout::Pimpl::start()
46 {
47         if (timeout_id != -1)
48                 lyxerr << "Timeout::start: already running!" << endl;
49         timeout_id = fl_add_timeout(owner_->timeout_ms,
50                                     C_intern_timeout_cb, owner_);
51 }
52
53
54 void Timeout::Pimpl::stop()
55 {
56         if (timeout_id != -1) {
57                 fl_remove_timeout(timeout_id);
58                 timeout_id = -1;
59         }
60 }