kscrollview.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2005 Allan Sandfeld Jensen <kde@carewolf.com> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 #ifndef KSCROLLVIEW_H 00019 #define KSCROLLVIEW_H 00020 00021 #include <qscrollview.h> 00022 00023 #include <kdelibs_export.h> 00024 00030 class KDEUI_EXPORT KScrollView : public QScrollView 00031 { 00032 Q_OBJECT 00033 00034 public: 00035 KScrollView( QWidget *parent = 0, const char *name = 0, Qt::WFlags f = 0 ); 00036 00037 ~KScrollView(); 00038 00039 public slots: 00040 void scrollBy(int dx, int dy); 00041 // virtual void setContentsPos(int x, int y); 00042 00043 protected: 00044 virtual void wheelEvent( QWheelEvent *e ); 00045 00046 void startScrolling(); 00047 void stopScrolling(); 00048 00049 protected slots: 00050 void scrollTick(); 00051 00052 private: 00053 // All scrolls must be completed within 240ms of last keypress 00054 static const int SCROLL_TIME = 240; 00055 // Each step is 20 ms == 50 frames/second 00056 static const int SCROLL_TICK = 20; 00057 00058 struct KScrollViewPrivate; 00059 KScrollViewPrivate *d; 00060 }; 00061 00062 #endif