tdefileivi.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 __tdefileivi_h__ 00021 #define __tdefileivi_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 class KIVFreeSpaceOverlay; 00031 00039 class LIBKONQ_EXPORT KFileIVI : public TDEIconViewItem 00040 { 00041 public: 00048 KFileIVI( KonqIconViewWidget *iconview, KFileItem* fileitem, int size ); 00049 virtual ~KFileIVI(); 00050 00055 virtual void returnPressed(); 00056 00060 KFileItem * item() const { return m_fileitem; } 00061 00066 virtual bool acceptDrop( const TQMimeSource *mime ) const; 00067 00075 virtual void setIcon( int size, 00076 int state=TDEIcon::DefaultState, 00077 bool recalc=false, 00078 bool redraw=false); 00079 00087 void setPixmapDirect( const TQPixmap & pixmap, 00088 bool recalc=false, 00089 bool redraw=false); 00090 00099 void invalidateThumb( int state, bool redraw = false ); 00100 00105 void invalidateThumbnail(); 00106 bool isThumbnailInvalid() const; 00107 00108 bool hasValidThumbnail() const { return isThumbnail() && !isThumbnailInvalid(); } 00109 00114 int state() const { return m_state; } 00115 00119 int iconSize() const { return m_size; } 00120 00124 void setDisabled( bool disabled ); 00125 00129 void setThumbnailPixmap( const TQPixmap & pixmap ); 00130 00135 void setEffect( /*int group,*/ int state ); 00136 00140 bool isThumbnail() const { return m_bThumbnail; } 00141 00147 void setOverlay( const TQString & iconName); 00148 00154 void setOverlayProgressBar( const int progress); 00155 00160 virtual void refreshIcon( bool redraw ); 00161 00162 virtual void setKey( const TQString &key ); 00163 00168 virtual void paintItem( TQPainter *p, const TQColorGroup &cg ); 00169 00170 virtual bool move( int x, int y ); 00171 00177 void setMouseOverAnimation( const TQString& movieFileName ); 00178 TQString mouseOverAnimation() const; 00179 00186 bool hasAnimation() const; 00187 00189 bool isAnimated() const; 00190 void setAnimated( bool ); 00191 00193 void setActive( bool active ); 00194 00199 KIVDirectoryOverlay* setShowDirectoryOverlay( bool ); 00200 bool showDirectoryOverlay( ); 00201 00206 KIVFreeSpaceOverlay* setShowFreeSpaceOverlay( bool ); 00207 bool showFreeSpaceOverlay( ); 00208 00209 virtual int compare( TQIconViewItem *i ) const; 00210 00211 void mimeTypeAndIconDetermined(); 00212 00213 protected: 00214 virtual void dropped( TQDropEvent *e, const TQValueList<TQIconDragItem> & ); 00215 00219 void paintOverlay( TQPainter *p ) const; 00220 00224 void paintOverlayProgressBar( TQPainter *p ) const; 00225 00229 TQColorGroup updateColors(const TQColorGroup &c) const; 00230 00234 void paintFontUpdate( TQPainter *p ) const; 00235 00236 private: 00239 virtual void setPixmap ( const TQPixmap & icon ) { TDEIconViewItem::setPixmap( icon ); } 00240 virtual void setPixmap ( const TQPixmap & icon, bool recalc, bool redraw = TRUE ) 00241 { TDEIconViewItem::setPixmap( icon, recalc, redraw ); } 00242 00244 void updatePixmapSize(); 00245 00246 int m_size, m_state; 00247 bool m_bDisabled; 00248 bool m_bThumbnail; 00250 KFileItem* m_fileitem; 00251 00256 struct Private; 00257 00258 Private *d; 00259 }; 00260 00261 #endif