]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/io_callback.h
incomplete key mapping stuff. Introduces some breakage.
[lyx.git] / src / frontends / qt2 / io_callback.h
1 /**
2  * \file io_callback.h
3  * Copyright 2002 the LyX Team
4  * Read the file COPYING
5  *
6  * \author unknown
7  * \author John Levon <moz@compsoc.man.ac.uk>
8  */
9
10 #ifndef IO_CALLBACK_H
11 #define IO_CALLBACK_H
12  
13 #include <config.h>
14
15 #include "lyxserver.h"
16  
17 #include <qsocketnotifier.h>
18
19 /**
20  * io_callback - a simple wrapper for asynchronous pipe notification
21  *
22  * This is used by the lyxserver to notice the pipe is ready to be
23  * read.
24  *
25  * FIXME: this code apparently will not work on Windows.
26  */
27 class io_callback : public QObject {
28         Q_OBJECT 
29 public:
30         /// connect a read ready notification for fd to the LyXComm
31         io_callback(int fd, LyXComm * comm)
32                 : comm_(comm) {
33                 QSocketNotifier * sn = new QSocketNotifier(fd,
34                         QSocketNotifier::Read, this);
35                 connect(sn, SIGNAL(activated(int)), this, SLOT(data_received()));
36         }
37
38 public slots:
39         void data_received() {
40                 comm_->read_ready();
41         }
42
43 private:
44         LyXComm * comm_;
45 };
46
47 #endif // IO_CALLBACK_H