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