konq_filetip.h

00001 /* This file is part of the KDE projects
00002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00003    Copyright (C) 2000, 2001, 2002 David Faure <david@mandrakesoft.com>
00004    Copyright (C) 2004 Martin Koller <m.koller@surfeu.at>
00005 
00006    This program is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; see the file COPYING.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019    Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KONQ_FILETIP_H
00023 #define KONQ_FILETIP_H
00024 
00025 #include <qframe.h>
00026 #include <qpixmap.h>
00027 #include <kio/previewjob.h>
00028 
00029 #include <libkonq_export.h>
00030 
00031 class KFileItem;
00032 class QLabel;
00033 class QScrollView;
00034 class QTimer;
00035 
00036 //--------------------------------------------------------------------------------
00037 
00038 class LIBKONQ_EXPORT KonqFileTip : public QFrame
00039 {
00040   Q_OBJECT
00041 
00042   public:
00043     KonqFileTip( QScrollView *parent );
00044     ~KonqFileTip();
00045 
00046     void setPreview(bool on);
00047 
00053     void setOptions( bool on, bool preview, int num );
00054 
00060     void setItem( KFileItem *item, const QRect &rect = QRect(),
00061                   const QPixmap *pixmap = 0 );
00062 
00063     virtual bool eventFilter( QObject *, QEvent *e );
00064 
00065   protected:
00066     virtual void drawContents( QPainter *p );
00067     virtual void resizeEvent( QResizeEvent * );
00068 
00069   private slots:
00070     void gotPreview( const KFileItem*, const QPixmap& );
00071     void gotPreviewResult();
00072 
00073     void startDelayed();
00074     void showTip();
00075     void hideTip();
00076 
00077   private:
00078     void setFilter( bool enable );
00079 
00080     void reposition();
00081 
00082     QLabel*    m_iconLabel;
00083     QLabel*    m_textLabel;
00084     bool       m_on : 1;
00085     bool       m_preview : 1;  // shall the preview icon be shown
00086     bool       m_filter : 1;
00087     QPixmap    m_corners[4];
00088     int        m_corner;
00089     int        m_num;
00090     QScrollView* m_view;
00091     KFileItem* m_item;
00092     KIO::PreviewJob* m_previewJob;
00093     QRect      m_rect;
00094     QTimer*    m_timer;
00095 };
00096 
00097 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys