(MSVC 2002/2003) Use 64-bit versions of ftell and fseek
[qt-netbsd.git] / tools / qvfb / qvfbprotocol.h
blob9e725602b4cf9f8056ecb53da135019c8f08054c
1 /****************************************************************************
2 **
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the tools applications of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
38 ** $QT_END_LICENSE$
40 ****************************************************************************/
41 #ifndef QVFBPROTOCOL_H
42 #define QVFBPROTOCOL_H
44 #include <QImage>
45 #include <QVector>
46 #include <QColor>
48 QT_BEGIN_NAMESPACE
50 class QVFbKeyProtocol;
51 class QVFbMouseProtocol;
52 class QVFbViewProtocol : public QObject
54 Q_OBJECT
55 public:
56 QVFbViewProtocol(int display_id, QObject *parent = 0);
58 virtual ~QVFbViewProtocol();
60 int id() const { return mDisplayId; }
62 void sendKeyboardData(QString unicode, int keycode,
63 int modifiers, bool press, bool repeat);
64 void sendMouseData(const QPoint &pos, int buttons, int wheel);
66 virtual int width() const = 0;
67 virtual int height() const = 0;
68 virtual int depth() const = 0;
69 virtual int linestep() const = 0;
70 virtual int numcols() const = 0;
71 virtual QVector<QRgb> clut() const = 0;
72 virtual unsigned char *data() const = 0;
73 virtual int brightness() const = 0;
75 virtual void setRate(int) {}
76 public slots:
77 virtual void flushChanges();
79 signals:
80 void displayDataChanged(const QRect &);
81 void displayEmbedRequested(WId windowId);
83 protected:
84 virtual QVFbKeyProtocol *keyHandler() const = 0;
85 virtual QVFbMouseProtocol *mouseHandler() const = 0;
87 private:
88 int mDisplayId;
91 class QVFbKeyProtocol
93 public:
94 QVFbKeyProtocol(int display_id) : mDisplayId(display_id) {}
95 virtual ~QVFbKeyProtocol() {}
97 int id() const { return mDisplayId; }
99 virtual void sendKeyboardData(QString unicode, int keycode,
100 int modifiers, bool press, bool repeat) = 0;
102 private:
103 int mDisplayId;
106 class QVFbMouseProtocol
108 public:
109 QVFbMouseProtocol(int display_id) : mDisplayId(display_id) {}
110 virtual ~QVFbMouseProtocol() {}
112 int id() const { return mDisplayId; }
114 virtual void sendMouseData(const QPoint &pos, int buttons, int wheel) = 0;
116 private:
117 int mDisplayId;
120 /* since there is very little variation in input protocols defaults are
121 provided */
123 class QVFbKeyPipeProtocol : public QVFbKeyProtocol
125 public:
126 QVFbKeyPipeProtocol(int display_id);
127 ~QVFbKeyPipeProtocol();
129 void sendKeyboardData(QString unicode, int keycode,
130 int modifiers, bool press, bool repeat);
132 QString pipeName() const { return fileName; }
133 private:
134 int fd;
135 QString fileName;
138 class QVFbMousePipe: public QVFbMouseProtocol
140 public:
141 QVFbMousePipe(int display_id);
142 ~QVFbMousePipe();
144 void sendMouseData(const QPoint &pos, int buttons, int wheel);
146 QString pipeName() const { return fileName; }
147 protected:
148 int fd;
149 QString fileName;
152 class QTimer;
153 class QVFbMouseLinuxTP : public QObject, public QVFbMousePipe
155 Q_OBJECT
156 public:
157 QVFbMouseLinuxTP(int display_id);
158 ~QVFbMouseLinuxTP();
160 void sendMouseData(const QPoint &pos, int buttons, int wheel);
162 protected slots:
163 void repeatLastPress();
165 protected:
166 void writeToPipe(const QPoint &pos, ushort pressure);
167 QPoint lastPos;
168 QTimer *repeater;
171 QT_END_NAMESPACE
173 #endif