Ok, the long awaited config wizard is here (at least in a very basic state). There...
[quassel.git] / src / contrib / libqxt-2007-10-24 / src / gui / qxtnativeeventfilter.h
1 /****************************************************************************\r
2 **\r
3 ** Copyright (C) Qxt Foundation. Some rights reserved.\r
4 **\r
5 ** This file is part of the QxtGui module of the Qt eXTension library\r
6 **\r
7 ** This library is free software; you can redistribute it and/or modify it\r
8 ** under the terms of th Common Public License, version 1.0, as published by\r
9 ** IBM.\r
10 **\r
11 ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY\r
12 ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY\r
13 ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR\r
14 ** FITNESS FOR A PARTICULAR PURPOSE. \r
15 **\r
16 ** You should have received a copy of the CPL along with this file.\r
17 ** See the LICENSE file and the cpl1.0.txt file included with the source\r
18 ** distribution for more information. If you did not receive a copy of the\r
19 ** license, contact the Qxt Foundation.\r
20 ** \r
21 ** <http://libqxt.sourceforge.net>  <foundation@libqxt.org>\r
22 **\r
23 ****************************************************************************/\r
24 #ifndef QXTNATIVEEVENTFILTER_H\r
25 #define QXTNATIVEEVENTFILTER_H\r
26 \r
27 #include "qxtapplication.h"\r
28 \r
29 typedef struct tagMSG MSG;\r
30 typedef union  _XEvent XEvent;\r
31 typedef struct OpaqueEventRef *EventRef;\r
32 typedef struct OpaqueEventHandlerCallRef *EventHandlerCallRef;\r
33 \r
34 /*!\r
35     \class QxtNativeEventFilter QxtNativeEventFilter\r
36     \ingroup QxtGui\r
37     \brief A native event filter to access platform specific events.\r
38 \r
39     QxtNativeEventFilter provides access to platform specific native events\r
40     without the need of subclassing QApplication.\r
41 \r
42     \note QxtNativeEventFilter requires QxtApplication.\r
43 \r
44     Example usage:\r
45     \code\r
46     qxtApp->installNativeEventFilter(myWindow);\r
47 \r
48     class MyWindow : public QWidget, public QxtNativeEventFilter {\r
49         public:\r
50             ...\r
51 \r
52             bool x11EventFilter(XEvent* event) {\r
53                 if (event->type == ...) {\r
54                     ...\r
55                 }\r
56                 return false;\r
57             }\r
58 \r
59             bool winEventFilter(MSG* msg, long* result) {\r
60                 if (msg->message == ...) {\r
61                     ...\r
62                 }\r
63                 return false;\r
64             }\r
65 \r
66             bool macEventFilter(EventHandlerCallRef caller, EventRef event) {\r
67                 if (GetEventClass(event) == ...) {\r
68                     ...\r
69                 }\r
70                 return false;\r
71             }\r
72     };\r
73     \endcode\r
74 \r
75     \sa QxtApplication::installNativeEventFilter()\r
76  */\r
77 \r
78 /*!\r
79     \fn QxtNativeEventFilter::x11EventFilter(XEvent* event)\r
80 \r
81     Filters X11 events if this object has been installed as a native event filter.\r
82     In your reimplementation of this function, if you want to filter the event out,\r
83     i.e. stop it being handled further, return \b true; otherwise return \b false.\r
84 \r
85     \sa QxtApplication::installNativeEventFilter()\r
86  */\r
87 \r
88 /*!\r
89     \fn QxtNativeEventFilter::winEventFilter(MSG* msg, long* result)\r
90 \r
91     Filters Windows events if this object has been installed as a native event filter.\r
92     In your reimplementation of this function, if you want to filter the event out,\r
93     i.e. stop it being handled further, return \b true; otherwise return \b false.\r
94 \r
95     \sa QxtApplication::installNativeEventFilter()\r
96  */\r
97 \r
98 /*!\r
99     \fn QxtNativeEventFilter::macEventFilter(EventHandlerCallRef caller, EventRef event)\r
100 \r
101     Filters Mac events if this object has been installed as a native event filter.\r
102     In your reimplementation of this function, if you want to filter the event out,\r
103     i.e. stop it being handled further, return \b true; otherwise return \b false.\r
104 \r
105     \sa QxtApplication::installNativeEventFilter()\r
106  */\r
107 \r
108 class QxtNativeEventFilter\r
109 {\r
110 public:\r
111     virtual ~QxtNativeEventFilter()\r
112     { qxtApp->removeNativeEventFilter(this); }\r
113 \r
114     virtual bool x11EventFilter(XEvent* event) = 0;\r
115     virtual bool winEventFilter(MSG* msg, long* result) = 0;\r
116     virtual bool macEventFilter(EventHandlerCallRef caller, EventRef event) = 0;\r
117 };\r
118 \r
119 #endif // QXTNATIVEEVENTFILTER_H\r