We now have a current svn snapshot of libqxt in our contrib dir, and
[quassel.git] / src / contrib / libqxt-2007-10-24 / src / gui / qxtnativeeventfilter.h
diff --git a/src/contrib/libqxt-2007-10-24/src/gui/qxtnativeeventfilter.h b/src/contrib/libqxt-2007-10-24/src/gui/qxtnativeeventfilter.h
new file mode 100644 (file)
index 0000000..3fedf6a
--- /dev/null
@@ -0,0 +1,119 @@
+/****************************************************************************\r
+**\r
+** Copyright (C) Qxt Foundation. Some rights reserved.\r
+**\r
+** This file is part of the QxtGui module of the Qt eXTension library\r
+**\r
+** This library is free software; you can redistribute it and/or modify it\r
+** under the terms of th Common Public License, version 1.0, as published by\r
+** IBM.\r
+**\r
+** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY\r
+** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY\r
+** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR\r
+** FITNESS FOR A PARTICULAR PURPOSE. \r
+**\r
+** You should have received a copy of the CPL along with this file.\r
+** See the LICENSE file and the cpl1.0.txt file included with the source\r
+** distribution for more information. If you did not receive a copy of the\r
+** license, contact the Qxt Foundation.\r
+** \r
+** <http://libqxt.sourceforge.net>  <foundation@libqxt.org>\r
+**\r
+****************************************************************************/\r
+#ifndef QXTNATIVEEVENTFILTER_H\r
+#define QXTNATIVEEVENTFILTER_H\r
+\r
+#include "qxtapplication.h"\r
+\r
+typedef struct tagMSG MSG;\r
+typedef union  _XEvent XEvent;\r
+typedef struct OpaqueEventRef *EventRef;\r
+typedef struct OpaqueEventHandlerCallRef *EventHandlerCallRef;\r
+\r
+/*!\r
+    \class QxtNativeEventFilter QxtNativeEventFilter\r
+    \ingroup QxtGui\r
+    \brief A native event filter to access platform specific events.\r
+\r
+    QxtNativeEventFilter provides access to platform specific native events\r
+    without the need of subclassing QApplication.\r
+\r
+    \note QxtNativeEventFilter requires QxtApplication.\r
+\r
+    Example usage:\r
+    \code\r
+    qxtApp->installNativeEventFilter(myWindow);\r
+\r
+    class MyWindow : public QWidget, public QxtNativeEventFilter {\r
+        public:\r
+            ...\r
+\r
+            bool x11EventFilter(XEvent* event) {\r
+                if (event->type == ...) {\r
+                    ...\r
+                }\r
+                return false;\r
+            }\r
+\r
+            bool winEventFilter(MSG* msg, long* result) {\r
+                if (msg->message == ...) {\r
+                    ...\r
+                }\r
+                return false;\r
+            }\r
+\r
+            bool macEventFilter(EventHandlerCallRef caller, EventRef event) {\r
+                if (GetEventClass(event) == ...) {\r
+                    ...\r
+                }\r
+                return false;\r
+            }\r
+    };\r
+    \endcode\r
+\r
+    \sa QxtApplication::installNativeEventFilter()\r
+ */\r
+\r
+/*!\r
+    \fn QxtNativeEventFilter::x11EventFilter(XEvent* event)\r
+\r
+    Filters X11 events if this object has been installed as a native event filter.\r
+    In your reimplementation of this function, if you want to filter the event out,\r
+    i.e. stop it being handled further, return \b true; otherwise return \b false.\r
+\r
+    \sa QxtApplication::installNativeEventFilter()\r
+ */\r
+\r
+/*!\r
+    \fn QxtNativeEventFilter::winEventFilter(MSG* msg, long* result)\r
+\r
+    Filters Windows events if this object has been installed as a native event filter.\r
+    In your reimplementation of this function, if you want to filter the event out,\r
+    i.e. stop it being handled further, return \b true; otherwise return \b false.\r
+\r
+    \sa QxtApplication::installNativeEventFilter()\r
+ */\r
+\r
+/*!\r
+    \fn QxtNativeEventFilter::macEventFilter(EventHandlerCallRef caller, EventRef event)\r
+\r
+    Filters Mac events if this object has been installed as a native event filter.\r
+    In your reimplementation of this function, if you want to filter the event out,\r
+    i.e. stop it being handled further, return \b true; otherwise return \b false.\r
+\r
+    \sa QxtApplication::installNativeEventFilter()\r
+ */\r
+\r
+class QxtNativeEventFilter\r
+{\r
+public:\r
+    virtual ~QxtNativeEventFilter()\r
+    { qxtApp->removeNativeEventFilter(this); }\r
+\r
+    virtual bool x11EventFilter(XEvent* event) = 0;\r
+    virtual bool winEventFilter(MSG* msg, long* result) = 0;\r
+    virtual bool macEventFilter(EventHandlerCallRef caller, EventRef event) = 0;\r
+};\r
+\r
+#endif // QXTNATIVEEVENTFILTER_H\r