mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 21:49:51 +00:00
271f8d7eec
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2713 a592a061-630c-0410-9148-cb99ea01b6c8
67 lines
910 B
C
67 lines
910 B
C
/**
|
|
* \file Timeout_pimpl.C
|
|
* Copyright 2001 LyX Team
|
|
* Read COPYING
|
|
*
|
|
* \author Lars Gullik Bjønnes
|
|
* \author John Levon
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
#ifdef __GNUG__
|
|
#pragma implementation
|
|
#endif
|
|
|
|
#include "Timeout_pimpl.h"
|
|
#include "debug.h"
|
|
|
|
using std::endl;
|
|
|
|
namespace {
|
|
|
|
extern "C" {
|
|
|
|
static
|
|
void C_intern_timeout_cb(int, void * data)
|
|
{
|
|
Timeout * to = static_cast<Timeout *>(data);
|
|
to->emit();
|
|
}
|
|
|
|
}
|
|
|
|
} // namespace anon
|
|
|
|
|
|
Timeout::Pimpl::Pimpl(Timeout * owner)
|
|
: owner_(owner), timeout_id(-1)
|
|
{
|
|
}
|
|
|
|
|
|
void Timeout::Pimpl::reset()
|
|
{
|
|
timeout_id = -1;
|
|
}
|
|
|
|
|
|
void Timeout::Pimpl::start()
|
|
{
|
|
if (timeout_id != -1)
|
|
lyxerr << "Timeout::start: already running!" << endl;
|
|
timeout_id = fl_add_timeout(owner_->timeout_ms,
|
|
C_intern_timeout_cb, owner_);
|
|
}
|
|
|
|
|
|
void Timeout::Pimpl::stop()
|
|
{
|
|
if (timeout_id != -1) {
|
|
fl_remove_timeout(timeout_id);
|
|
timeout_id = -1;
|
|
}
|
|
}
|