Qt 4.8
Public Types | Public Functions | Protected Types | Protected Functions | Protected Variables | List of all members
QWSPcMouseSubHandler Class Referenceabstract
Inheritance diagram for QWSPcMouseSubHandler:
QWSPcMouseSubHandler_intellimouse QWSPcMouseSubHandler_mouseman QWSPcMouseSubHandler_serial QWSPcMouseSubHandler_mousesystems QWSPcMouseSubHandler_ms

Public Types

enum  UsageResult { Insufficient, Motion, Button }
 

Public Functions

void appendData (uchar *data, int length)
 
int buttonState () const
 
void closeIfNot (int &f)
 
int file () const
 
void initState ()
 
bool motionPending () const
 
 QWSPcMouseSubHandler (int f)
 
bool reliable () const
 
QPoint takeMotion ()
 
int takeWheel ()
 
UsageResult useData ()
 
void worse (int by=1)
 
virtual ~QWSPcMouseSubHandler ()
 

Protected Types

enum  { max_buf =32 }
 

Protected Functions

virtual int tryData ()=0
 

Protected Variables

int badness
 
int bstate
 
uchar buffer [max_buf]
 
int fd
 
int goodness
 
QPoint motion
 
int nbuf
 
int wheel
 

Detailed Description

Definition at line 80 of file qmousepc_qws.cpp.

Enumerations

◆ anonymous enum

anonymous enum
protected
Enumerator
max_buf 

Definition at line 82 of file qmousepc_qws.cpp.

◆ UsageResult

Enumerator
Insufficient 
Motion 
Button 

Definition at line 130 of file qmousepc_qws.cpp.

Constructors and Destructors

◆ QWSPcMouseSubHandler()

QWSPcMouseSubHandler::QWSPcMouseSubHandler ( int  f)
inline

Definition at line 99 of file qmousepc_qws.cpp.

99  : fd(f)
100  {
101  initState();
102  }

◆ ~QWSPcMouseSubHandler()

virtual QWSPcMouseSubHandler::~QWSPcMouseSubHandler ( )
inlinevirtual

Definition at line 103 of file qmousepc_qws.cpp.

103 {}

Functions

◆ appendData()

void QWSPcMouseSubHandler::appendData ( uchar data,
int  length 
)
inline

Definition at line 124 of file qmousepc_qws.cpp.

Referenced by QWSPcMouseHandlerPrivate::readMouseData().

125  {
126  memcpy(buffer+nbuf, data, length);
127  nbuf += length;
128  }
uchar buffer[max_buf]
static const char * data(const QByteArray &arr)

◆ buttonState()

int QWSPcMouseSubHandler::buttonState ( ) const
inline

Definition at line 119 of file qmousepc_qws.cpp.

Referenced by QWSPcMouseHandlerPrivate::sendEvent().

119 { return bstate; }

◆ closeIfNot()

void QWSPcMouseSubHandler::closeIfNot ( int &  f)
inline

Definition at line 107 of file qmousepc_qws.cpp.

Referenced by QWSPcMouseHandlerPrivate::closeDevices().

108  {
109  if (fd != f) {
110  f = fd;
111  QT_CLOSE(fd);
112  }
113  }
#define QT_CLOSE
Definition: qcore_unix_p.h:304

◆ file()

int QWSPcMouseSubHandler::file ( ) const
inline

Definition at line 105 of file qmousepc_qws.cpp.

Referenced by QWSPcMouseHandlerPrivate::readMouseData().

105 { return fd; }

◆ initState()

void QWSPcMouseSubHandler::initState ( )
inline

◆ motionPending()

bool QWSPcMouseSubHandler::motionPending ( ) const
inline

Definition at line 120 of file qmousepc_qws.cpp.

Referenced by QWSPcMouseHandlerPrivate::readMouseData().

120 { return motion!=QPoint(0,0); }
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53

◆ reliable()

bool QWSPcMouseSubHandler::reliable ( ) const
inline

◆ takeMotion()

QPoint QWSPcMouseSubHandler::takeMotion ( )
inline

Definition at line 121 of file qmousepc_qws.cpp.

Referenced by QWSPcMouseHandlerPrivate::sendEvent().

121 { QPoint r=motion; motion=QPoint(0,0); return r; }
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53

◆ takeWheel()

int QWSPcMouseSubHandler::takeWheel ( )
inline

Definition at line 122 of file qmousepc_qws.cpp.

Referenced by QWSPcMouseHandlerPrivate::sendEvent().

122 { int result = wheel; wheel = 0; return result; }

◆ tryData()

virtual int QWSPcMouseSubHandler::tryData ( )
protectedpure virtual

◆ useData()

UsageResult QWSPcMouseSubHandler::useData ( )
inline

Definition at line 132 of file qmousepc_qws.cpp.

Referenced by QWSPcMouseHandlerPrivate::readMouseData().

133  {
134  int pbstate = bstate;
135  int n = tryData();
136 #ifdef QWS_MOUSE_DEBUG
137  if (n) {
138  fprintf(stderr, "QWSPcMouseSubHandler tryData read %d bytes:", n);
139  for (int i=0; i<n; ++i)
140  fprintf(stderr, " %02x", buffer[i]);
141  fprintf(stderr, "\n");
142  }
143 #endif
144  if (n > 0) {
145  if (n<nbuf)
146  memmove(buffer, buffer+n, nbuf-n);
147  nbuf -= n;
148  return (wheel || pbstate != bstate) ? Button : Motion;
149  }
150  return Insufficient;
151  }
uchar buffer[max_buf]
virtual int tryData()=0

◆ worse()

void QWSPcMouseSubHandler::worse ( int  by = 1)
inline

Definition at line 117 of file qmousepc_qws.cpp.

Referenced by QWSPcMouseHandlerPrivate::sendEvent().

117 { badness+=by; }

Properties

◆ badness

int QWSPcMouseSubHandler::badness
protected

◆ bstate

int QWSPcMouseSubHandler::bstate
protected

◆ buffer

uchar QWSPcMouseSubHandler::buffer[max_buf]
protected

◆ fd

int QWSPcMouseSubHandler::fd
protected

◆ goodness

int QWSPcMouseSubHandler::goodness
protected

◆ motion

QPoint QWSPcMouseSubHandler::motion
protected

◆ nbuf

int QWSPcMouseSubHandler::nbuf
protected

◆ wheel

int QWSPcMouseSubHandler::wheel
protected

Definition at line 91 of file qmousepc_qws.cpp.

Referenced by takeWheel(), and QWSPcMouseSubHandler_intellimouse::tryData().


The documentation for this class was generated from the following file: