kcursor_private.h

00001 /* This file is part of the KDE libraries
00002 
00003    Copyright (c) 2000 Carsten Pfeiffer <pfeiffer@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License (LGPL) as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KCURSOR_PRIVATE_H
00022 #define KCURSOR_PRIVATE_H
00023 
00024 #include <qcursor.h>
00025 #include <qobject.h>
00026 #include <qptrdict.h>
00027 
00028 class QPoint;
00029 class QTimer;
00030 class QWidget;
00031 
00039 class KCursorPrivateAutoHideEventFilter : public QObject
00040 {
00041     Q_OBJECT
00042 
00043 public:
00044     KCursorPrivateAutoHideEventFilter( QWidget* widget );
00045     ~KCursorPrivateAutoHideEventFilter();
00046 
00047     virtual bool eventFilter( QObject *o, QEvent *e );
00048     
00049     void resetWidget();
00050 
00051 private slots:
00052     void hideCursor();
00053     void unhideCursor();
00054 
00055 private:
00056     QWidget* actualWidget() const;
00057 
00058     QTimer m_autoHideTimer;
00059     QWidget* m_widget;
00060     bool m_wasMouseTracking;
00061     bool m_isCursorHidden;
00062     bool m_isOwnCursor;
00063     QCursor m_oldCursor;
00064 };
00065 
00071 class KCursorPrivate : public QObject
00072 {
00073     friend class KCursor; // to shut up the compiler
00074     Q_OBJECT
00075 
00076 public:
00077     static KCursorPrivate *self();
00078 
00079     void setAutoHideCursor( QWidget *w, bool enable, bool customEventFilter );
00080     virtual bool eventFilter( QObject *o, QEvent *e );
00081 
00082     int hideCursorDelay;
00083 
00084 private slots:
00085     void slotWidgetDestroyed( QObject* );
00086 
00087 private:
00088     KCursorPrivate();
00089     ~KCursorPrivate();
00090 
00091     bool enabled;
00092     static KCursorPrivate *s_self;
00093 
00094     QPtrDict<KCursorPrivateAutoHideEventFilter> m_eventFilters;
00095 };
00096 
00097 
00098 
00099 #endif // KCURSOR_PRIVATE_H
KDE Home | KDE Accessibility Home | Description of Access Keys