]> git.lyx.org Git - lyx.git/blob - src/frontends/Timeout.C
reverse last change
[lyx.git] / src / frontends / Timeout.C
1 /**
2  * \file Timeout.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS
10  */
11 #ifdef __GNUG__
12 #pragma implementation
13 #endif
14
15 #include <config.h>
16
17 #include "Timeout.h"
18 #include "debug.h"
19
20 #include "Timeout_pimpl.h"
21
22
23 Timeout::Timeout(unsigned int msec, Type t)
24         : type(t), timeout_ms(msec)
25 {
26         pimpl_ = new Pimpl(this);
27 }
28
29
30 Timeout::~Timeout()
31 {
32         pimpl_->stop();
33         delete pimpl_;
34 }
35
36
37 bool Timeout::running() const
38 {
39         return pimpl_->running();
40 }
41
42
43 void Timeout::start()
44 {
45         pimpl_->start();
46 }
47
48 void Timeout::stop()
49 {
50         pimpl_->stop();
51 }
52
53 void Timeout::restart()
54 {
55         pimpl_->stop();
56         pimpl_->start();
57 }
58
59 void Timeout::emit()
60 {
61         pimpl_->reset();
62         timeout();
63         if (type == CONTINUOUS)
64                 pimpl_->start();
65 }
66
67 Timeout & Timeout::setType(Type t)
68 {
69         type = t;
70         return * this;
71 }
72
73
74 Timeout & Timeout::setTimeout(unsigned int msec)
75 {
76         timeout_ms = msec;
77         return * this;
78 }