mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 21:49:51 +00:00
0be0fcfd59
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7598 a592a061-630c-0410-9148-cb99ea01b6c8
80 lines
1.2 KiB
C
80 lines
1.2 KiB
C
/**
|
|
* \file xformsTimeout.C
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Lars Gullik Bjønnes
|
|
* \author John Levon
|
|
* \author Angus Leeming
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include "xformsTimeout.h"
|
|
#include "debug.h"
|
|
|
|
#include "lyx_forms.h"
|
|
|
|
|
|
Timeout::Timeout(unsigned int msec, Type t)
|
|
: pimpl_(new xformsTimeout(*this)), type(t), timeout_ms(msec)
|
|
{}
|
|
|
|
|
|
namespace {
|
|
|
|
extern "C"
|
|
void C_TimeoutCB(int, void * data)
|
|
{
|
|
xformsTimeout * to = static_cast<xformsTimeout *>(data);
|
|
to->emitCB();
|
|
}
|
|
|
|
} // namespace anon
|
|
|
|
|
|
xformsTimeout::xformsTimeout(Timeout & owner)
|
|
: Timeout::Impl(owner), timeout_id(-1)
|
|
{}
|
|
|
|
|
|
void xformsTimeout::emitCB()
|
|
{
|
|
emit();
|
|
}
|
|
|
|
|
|
bool xformsTimeout::running() const
|
|
{
|
|
return timeout_id != -1;
|
|
}
|
|
|
|
|
|
void xformsTimeout::start()
|
|
{
|
|
if (running()) {
|
|
lyxerr << "Timeout::start: already running!" << std::endl;
|
|
|
|
} else {
|
|
timeout_id = fl_add_timeout(timeout_ms(),
|
|
C_TimeoutCB, this);
|
|
}
|
|
}
|
|
|
|
|
|
void xformsTimeout::stop()
|
|
{
|
|
if (running()) {
|
|
fl_remove_timeout(timeout_id);
|
|
timeout_id = -1;
|
|
}
|
|
}
|
|
|
|
|
|
void xformsTimeout::reset()
|
|
{
|
|
timeout_id = -1;
|
|
}
|