mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 19:02:48 +00:00

most of the changes were done trought Katie's namefsck script which convertes forward class declarations to include directives, however other fixes here and there were needed as well as some questionable changes to Q_DECLARE_TYPEINFO() macro calls because they most likely have to do the namespacing themselfs (QT_BEGIN/END_NAMESPACE, and probably will be in Katie) meaning that some of the changes may be temporary and reverted later. Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
74 lines
2.3 KiB
C++
74 lines
2.3 KiB
C++
/* This file is part of the KDE libraries
|
|
Copyright (C) 2006,2007 Andreas Hartmetz (ahartmetz@gmail.com)
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Library General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Library General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Library General Public License
|
|
along with this library; see the file COPYING.LIB. If not, write to
|
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#ifndef KGESTUREMAP_H
|
|
#define KGESTUREMAP_H
|
|
|
|
#include <QObject>
|
|
#include <QHash>
|
|
#include <QTimer>
|
|
#include <QEvent>
|
|
|
|
#include "kgesture.h"
|
|
|
|
class KApplication;
|
|
class KAction;
|
|
|
|
class KGestureMap : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
static KGestureMap *self();
|
|
|
|
virtual bool eventFilter(QObject *obj, QEvent *e);
|
|
void addGesture(const KShapeGesture &gesture, KAction *kact);
|
|
void addGesture(const KRockerGesture &gesture, KAction *kact);
|
|
void removeGesture(const KShapeGesture &gesture, KAction *kact);
|
|
void removeGesture(const KRockerGesture &gesture, KAction *kact);
|
|
KAction *findAction(const KShapeGesture &gesture) const;
|
|
KAction *findAction(const KRockerGesture &gesture) const;
|
|
|
|
private Q_SLOTS:
|
|
void stopAcquisition();
|
|
|
|
private:
|
|
friend class KGestureMapContainer;
|
|
KGestureMap();
|
|
virtual ~KGestureMap();
|
|
|
|
friend class KApplicationPrivate;
|
|
//intended to be used at application initialization
|
|
void installEventFilterOnMe(KApplication *app);
|
|
|
|
inline int bitCount(int n);
|
|
void handleAction(KAction *kact);
|
|
void matchShapeGesture();
|
|
|
|
//this is an internal class so don't bother with a d-pointer
|
|
QHash<KShapeGesture, KAction *> m_shapeGestures;
|
|
QHash<KRockerGesture, KAction *> m_rockerGestures;
|
|
QPolygon m_points;
|
|
QTimer m_gestureTimeout;
|
|
bool m_acquiring;
|
|
|
|
KShapeGesture m_shapeGesture;
|
|
KRockerGesture m_rockerGesture;
|
|
};
|
|
|
|
#endif //KGESTUREMAP_H
|