kfileiconview.h Source File (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kfileiconview.h

    00001 // -*- c++ -*-
    00002 /* This file is part of the KDE libraries
    00003     Copyright (C) 1997 Stephan Kulow <coolo@kde.org>
    00004
    00005     This library is free software; you can redistribute it and/or
    00006     modify it under the terms of the GNU Library General Public
    00007     License as published by the Free Software Foundation; either
    00008     version 2 of the License, or (at your option) any later version.
    00009
    00010     This library is distributed in the hope that it will be useful,
    00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013     Library General Public License for more details.
    00014
    00015     You should have received a copy of the GNU Library General Public License
    00016     along with this library; see the file COPYING.LIB.  If not, write to
    00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018     Boston, MA 02111-1307, USA.
    00019 */
    00020
    00021 #ifndef KFILEICONVIEW_H
    00022 #define KFILEICONVIEW_H
    00023
    00024 class KFileItem;
    00025 class QWidget;
    00026 class QLabel;
    00027
    00028 #include <kiconview.h>
    00029 #include <kiconloader.h>
    00030 #include <kfileview.h>
    00031 #include <kmimetyperesolver.h>
    00032
    00033 #include <kfile.h>
    00034
    00039 class KFileIconViewItem : public KIconViewItem
    00040 {
    00041 public:
    00042     KFileIconViewItem( QIconView *parent, const QString &text,
    00043                        const QPixmap &pixmap,
    00044                        KFileItem *fi )
    00045         : KIconViewItem( parent, text, pixmap ), inf( fi ) {}
    00049     KFileIconViewItem( QIconView *parent, KFileItem *fi )
    00050         : KIconViewItem( parent ), inf( fi ) {}
    00051
    00052     virtual ~KFileIconViewItem();
    00053
    00057     KFileItem *fileInfo() const {
    00058         return inf;
    00059     }
    00060
    00061 private:
    00062     KFileItem *inf;
    00063
    00064 private:
    00065     class KFileIconViewItemPrivate;
    00066     KFileIconViewItemPrivate *d;
    00067
    00068 };
    00069
    00070 namespace KIO {
    00071     class Job;
    00072 }
    00073
    00082 class KFileIconView : public KIconView, public KFileView
    00083 {
    00084     Q_OBJECT
    00085
    00086 public:
    00087     KFileIconView(QWidget *parent, const char *name);
    00088     virtual ~KFileIconView();
    00089
    00090     virtual QWidget *widget() { return this; }
    00091     virtual void clearView();
    00092     virtual void setAutoUpdate( bool ) {}
    00093
    00094     virtual void updateView( bool );
    00095     virtual void updateView(const KFileItem*);
    00096     virtual void removeItem(const KFileItem*);
    00097
    00098     virtual void listingCompleted();
    00099
    00100     virtual void insertItem( KFileItem *i );
    00101     virtual void setSelectionMode( KFile::SelectionMode sm );
    00102
    00103     virtual void setSelected(const KFileItem *, bool);
    00104     virtual bool isSelected(const KFileItem *i) const;
    00105     virtual void clearSelection();
    00106     virtual void selectAll();
    00107     virtual void invertSelection();
    00108
    00109     virtual void setCurrentItem( const KFileItem * );
    00110     virtual KFileItem * currentFileItem() const;
    00111     virtual KFileItem * firstFileItem() const;
    00112     virtual KFileItem * nextItem( const KFileItem * ) const;
    00113     virtual KFileItem * prevItem( const KFileItem * ) const;
    00114
    00118     void setIconSize( int size );
    00119
    00123     void setPreviewSize( int size );
    00124
    00128     int iconSize() const { return myIconSize; }
    00129
    00130     void ensureItemVisible( const KFileItem * );
    00131
    00132     virtual void setSorting(QDir::SortSpec sort);
    00133
    00134     virtual void readConfig( KConfig *, const QString& group = QString::null );
    00135     virtual void writeConfig( KConfig *, const QString& group = QString::null);
    00136
    00137     // for KMimeTypeResolver
    00138     void mimeTypeDeterminationFinished();
    00139     void determineIcon( KFileIconViewItem *item );
    00140     QScrollView *scrollWidget() const { return (QScrollView*) this; }
    00141
    00142 public slots:
    00147     void showPreviews();
    00148
    00153     virtual void arrangeItemsInGrid( bool updated = true );
    00154
    00155 protected:
    00159     virtual void keyPressEvent( QKeyEvent * );
    00160
    00164     virtual void hideEvent( QHideEvent * );
    00165
    00166     // ### workaround for Qt3 bug (see #35080)
    00167     virtual void showEvent( QShowEvent * );
    00168
    00169     virtual bool eventFilter( QObject *o, QEvent *e );
    00170
    00171 private slots:
    00172     void selected( QIconViewItem *item );
    00173     void slotActivate( QIconViewItem * );
    00174     void highlighted( QIconViewItem *item );
    00175     void showToolTip( QIconViewItem *item );
    00176     void removeToolTip();
    00177     void slotActivateMenu( QIconViewItem *, const QPoint& );
    00178     void slotSelectionChanged();
    00179
    00180     void slotSmallColumns();
    00181     void slotLargeRows();
    00182     void slotPreviewsToggled( bool );
    00183
    00184     void slotPreviewResult( KIO::Job * );
    00185     void gotPreview( const KFileItem *item, const QPixmap& pix );
    00186
    00187 private:
    00188     KMimeTypeResolver<KFileIconViewItem,KFileIconView> *m_resolver;
    00189
    00190     QLabel *toolTip;
    00191     int th;
    00192     int myIconSize;
    00193
    00194     virtual void insertItem(QIconViewItem *a, QIconViewItem *b) { KIconView::insertItem(a, b); }
    00195     virtual void setSelectionMode(QIconView::SelectionMode m) { KIconView::setSelectionMode(m); }
    00196     virtual void setSelected(QIconViewItem *i, bool a, bool b) { KIconView::setSelected(i, a, b); }
    00197
    00198     bool canPreview( const KFileItem * ) const;
    00199     int iconSizeFor( const KFileItem * ) const;
    00200     void stopPreview();
    00201
    00202     void updateIcons();
    00203
    00204     inline KFileIconViewItem * viewItem( const KFileItem *item ) const {
    00205         if ( item )
    00206             return (KFileIconViewItem *) item->extraData( this );
    00207         return 0L;
    00208     }
    00209
    00210     void initItem(KFileIconViewItem *item, const KFileItem *i,
    00211                   bool updateTextAndPixmap );
    00212
    00213 protected:
    00214     virtual void virtual_hook( int id, void* data );
    00215 private:
    00216     class KFileIconViewPrivate;
    00217     KFileIconViewPrivate *d;
    00218 };
    00219
    00220 #endif // KFILESIMPLEVIEW_H

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:13:29 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001