add more spacing
[personal-kdebase.git] / apps / lib / konq / konq_filetip.h
blob532869c7a3e501ba747b130d2c1526cfb2e09d6f
1 /* This file is part of the KDE projects
2 Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 Copyright (C) 2000, 2001, 2002 David Faure <faure@kde.org>
4 Copyright (C) 2004 Martin Koller <m.koller@surfeu.at>
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
22 #ifndef KONQ_FILETIP_H
23 #define KONQ_FILETIP_H
25 #include <QtGui/QPixmap>
26 #include <QtGui/QLabel>
27 #include <QtGui/QResizeEvent>
28 #include <kio/previewjob.h>
30 #include <libkonq_export.h>
32 class KFileItem;
33 class QLabel;
34 class QScrollArea;
35 class QTimer;
37 //--------------------------------------------------------------------------------
39 class LIBKONQ_EXPORT KonqFileTip : public QFrame
41 Q_OBJECT
43 public:
44 KonqFileTip( QScrollArea *parent );
45 ~KonqFileTip();
47 void setPreview(bool on);
49 /**
50 @param on show tooltip at all
51 @param preview include file preview in tooltip
52 @param num the number of tooltip texts to get from KFileItem
54 void setOptions( bool on, bool preview, int num );
56 /** Set the item from which to get the tip information
57 @param item the item from which to get the tip information
58 @param rect the rectangle around which the tip will be shown
59 @param pixmap the pixmap to be shown. If 0, no pixmap is shown
61 void setItem( const KFileItem &item, const QRect &rect = QRect(),
62 const QPixmap *pixmap = 0 );
64 virtual bool eventFilter( QObject *, QEvent *e );
66 protected:
67 virtual void paintEvent( QPaintEvent *ev );
68 virtual void resizeEvent( QResizeEvent * );
70 private Q_SLOTS:
71 void gotPreview( const KFileItem&, const QPixmap& );
72 void gotPreviewResult();
74 void startDelayed();
75 void showTip();
76 void hideTip();
78 private:
79 void setFilter( bool enable );
81 void reposition();
83 QLabel* m_iconLabel;
84 QLabel* m_textLabel;
85 bool m_on : 1;
86 bool m_preview : 1; // shall the preview icon be shown
87 bool m_filter : 1;
88 QPixmap m_corners[4];
89 int m_corner;
90 int m_num;
91 QScrollArea* m_view;
92 KFileItem m_item;
93 KIO::PreviewJob* m_previewJob;
94 QRect m_rect;
95 QTimer* m_timer;
98 #endif