# kdeui Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kiconview.h

    00001 /* This file is part of the KDE libraries
    00002    Copyright (C) 1999 Torben Weis <weis@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 version 2 as published by the Free Software Foundation.
    00007
    00008    This library is distributed in the hope that it will be useful,
    00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00011    Library General Public License for more details.
    00012
    00013    You should have received a copy of the GNU Library General Public License
    00014    along with this library; see the file COPYING.LIB.  If not, write to
    00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00016    Boston, MA 02111-1307, USA.
    00017 */
    00018 #ifndef KICONVIEW_H
    00019 #define KICONVIEW_H
    00020
    00021 #include <qcursor.h>
    00022 #include <qiconview.h>
    00023
    00024 #include <kdelibs_export.h>
    00025
    00042 class KDEUI_EXPORT KIconView : public QIconView
    00043 {
    00044   friend class KIconViewItem;
    00045   Q_OBJECT
    00046   Q_ENUMS( Mode )
    00047   Q_PROPERTY( Mode mode READ mode WRITE setMode )
    00048
    00049 public:
    00050   KIconView( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
    00051
    00052   ~KIconView();
    00053
    00062   enum Mode { Execute, Select };
    00063
    00073   void setMode( Mode m );
    00074
    00078   Mode mode() const;
    00079
    00083   virtual void setFont( const QFont & );
    00084
    00092   void setIconTextHeight( int n );
    00093
    00098   int iconTextHeight() const;
    00099
    00103   virtual void takeItem( QIconViewItem * item );
    00104
    00105 signals:
    00106
    00116   void executed( QIconViewItem *item );
    00117
    00128   void executed( QIconViewItem *item, const QPoint &pos );
    00129
    00138   void held( QIconViewItem *item );
    00139
    00153   void doubleClicked( QIconViewItem *item, const QPoint &pos );
    00154
    00155 protected slots:
    00156   void slotOnItem( QIconViewItem *item );
    00157   void slotOnViewport();
    00158   void slotSettingsChanged(int);
    00159
    00163   void slotAutoSelect();
    00164
    00165 protected:
    00166   void emitExecute( QIconViewItem *item, const QPoint &pos );
    00167
    00168   virtual void focusOutEvent( QFocusEvent *fe );
    00169   virtual void leaveEvent( QEvent *e );
    00170   virtual void contentsMousePressEvent( QMouseEvent *e );
    00171   virtual void contentsMouseDoubleClickEvent ( QMouseEvent * e );
    00172   virtual void contentsMouseReleaseEvent( QMouseEvent *e );
    00173   virtual void contentsDragEnterEvent( QDragEnterEvent *e );
    00174   virtual void contentsDragMoveEvent( QDragMoveEvent *e );
    00175   virtual void contentsDropEvent( QDropEvent* e );
    00176   virtual void wheelEvent( QWheelEvent *e );
    00177
    00184   void cancelPendingHeldSignal();
    00185
    00186 private slots:
    00187   void slotMouseButtonClicked( int btn, QIconViewItem *item, const QPoint &pos );
    00188   void slotDragHoldTimeout();
    00189
    00190 private:
    00194   QFontMetrics *itemFontMetrics() const;
    00198   QPixmap selectedIconPixmap( QPixmap *pix, const QColor &col ) const;
    00199
    00200   bool m_bUseSingle;
    00201   bool m_bChangeCursorOverItem;
    00202
    00203   QIconViewItem* m_pCurrentItem;
    00204
    00205   QTimer* m_pAutoSelect;
    00206   int m_autoSelectDelay;
    00207
    00208 protected:
    00209   virtual void virtual_hook( int id, void* data );
    00210 private:
    00211   class KIconViewPrivate;
    00212   KIconViewPrivate *d;
    00213 };
    00214
    00215 class KWordWrap;
    00224 class KDEUI_EXPORT KIconViewItem : public QIconViewItem
    00225 {
    00226 public:
    00227     // Need to redefine all the constructors - I want Java !
    00228     KIconViewItem( QIconView *parent )
    00229         : QIconViewItem( parent ) { init(); } // We need to call it because the parent ctor won't call our reimplementation :(((
    00230     KIconViewItem( QIconView *parent, QIconViewItem *after )
    00231         : QIconViewItem( parent, after ) { init(); }
    00232     KIconViewItem( QIconView *parent, const QString &text )
    00233         : QIconViewItem( parent, text ) { init(); }
    00234     KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text )
    00235         : QIconViewItem( parent, after, text ) { init(); }
    00236     KIconViewItem( QIconView *parent, const QString &text, const QPixmap &icon )
    00237         : QIconViewItem( parent, text, icon ) { init(); }
    00238     KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPixmap &icon )
    00239         : QIconViewItem( parent, after, text, icon ) { init(); }
    00240     KIconViewItem( QIconView *parent, const QString &text, const QPicture &picture )
    00241         : QIconViewItem( parent, text, picture ) { init(); }
    00242     KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPicture &picture )
    00243         : QIconViewItem( parent, after, text, picture ) { init(); }
    00244     virtual ~KIconViewItem();
    00245
    00257     void setPixmapSize( const QSize& size );
    00258
    00263     QSize pixmapSize() const;
    00264
    00265 protected:
    00266     void init();
    00267     virtual void calcRect( const QString& text_ = QString::null );
    00268     virtual void paintItem( QPainter *p, const QColorGroup &c );
    00269     KWordWrap *wordWrap();
    00270     void paintPixmap( QPainter *p, const QColorGroup &c );
    00271     void paintText( QPainter *p, const QColorGroup &c );
    00272
    00273 private:
    00274     KWordWrap* m_wordWrap;
    00275     struct KIconViewItemPrivate;
    00276     KIconViewItemPrivate *d;
    00277 };
    00278
    00279 #endif

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