1 /****************************************************************************
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the tools applications of the Qt Toolkit.
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
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.
40 ****************************************************************************/
41 #ifndef QVFBPROTOCOL_H
42 #define QVFBPROTOCOL_H
50 class QVFbKeyProtocol
;
51 class QVFbMouseProtocol
;
52 class QVFbViewProtocol
: public QObject
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) {}
77 virtual void flushChanges();
80 void displayDataChanged(const QRect
&);
81 void displayEmbedRequested(WId windowId
);
84 virtual QVFbKeyProtocol
*keyHandler() const = 0;
85 virtual QVFbMouseProtocol
*mouseHandler() const = 0;
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;
106 class QVFbMouseProtocol
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;
120 /* since there is very little variation in input protocols defaults are
123 class QVFbKeyPipeProtocol
: public QVFbKeyProtocol
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
; }
138 class QVFbMousePipe
: public QVFbMouseProtocol
141 QVFbMousePipe(int display_id
);
144 void sendMouseData(const QPoint
&pos
, int buttons
, int wheel
);
146 QString
pipeName() const { return fileName
; }
153 class QVFbMouseLinuxTP
: public QObject
, public QVFbMousePipe
157 QVFbMouseLinuxTP(int display_id
);
160 void sendMouseData(const QPoint
&pos
, int buttons
, int wheel
);
163 void repeatLastPress();
166 void writeToPipe(const QPoint
&pos
, ushort pressure
);