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