Warning, file /frameworks/kjsembed/src/kjsembed/eventproxy.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE libraries
0002     Copyright (C) 2003,2004,2005,2006 Ian Reinhart Geiser <geiseri@kde.org>
0003     Copyright (C) 2003,2004,2005,2006 Matt Broadstone <mbroadst@gmail.com>
0004     Copyright (C) 2003,2004,2005,2006 Richard J. Moore <rich@kde.org>
0005     Copyright (C) 2003,2004,2005,2006 Erik L. Bunce <kde@bunce.us>
0006 
0007     This library is free software; you can redistribute it and/or
0008     modify it under the terms of the GNU Library General Public
0009     License as published by the Free Software Foundation; either
0010     version 2 of the License, or (at your option) any later version.
0011 
0012     This library is distributed in the hope that it will be useful,
0013     but WITHOUT ANY WARRANTY; without even the implied warranty of
0014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015     Library General Public License for more details.
0016 
0017     You should have received a copy of the GNU Library General Public License
0018     along with this library; see the file COPYING.LIB.  If not, write to
0019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020     Boston, MA 02110-1301, USA.
0021 */
0022 
0023 #ifndef EVENTPROXY_H
0024 #define EVENTPROXY_H
0025 #include <QObject>
0026 #include <QBitRef>
0027 #include <QEvent>
0028 
0029 #include <kjs/object.h>
0030 
0031 namespace KJS
0032 {
0033 class Interpreter;
0034 }
0035 
0036 namespace KJSEmbed
0037 {
0038 class QObjectBinding;
0039 /**
0040 * Filters events for a QObject and forwards them to a JS handler.
0041 * @author Richard Moore, rich@kde.org
0042 */
0043 class EventProxy : public QObject
0044 {
0045 public:
0046     EventProxy(QObjectBinding *watch, KJS::Interpreter *interpreter);
0047     ~EventProxy() override;
0048 
0049     /** Returns true iff we forward the event type to JS. */
0050     bool isFiltered(QEvent::Type t) const;
0051 
0052     /** Adds an event type to those we forward to JS. */
0053     void addFilter(QEvent::Type t);
0054 
0055     /**
0056     * Removes an event type from those we forward to JS. If there are no
0057     * event types left to forward then we self-destruct.
0058     */
0059     void removeFilter(QEvent::Type t);
0060 
0061     /** Reimplemented to forward events to JS. */
0062     bool eventFilter(QObject *watched, QEvent *e) override;
0063 
0064 protected:
0065     bool callHandler(QEvent *e);
0066 
0067 private:
0068     QObjectBinding *m_watch;
0069     KJS::Interpreter *m_interpreter;
0070     QBitArray m_eventMask;
0071     uint m_refcount;
0072 };
0073 }
0074 
0075 #endif