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