2000-06-08 23:16:16 +00:00
|
|
|
// -*- C++ -*-
|
2000-07-24 13:53:19 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
* Copyright 1995-2000 The LyX Team.
|
|
|
|
*
|
|
|
|
* ====================================================== */
|
|
|
|
|
2000-06-08 23:16:16 +00:00
|
|
|
#ifndef TIMEOUT_H
|
|
|
|
#define TIMEOUT_H
|
|
|
|
|
2000-08-14 15:17:54 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2000-07-24 13:53:19 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2000-08-14 15:33:40 +00:00
|
|
|
#include <sigc++/signal_system.h>
|
|
|
|
|
2000-06-21 12:41:18 +00:00
|
|
|
#ifdef SIGC_CXX_NAMESPACES
|
|
|
|
using SigC::Signal0;
|
|
|
|
#endif
|
|
|
|
|
2000-06-08 23:16:16 +00:00
|
|
|
/** This class executes the callback when the timeout expires.
|
|
|
|
This class currently uses a regular callback, later it will use
|
|
|
|
signals and slots to provide the same.
|
|
|
|
*/
|
|
|
|
class Timeout {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
enum Type {
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
ONETIME,
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
CONTINOUS
|
|
|
|
};
|
|
|
|
///
|
|
|
|
Timeout();
|
|
|
|
///
|
2000-10-26 00:07:20 +00:00
|
|
|
Timeout(unsigned int msec, Type = ONETIME);
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
|
|
|
~Timeout();
|
|
|
|
///
|
|
|
|
void start();
|
|
|
|
///
|
|
|
|
void stop();
|
|
|
|
///
|
|
|
|
void restart();
|
|
|
|
///
|
2000-06-21 12:41:18 +00:00
|
|
|
Signal0<void> timeout;
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2000-06-21 12:41:18 +00:00
|
|
|
void emit();
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2000-10-26 00:07:20 +00:00
|
|
|
Timeout & setType(Type t);
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
2000-10-26 00:07:20 +00:00
|
|
|
Timeout & setTimeout(unsigned int msec);
|
2000-06-08 23:16:16 +00:00
|
|
|
private:
|
|
|
|
///
|
|
|
|
Type type;
|
|
|
|
///
|
2000-10-26 00:07:20 +00:00
|
|
|
unsigned int timeout_ms;
|
2000-06-08 23:16:16 +00:00
|
|
|
///
|
|
|
|
int timeout_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|