# kdeui Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | 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
    00039 class KIconView : public QIconView
    00040 {
    00041   friend class KIconViewItem;
    00042   Q_OBJECT
    00043   Q_ENUMS( Mode )
    00044   Q_PROPERTY( Mode mode READ mode WRITE setMode )
    00045
    00046 public:
    00047   KIconView( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
    00048
    00049   ~KIconView();
    00050
    00059   enum Mode { Execute, Select };
    00060
    00070   void setMode( Mode m );
    00071
    00075   Mode mode() const;
    00076
    00080   virtual void setFont( const QFont & );
    00081
    00082 signals:
    00083
    00093   void executed( QIconViewItem *item );
    00094
    00105   void executed( QIconViewItem *item, const QPoint &pos );
    00106
    00120   void doubleClicked( QIconViewItem *item, const QPoint &pos );
    00121
    00122 protected slots:
    00123   void slotOnItem( QIconViewItem *item );
    00124   void slotOnViewport();
    00125   void slotSettingsChanged(int);
    00126
    00130   void slotAutoSelect();
    00131
    00132 protected:
    00133   void emitExecute( QIconViewItem *item, const QPoint &pos );
    00134
    00135   virtual void focusOutEvent( QFocusEvent *fe );
    00136   virtual void leaveEvent( QEvent *e );
    00137   virtual void contentsMousePressEvent( QMouseEvent *e );
    00138   virtual void contentsMouseDoubleClickEvent ( QMouseEvent * e );
    00139   virtual void contentsMouseReleaseEvent( QMouseEvent *e );
    00140
    00141 private slots:
    00142   void slotMouseButtonClicked( int btn, QIconViewItem *item, const QPoint &pos );
    00143
    00144 private:
    00148   QFontMetrics *itemFontMetrics() const;
    00152   QPixmap selectedIconPixmap( QPixmap *pix, const QColor &col ) const;
    00153
    00154   bool m_bUseSingle;
    00155   bool m_bChangeCursorOverItem;
    00156
    00157   QIconViewItem* m_pCurrentItem;
    00158
    00159   QTimer* m_pAutoSelect;
    00160   int m_autoSelectDelay;
    00161
    00162 protected:
    00163   virtual void virtual_hook( int id, void* data );
    00164 private:
    00165   class KIconViewPrivate;
    00166   KIconViewPrivate *d;
    00167 };
    00168
    00169 class KWordWrap;
    00177 class KIconViewItem : public QIconViewItem
    00178 {
    00179 public:
    00180     // Need to redefine all the constructors - I want Java !
    00181     KIconViewItem( QIconView *parent )
    00182         : QIconViewItem( parent ) { init(); } // We need to call it because the parent ctor won't call our reimplementation :(((
    00183     KIconViewItem( QIconView *parent, QIconViewItem *after )
    00184         : QIconViewItem( parent, after ) { init(); }
    00185     KIconViewItem( QIconView *parent, const QString &text )
    00186         : QIconViewItem( parent, text ) { init(); }
    00187     KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text )
    00188         : QIconViewItem( parent, after, text ) { init(); }
    00189     KIconViewItem( QIconView *parent, const QString &text, const QPixmap &icon )
    00190         : QIconViewItem( parent, text, icon ) { init(); }
    00191     KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPixmap &icon )
    00192         : QIconViewItem( parent, after, text, icon ) { init(); }
    00193     KIconViewItem( QIconView *parent, const QString &text, const QPicture &picture )
    00194         : QIconViewItem( parent, text, picture ) { init(); }
    00195     KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPicture &picture )
    00196         : QIconViewItem( parent, after, text, picture ) { init(); }
    00197     virtual ~KIconViewItem();
    00198
    00199 protected:
    00200     void init();
    00201     virtual void calcRect( const QString& text_ = QString::null );
    00202     virtual void paintItem( QPainter *p, const QColorGroup &c );
    00203 private:
    00204     KWordWrap* m_wordWrap;
    00205     class KIconViewItemPrivate;
    00206     KIconViewItemPrivate *d;
    00207 };
    00208
    00209 #endif

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 12:56:54 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001