kfileivi.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1999, 2000, 2001, 2002 David Faure <faure@kde.org>
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 as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef __kfileivi_h__
00021 #define __kfileivi_h__
00022 
00023 #include <kiconview.h>
00024 #include <kiconloader.h>
00025 #include <libkonq_export.h>
00026 
00027 class KFileItem;
00028 class KonqIconViewWidget;
00029 class KIVDirectoryOverlay;
00030 
00038 class LIBKONQ_EXPORT KFileIVI : public KIconViewItem
00039 {
00040 public:
00047     KFileIVI( KonqIconViewWidget *iconview, KFileItem* fileitem, int size );
00048     virtual ~KFileIVI();
00049 
00054     virtual void returnPressed();
00055 
00059     KFileItem * item() const { return m_fileitem; }
00060 
00065     virtual bool acceptDrop( const QMimeSource *mime ) const;
00066 
00074     virtual void setIcon( int size,
00075                           int state=KIcon::DefaultState,
00076                           bool recalc=false,
00077                           bool redraw=false);
00078 
00086     void setPixmapDirect( const QPixmap & pixmap,
00087                           bool recalc=false,
00088                           bool redraw=false);
00089 
00098     void invalidateThumb( int state, bool redraw = false );
00099 
00104     void invalidateThumbnail();
00105     bool isThumbnailInvalid() const;
00106 
00107     bool hasValidThumbnail() const { return isThumbnail() && !isThumbnailInvalid(); }
00108 
00113     int state() const { return m_state; }
00114 
00118     int iconSize() const { return m_size; }
00119 
00123     void setDisabled( bool disabled );
00124 
00128     void setThumbnailPixmap( const QPixmap & pixmap );
00129 
00134     void setEffect( /*int group,*/ int state );
00135 
00139     bool isThumbnail() const { return m_bThumbnail; }
00140 
00146     void setOverlay( const QString & iconName);
00147 
00152     virtual void refreshIcon( bool redraw );
00153 
00154     virtual void setKey( const QString &key );
00155 
00160     virtual void paintItem( QPainter *p, const QColorGroup &cg );
00161 
00162     virtual bool move( int x, int y );
00163 
00169     void setMouseOverAnimation( const QString& movieFileName );
00170     QString mouseOverAnimation() const;
00171 
00178     bool hasAnimation() const;
00179 
00181     bool isAnimated() const;
00182     void setAnimated( bool );
00183 
00185     void setActive( bool active );
00186 
00191     KIVDirectoryOverlay* setShowDirectoryOverlay( bool );
00192     bool showDirectoryOverlay( );
00193 
00194     virtual int compare( QIconViewItem *i ) const;
00195 
00196 protected:
00197     virtual void dropped( QDropEvent *e, const QValueList<QIconDragItem> &  );
00198 
00202     void paintOverlay( QPainter *p ) const;
00203 
00207     QColorGroup updateColors(const QColorGroup &c) const;
00208 
00212     void paintFontUpdate( QPainter *p ) const;
00213 
00214 private:
00217     virtual void setPixmap ( const QPixmap & icon ) { KIconViewItem::setPixmap( icon ); }
00218     virtual void setPixmap ( const QPixmap & icon, bool recalc, bool redraw = TRUE )
00219         { KIconViewItem::setPixmap( icon, recalc, redraw ); }
00220 
00222     void updatePixmapSize();
00223     
00224     int m_size, m_state;
00225     bool m_bDisabled;
00226     bool m_bThumbnail;
00228     KFileItem* m_fileitem;
00229 
00234     struct Private;
00235 
00236     Private *d;
00237 };
00238 
00239 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys