mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
f490ae76ab
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1456 a592a061-630c-0410-9148-cb99ea01b6c8
70 lines
1.1 KiB
C++
70 lines
1.1 KiB
C++
/**
|
|
* \file Timeout.h
|
|
* Copyright 2001 LyX Team
|
|
* Read COPYING
|
|
*
|
|
* \author Lars Gullik Bjønnes
|
|
* \author John Levon
|
|
*/
|
|
#ifndef TIMEOUT_H
|
|
#define TIMEOUT_H
|
|
|
|
#include <config.h>
|
|
|
|
#ifdef __GNUG__
|
|
#pragma interface
|
|
#endif
|
|
|
|
#include <sigc++/signal_system.h>
|
|
|
|
#ifdef SIGC_CXX_NAMESPACES
|
|
using SigC::Signal0;
|
|
#endif
|
|
|
|
/**
|
|
* This class executes the callback when the timeout expires.
|
|
*/
|
|
class Timeout {
|
|
public:
|
|
///
|
|
enum Type {
|
|
/// one-shot timer
|
|
ONETIME,
|
|
/// repeating
|
|
CONTINUOUS
|
|
};
|
|
///
|
|
Timeout();
|
|
///
|
|
Timeout(unsigned int msec, Type = ONETIME);
|
|
///
|
|
~Timeout();
|
|
/// start the timer
|
|
void start();
|
|
/// stop the timer
|
|
void stop();
|
|
/// restart the timer
|
|
void restart();
|
|
/// signal emitted on timer expiry
|
|
Signal0<void> timeout;
|
|
/// emit the signal
|
|
void emit();
|
|
/// set the timer type
|
|
Timeout & setType(Type t);
|
|
/// set the timeout value
|
|
Timeout & setTimeout(unsigned int msec);
|
|
|
|
private:
|
|
struct Pimpl;
|
|
friend struct Pimpl;
|
|
/// implementation
|
|
Pimpl * pimpl_;
|
|
|
|
/// one-shot or repeating
|
|
Type type;
|
|
/// timeout value in milliseconds
|
|
unsigned int timeout_ms;
|
|
};
|
|
|
|
#endif
|