35 lines
537 B
C++
35 lines
537 B
C++
#ifndef PIKBDLISTENER_H
|
|
#define PIKBDLISTENER_H
|
|
|
|
#include "pithread.h"
|
|
#ifndef __WIN32__
|
|
#include <termios.h>
|
|
#endif
|
|
|
|
typedef void (*KBFunc)(void * , char);
|
|
|
|
class PIKbdListener: public PIThread {
|
|
public:
|
|
// slot is any function format "void <func>(void * , char)"
|
|
PIKbdListener(KBFunc slot = 0, void * data = 0);
|
|
~PIKbdListener();
|
|
|
|
private:
|
|
void run();
|
|
|
|
KBFunc ret_func;
|
|
char rc;
|
|
void * data;
|
|
#ifdef __WIN32__
|
|
DWORD ret;
|
|
void * hIn;
|
|
DWORD smode;
|
|
#else
|
|
int ret;
|
|
struct termios sterm;
|
|
#endif
|
|
|
|
};
|
|
|
|
#endif // PIKBDLISTENER_H
|