]> git.lyx.org Git - lyx.git/blob - src/frontends/Timeout.C
Joao latest bits
[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
12 #include <config.h>
13
14 #include "Timeout.h"
15
16
17 Timeout::~Timeout()
18 {
19         pimpl_->stop();
20 }
21
22
23 bool Timeout::running() const
24 {
25         return pimpl_->running();
26 }
27
28
29 void Timeout::start()
30 {
31         pimpl_->start();
32 }
33
34
35 void Timeout::stop()
36 {
37         pimpl_->stop();
38 }
39
40
41 void Timeout::restart()
42 {
43         pimpl_->stop();
44         pimpl_->start();
45 }
46
47
48 void Timeout::emit()
49 {
50         pimpl_->reset();
51         timeout();
52         if (type == CONTINUOUS)
53                 pimpl_->start();
54 }
55
56
57 Timeout & Timeout::setType(Type t)
58 {
59         type = t;
60         return * this;
61 }
62
63
64 Timeout & Timeout::setTimeout(unsigned int msec)
65 {
66         // Can't have a timeout of zero!
67         BOOST_ASSERT(msec);
68
69         timeout_ms = msec;
70         return * this;
71 }