kdeui Library API Documentation

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 00089 void setIconTextHeight( int n ); 00090 00095 int iconTextHeight() const; 00096 00097 signals: 00098 00108 void executed( QIconViewItem *item ); 00109 00120 void executed( QIconViewItem *item, const QPoint &pos ); 00121 00130 void held( QIconViewItem *item ); 00131 00145 void doubleClicked( QIconViewItem *item, const QPoint &pos ); 00146 00147 protected slots: 00148 void slotOnItem( QIconViewItem *item ); 00149 void slotOnViewport(); 00150 void slotSettingsChanged(int); 00151 00155 void slotAutoSelect(); 00156 00157 protected: 00158 void emitExecute( QIconViewItem *item, const QPoint &pos ); 00159 00160 virtual void focusOutEvent( QFocusEvent *fe ); 00161 virtual void leaveEvent( QEvent *e ); 00162 virtual void contentsMousePressEvent( QMouseEvent *e ); 00163 virtual void contentsMouseDoubleClickEvent ( QMouseEvent * e ); 00164 virtual void contentsMouseReleaseEvent( QMouseEvent *e ); 00165 virtual void contentsDragEnterEvent( QDragEnterEvent *e ); 00166 virtual void contentsDragMoveEvent( QDragMoveEvent *e ); 00167 virtual void contentsDropEvent( QDropEvent* e ); 00168 virtual void wheelEvent( QWheelEvent *e ); 00169 00170 private slots: 00171 void slotMouseButtonClicked( int btn, QIconViewItem *item, const QPoint &pos ); 00172 void slotDragHoldTimeout(); 00173 00174 private: 00178 QFontMetrics *itemFontMetrics() const; 00182 QPixmap selectedIconPixmap( QPixmap *pix, const QColor &col ) const; 00183 00184 bool m_bUseSingle; 00185 bool m_bChangeCursorOverItem; 00186 00187 QIconViewItem* m_pCurrentItem; 00188 00189 QTimer* m_pAutoSelect; 00190 int m_autoSelectDelay; 00191 00192 protected: 00193 virtual void virtual_hook( int id, void* data ); 00194 private: 00195 class KIconViewPrivate; 00196 KIconViewPrivate *d; 00197 }; 00198 00199 class KWordWrap; 00207 class KIconViewItem : public QIconViewItem 00208 { 00209 public: 00210 // Need to redefine all the constructors - I want Java ! 00211 KIconViewItem( QIconView *parent ) 00212 : QIconViewItem( parent ) { init(); } // We need to call it because the parent ctor won't call our reimplementation :((( 00213 KIconViewItem( QIconView *parent, QIconViewItem *after ) 00214 : QIconViewItem( parent, after ) { init(); } 00215 KIconViewItem( QIconView *parent, const QString &text ) 00216 : QIconViewItem( parent, text ) { init(); } 00217 KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text ) 00218 : QIconViewItem( parent, after, text ) { init(); } 00219 KIconViewItem( QIconView *parent, const QString &text, const QPixmap &icon ) 00220 : QIconViewItem( parent, text, icon ) { init(); } 00221 KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPixmap &icon ) 00222 : QIconViewItem( parent, after, text, icon ) { init(); } 00223 KIconViewItem( QIconView *parent, const QString &text, const QPicture &picture ) 00224 : QIconViewItem( parent, text, picture ) { init(); } 00225 KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPicture &picture ) 00226 : QIconViewItem( parent, after, text, picture ) { init(); } 00227 virtual ~KIconViewItem(); 00228 00240 void setPixmapSize( const QSize& size ); 00241 00246 QSize pixmapSize() const; 00247 00248 protected: 00249 void init(); 00250 virtual void calcRect( const QString& text_ = QString::null ); 00251 virtual void paintItem( QPainter *p, const QColorGroup &c ); 00252 KWordWrap *wordWrap(); 00253 void paintPixmap( QPainter *p, const QColorGroup &c ); 00254 void paintText( QPainter *p, const QColorGroup &c ); 00255 00256 private: 00257 KWordWrap* m_wordWrap; 00258 class KIconViewItemPrivate; 00259 KIconViewItemPrivate *d; 00260 }; 00261 00262 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:43:28 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003