kio Library: kfileiconview.h Source File (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | 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 #include <kfile.h>
    00033
    00038 class KIO_EXPORT KFileIconViewItem : public KIconViewItem
    00039 {
    00040 public:
    00041     KFileIconViewItem( QIconView *parent, const QString &text,
    00042                const QPixmap &pixmap,
    00043                KFileItem *fi )
    00044     : KIconViewItem( parent, text, pixmap ), inf( fi ) {}
    00048     KFileIconViewItem( QIconView *parent, KFileItem *fi )
    00049     : KIconViewItem( parent ), inf( fi ) {}
    00050
    00051     virtual ~KFileIconViewItem();
    00052
    00056     KFileItem *fileInfo() const {
    00057     return inf;
    00058     }
    00059
    00060 private:
    00061     KFileItem *inf;
    00062
    00063 private:
    00064     class KFileIconViewItemPrivate;
    00065     KFileIconViewItemPrivate *d;
    00066
    00067 };
    00068
    00069 namespace KIO {
    00070     class Job;
    00071 }
    00072
    00081 class KIO_EXPORT KFileIconView : public KIconView, public KFileView
    00082 {
    00083     Q_OBJECT
    00084
    00085 public:
    00086     KFileIconView(QWidget *parent, const char *name);
    00087     virtual ~KFileIconView();
    00088
    00089     virtual QWidget *widget() { return this; }
    00090     virtual void clearView();
    00091     virtual void setAutoUpdate( bool ) {} // ### unused. remove in KDE4
    00092
    00093     virtual void updateView( bool );
    00094     virtual void updateView(const KFileItem*);
    00095     virtual void removeItem(const KFileItem*);
    00096
    00097     virtual void listingCompleted();
    00098
    00099     virtual void insertItem( KFileItem *i );
    00100     virtual void setSelectionMode( KFile::SelectionMode sm );
    00101
    00102     virtual void setSelected(const KFileItem *, bool);
    00103     virtual bool isSelected(const KFileItem *i) const;
    00104     virtual void clearSelection();
    00105     virtual void selectAll();
    00106     virtual void invertSelection();
    00107
    00108     virtual void setCurrentItem( const KFileItem * );
    00109     virtual KFileItem * currentFileItem() const;
    00110     virtual KFileItem * firstFileItem() const;
    00111     virtual KFileItem * nextItem( const KFileItem * ) const;
    00112     virtual KFileItem * prevItem( const KFileItem * ) const;
    00113
    00117     void setIconSize( int size );
    00118
    00122     void setPreviewSize( int size );
    00123
    00131     void setIgnoreMaximumSize(bool ignoreSize=true);
    00132
    00136     int iconSize() const { return myIconSize; }
    00137
    00138     void ensureItemVisible( const KFileItem * );
    00139
    00140     virtual void setSorting(QDir::SortSpec sort);
    00141
    00142     virtual void readConfig( KConfig *, const QString& group = QString::null );
    00143     virtual void writeConfig( KConfig *, const QString& group = QString::null);
    00144
    00145     // for KMimeTypeResolver
    00146     void mimeTypeDeterminationFinished();
    00147     void determineIcon( KFileIconViewItem *item );
    00148     QScrollView *scrollWidget() const { return (QScrollView*) this; }
    00149     void setAcceptDrops(bool b)
    00150     {
    00151       KIconView::setAcceptDrops(b);
    00152       viewport()->setAcceptDrops(b);
    00153     }
    00154
    00155 public slots:
    00162     void showPreviews();
    00163
    00164     void zoomIn();
    00165
    00166     void zoomOut();
    00167
    00172     virtual void arrangeItemsInGrid( bool updated = true );
    00173
    00174 protected:
    00178     virtual void keyPressEvent( QKeyEvent * );
    00179
    00183     virtual void hideEvent( QHideEvent * );
    00184
    00185     // ### workaround for Qt3 bug (see #35080)
    00186     virtual void showEvent( QShowEvent * );
    00187
    00188     virtual bool eventFilter( QObject *o, QEvent *e );
    00189
    00190     // DND support
    00191     virtual QDragObject *dragObject();
    00192     virtual void contentsDragEnterEvent( QDragEnterEvent *e );
    00193     virtual void contentsDragMoveEvent( QDragMoveEvent *e );
    00194     virtual void contentsDragLeaveEvent( QDragLeaveEvent *e );
    00195     virtual void contentsDropEvent( QDropEvent *ev );
    00196
    00197     // KDE4: Make virtual
    00198     bool acceptDrag(QDropEvent* e ) const;
    00199
    00200 private slots:
    00201     void selected( QIconViewItem *item );
    00202     void slotActivate( QIconViewItem * );
    00203     void highlighted( QIconViewItem *item );
    00204     void showToolTip( QIconViewItem *item );
    00205     void removeToolTip();
    00206     void slotActivateMenu( QIconViewItem *, const QPoint& );
    00207     void slotSelectionChanged();
    00208
    00209     void slotSmallColumns();
    00210     void slotLargeRows();
    00211     void slotPreviewsToggled( bool );
    00212
    00213     void slotPreviewResult( KIO::Job * );
    00214     void gotPreview( const KFileItem *item, const QPixmap& pix );
    00215     void slotAutoOpen();
    00216
    00217 signals:
    00224     void dropped(QDropEvent *event, KFileItem *fileItem);
    00231     void dropped(QDropEvent *event, const KURL::List &urls, const KURL &url);
    00232
    00233 private:
    00234     KMimeTypeResolver<KFileIconViewItem,KFileIconView> *m_resolver;
    00235
    00236     QLabel *toolTip;
    00237     int th;
    00238     int myIconSize;
    00239
    00240     virtual void insertItem(QIconViewItem *a, QIconViewItem *b) { KIconView::insertItem(a, b); }
    00241     virtual void setSelectionMode(QIconView::SelectionMode m) { KIconView::setSelectionMode(m); }
    00242     virtual void setSelected(QIconViewItem *i, bool a, bool b) { KIconView::setSelected(i, a, b); }
    00243
    00244     bool canPreview( const KFileItem * ) const;
    00245     void stopPreview();
    00246
    00247     void updateIcons();
    00248
    00249     inline KFileIconViewItem * viewItem( const KFileItem *item ) const {
    00250         if ( item )
    00251             return (KFileIconViewItem *) item->extraData( this );
    00252         return 0L;
    00253     }
    00254
    00255     void initItem(KFileIconViewItem *item, const KFileItem *i,
    00256                   bool updateTextAndPixmap );
    00257
    00258 protected:
    00259     virtual void virtual_hook( int id, void* data );
    00260 private:
    00261     class KFileIconViewPrivate;
    00262     KFileIconViewPrivate *d;
    00263 };
    00264
    00265 #endif // KFILESIMPLEVIEW_H

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:23:57 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003