]> git.lyx.org Git - lyx.git/blob - src/frontends/Timeout.C
add shortcuts to filedialogs directory buttons; small gnome patch from Michael
[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 Timeout::Timeout()
21         : type(ONETIME), timeout_ms(0)
22 {
23         pimpl_ = new Pimpl(this);
24 }
25
26
27 Timeout::Timeout(unsigned int msec, Type t)
28         : type(t), timeout_ms(msec)
29 {
30         pimpl_ = new Pimpl(this);
31 }
32
33
34 Timeout::~Timeout()
35 {
36         pimpl_->stop();
37         delete pimpl_;
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.emit();
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 }