Qt 4.8
qwsevent_qws.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QWSEVENT_QWS_H
43 #define QWSEVENT_QWS_H
44 
45 #include <QtGui/qwsutils_qws.h>
46 #include <QtGui/qwsprotocolitem_qws.h>
47 #include <QtCore/qrect.h>
48 #include <QtGui/qregion.h>
49 #include <QtCore/qvector.h>
50 
52 
54 
55 QT_MODULE(Gui)
56 
57 struct QWSMouseEvent;
58 
60 
61  QWSEvent(int t, int len, char *ptr) : QWSProtocolItem(t,len,ptr) {}
62 
63 
64 
65  enum Type {
70  Key,
88  };
89 
91  { return type == Mouse ? reinterpret_cast<QWSMouseEvent*>(this) : 0; }
92  int window() { return *(reinterpret_cast<int*>(simpleDataPtr)); }
93  int window() const { return *(reinterpret_cast<int*>(simpleDataPtr)); }
94  static QWSEvent *factory(int type);
95 };
96 
97 
98 //All events must start with windowID
99 
102  : QWSEvent(QWSEvent::Connected, sizeof(simpleData),
103  reinterpret_cast<char*>(&simpleData)) {}
104 
105  void setData(const char *d, int len, bool allocateMem = true) {
106  QWSEvent::setData(d, len, allocateMem);
107  display = reinterpret_cast<char*>(rawDataPtr);
108  }
109 
110  struct SimpleData {
111  int window;
112  int len;
113  int clientId;
115  } simpleData;
116 
117  char *display;
118 };
119 
122  : QWSEvent(MaxWindowRect, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) { }
123  struct SimpleData {
124  int window;
126  } simpleData;
127 };
128 
131  : QWSEvent(QWSEvent::Mouse, sizeof(simpleData),
132  reinterpret_cast<char*>(&simpleData)) {}
133  struct SimpleData {
134  int window;
135  int x_root, y_root, state, delta;
136  int time; // milliseconds
137  } simpleData;
138 };
139 
142  : QWSEvent(QWSEvent::Focus, sizeof(simpleData), reinterpret_cast<char*>(&simpleData))
143  { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
144  struct SimpleData {
145  int window;
147  } simpleData;
148 };
149 
152  : QWSEvent(QWSEvent::Key, sizeof(simpleData),
153  reinterpret_cast<char*>(&simpleData)) {}
154  struct SimpleData {
155  int window;
157  Qt::KeyboardModifiers modifiers;
161  } simpleData;
162 };
163 
164 
167  : QWSEvent(QWSEvent::Creation, sizeof(simpleData),
168  reinterpret_cast<char*>(&simpleData)) {}
169  struct SimpleData {
170  int objectid;
171  int count;
172  } simpleData;
173 };
174 
175 #ifndef QT_NO_QWS_PROPERTIES
178  : QWSEvent(QWSEvent::PropertyNotify, sizeof(simpleData),
179  reinterpret_cast<char*>(&simpleData)) {}
180  enum State {
182  PropertyDeleted
183  };
184  struct SimpleData {
185  int window;
186  int property;
187  int state;
188  } simpleData;
189 };
190 #endif
191 
194  : QWSEvent(QWSEvent::SelectionClear, sizeof(simpleData),
195  reinterpret_cast<char*>(&simpleData)) {}
196  struct SimpleData {
197  int window;
198  } simpleData;
199 };
200 
203  : QWSEvent(QWSEvent::SelectionRequest, sizeof(simpleData),
204  reinterpret_cast<char*>(&simpleData)) {}
205  struct SimpleData {
206  int window;
207  int requestor; // window which wants the selection
208  int property; // property on requestor into which the selection should be stored, normally QWSProperty::PropSelection
209  int mimeTypes; // Value is stored in the property mimeType on the requestor window. This value may contain
210  // multiple mimeTypes separated by ;; where the order reflects the priority
211  } simpleData;
212 };
213 
216  : QWSEvent(QWSEvent::SelectionNotify, sizeof(simpleData),
217  reinterpret_cast<char*>(&simpleData)) {}
218  struct SimpleData {
219  int window;
220  int requestor; // the window which wanted the selection and to which this event is sent
221  int property; // property of requestor in which the data of the selection is stored
222  int mimeType; // a property on the requestor in which the mime type in which the selection is, is stored
223  } simpleData;
224 };
225 
226 //complex events:
227 
230  : QWSEvent(QWSEvent::Region, sizeof(simpleData),
231  reinterpret_cast<char*>(&simpleData))
232  { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
233 
234  void setData(const char *d, int len, bool allocateMem = true) {
235  QWSEvent::setData(d, len, allocateMem);
236  rectangles = reinterpret_cast<QRect*>(rawDataPtr);
237  }
238 
239  void setData(int winId, const QRegion &region, uint type) {
240  const QVector<QRect> rects = region.rects();
241  setData(reinterpret_cast<const char*>(rects.constData()),
242  rects.size() * sizeof(QRect));
243  simpleData.window = winId;
244  simpleData.nrectangles = rects.size();
245  simpleData.type = type;
246 #ifdef QT_QWS_CLIENTBLIT
247  simpleData.id = 0;
248 #endif
249  }
250 
251  enum Type {Allocation
252 #ifdef QT_QWS_CLIENTBLIT
253  , DirectPaint
254 #endif
255  };
256  struct SimpleData {
257  int window;
259 #ifdef QT_QWS_CLIENTBLIT
260  int id;
261 #endif
263  } simpleData;
264 
266 };
267 
268 #ifndef QT_NO_QWSEMBEDWIDGET
270 {
271  QWSEmbedEvent() : QWSEvent(QWSEvent::Embed, sizeof(simpleData),
272  reinterpret_cast<char*>(&simpleData))
273  {}
274 
275  enum Type { StartEmbed = 1, StopEmbed = 2, Region = 4 };
276 
277  void setData(const char *d, int len, bool allocateMem = true) {
278  QWSEvent::setData(d, len, allocateMem);
279  region.setRects(reinterpret_cast<const QRect *>(rawDataPtr),
280  simpleData.nrectangles);
281  }
282 
283  void setData(int winId, Type type, const QRegion &reg = QRegion()) {
284  simpleData.window = winId;
285  simpleData.nrectangles = reg.rects().size();
286  simpleData.type = type;
287  region = reg;
288  const QVector<QRect> rects = reg.rects();
289  QWSEvent::setData(reinterpret_cast<const char*>(rects.data()),
290  rects.size() * sizeof(QRect));
291  }
292 
293  struct SimpleData {
294  int window;
297  } simpleData;
298 
300 };
301 #endif // QT_NO_QWSEMBEDWIDGET
302 
303 #ifndef QT_NO_QWS_PROPERTIES
306  : QWSEvent(QWSEvent::PropertyReply, sizeof(simpleData),
307  reinterpret_cast<char*>(&simpleData)) {}
308 
309  void setData(const char *d, int len, bool allocateMem = true) {
310  QWSEvent::setData(d, len, allocateMem);
311  data = reinterpret_cast<char*>(rawDataPtr);
312  }
313 
314  struct SimpleData {
315  int window;
316  int property;
317  int len;
318  } simpleData;
319  char *data;
320 };
321 #endif //QT_NO_QWS_PROPERTIES
322 
323 #ifndef QT_NO_COP
326  : QWSEvent(QWSEvent::QCopMessage, sizeof(simpleData),
327  reinterpret_cast<char*>(&simpleData))
328  { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
329 
330  void setData(const char *d, int len, bool allocateMem = true) {
331  QWSEvent::setData(d, len, allocateMem);
332  char* p = rawDataPtr;
333  channel = QByteArray(p, simpleData.lchannel);
334  p += simpleData.lchannel;
335  message = QByteArray(p, simpleData.lmessage);
336  p += simpleData.lmessage;
337  data = QByteArray(p, simpleData.ldata);
338  }
339 
340  void setDataDirect(const char *d, int len) {
341  QWSEvent::setData(d, len, false);
342  deleteRaw = true;
343  }
344 
345  struct SimpleData {
347  int lchannel;
348  int lmessage;
349  int ldata;
350  } simpleData;
351 
355 };
356 
357 #endif
358 
361  : QWSEvent(WindowOperation, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) { }
362 
363  enum Operation { Show, Hide, ShowMaximized, ShowNormal, ShowMinimized, Close };
364  struct SimpleData {
365  int window;
367  } simpleData;
368 };
369 
370 #ifndef QT_NO_QWS_INPUTMETHODS
371 
372 
375  : QWSEvent(IMEvent, sizeof(simpleData), reinterpret_cast<char*>(&simpleData))
376  { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
377 
378  struct SimpleData {
379  int window;
382  } simpleData;
383 
384  void setData(const char *d, int len, bool allocateMem = true) {
385  QWSEvent::setData(d, len, allocateMem);
386  streamingData = QByteArray::fromRawData(rawDataPtr, len);
387  }
389 };
390 
391 
394  : QWSEvent(IMInit, sizeof(simpleData), reinterpret_cast<char*>(&simpleData))
395  { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
396 
397  struct SimpleData {
398  int window;
400  } simpleData;
401 
402  void setData(const char *d, int len, bool allocateMem = true) {
403  QWSEvent::setData(d, len, allocateMem);
404  streamingData = QByteArray::fromRawData(rawDataPtr, len);
405  }
407 };
408 
409 
412  : QWSEvent(QWSEvent::IMQuery, sizeof(simpleData),
413  reinterpret_cast<char*>(&simpleData)) {}
414 
415  struct SimpleData {
416  int window;
417  int property;
418  } simpleData;
419 
420 };
421 
422 #endif
423 
426  : QWSEvent(QWSEvent::Font, sizeof(simpleData),
427  reinterpret_cast<char*>(&simpleData)) {}
428 
429  enum EventType {
430  FontRemoved
431  };
432 
433  void setData(const char *d, int len, bool allocateMem = true) {
434  QWSEvent::setData(d, len, allocateMem);
435  fontName = QByteArray::fromRawData(rawDataPtr, len);
436  }
437 
438  struct SimpleData {
440  } simpleData;
442 };
443 
446  : QWSEvent(QWSEvent::ScreenTransformation, sizeof(simpleData),
447  reinterpret_cast<char*>(&simpleData)) {}
448 
449  struct SimpleData {
450  int screen;
452  } simpleData;
453 };
454 
456 
458 
459 #endif // QWSEVENT_QWS_H
double d
Definition: qnumeric_p.h:62
QByteArray fontName
Definition: qwsevent_qws.h:441
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_MODULE(x)
Definition: qglobal.h:2783
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:433
virtual void setData(const char *data, int len, bool allocateMem=true)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QWSMouseEvent * asMouse()
Definition: qwsevent_qws.h:90
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:384
struct _XRegion * Region
Definition: qwindowdefs.h:118
int window()
Definition: qwsevent_qws.h:92
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:277
The QWSEvent class encapsulates an event in Qt for Embedded Linux.
Definition: qwsevent_qws.h:59
unsigned char uchar
Definition: qglobal.h:994
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
Qt::KeyboardModifiers modifiers
Definition: qwsevent_qws.h:157
QByteArray streamingData
Definition: qwsevent_qws.h:388
static QByteArray fromRawData(const char *, int size)
Constructs a QByteArray that uses the first size bytes of the data array.
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:309
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:234
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
const T * ptr(const T &t)
int window() const
Definition: qwsevent_qws.h:93
The State element defines configurations of objects and properties.
Type
This enum describes the origin of the event.
Definition: qwsevent_qws.h:65
QRect * rectangles
Definition: qwsevent_qws.h:265
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:402
void setData(int winId, Type type, const QRegion &reg=QRegion())
Definition: qwsevent_qws.h:283
void setData(int winId, const QRegion &region, uint type)
Definition: qwsevent_qws.h:239
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:330
QByteArray streamingData
Definition: qwsevent_qws.h:406
static QWSEvent * factory(int type)
unsigned short ushort
Definition: qglobal.h:995
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:105
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QWSEvent(int t, int len, char *ptr)
Definition: qwsevent_qws.h:61
T * data()
Returns a pointer to the data stored in the vector.
Definition: qvector.h:152
const T * constData() const
Returns a const pointer to the data stored in the vector.
Definition: qvector.h:154
#define QT_END_HEADER
Definition: qglobal.h:137
void setDataDirect(const char *d, int len)
Definition: qwsevent_qws.h:340
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
QRegion region
Definition: qwsevent_qws.h:299