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 00082 signals: 00083 00093 void executed( QIconViewItem *item ); 00094 00105 void executed( QIconViewItem *item, const QPoint &pos ); 00114 void held( QIconViewItem *item ); 00115 00116 00130 void doubleClicked( QIconViewItem *item, const QPoint &pos ); 00131 00132 protected slots: 00133 void slotOnItem( QIconViewItem *item ); 00134 void slotOnViewport(); 00135 void slotSettingsChanged(int); 00136 00140 void slotAutoSelect(); 00141 00142 protected: 00143 void emitExecute( QIconViewItem *item, const QPoint &pos ); 00144 00145 virtual void focusOutEvent( QFocusEvent *fe ); 00146 virtual void leaveEvent( QEvent *e ); 00147 virtual void contentsMousePressEvent( QMouseEvent *e ); 00148 virtual void contentsMouseDoubleClickEvent ( QMouseEvent * e ); 00149 virtual void contentsMouseReleaseEvent( QMouseEvent *e ); 00150 00151 virtual void contentsDragEnterEvent( QDragEnterEvent *e ); 00152 virtual void contentsDragMoveEvent( QDragMoveEvent *e ); 00153 00154 private slots: 00155 void slotMouseButtonClicked( int btn, QIconViewItem *item, const QPoint &pos ); 00156 void slotDragHoldTimeout(); 00157 private: 00161 QFontMetrics *itemFontMetrics() const; 00165 QPixmap selectedIconPixmap( QPixmap *pix, const QColor &col ) const; 00166 00167 bool m_bUseSingle; 00168 bool m_bChangeCursorOverItem; 00169 00170 QIconViewItem* m_pCurrentItem; 00171 00172 QTimer* m_pAutoSelect; 00173 int m_autoSelectDelay; 00174 00175 protected: 00176 virtual void virtual_hook( int id, void* data ); 00177 private: 00178 class KIconViewPrivate; 00179 KIconViewPrivate *d; 00180 }; 00181 00182 class KWordWrap; 00190 class KIconViewItem : public QIconViewItem 00191 { 00192 public: 00193 // Need to redefine all the constructors - I want Java ! 00194 KIconViewItem( QIconView *parent ) 00195 : QIconViewItem( parent ) { init(); } // We need to call it because the parent ctor won't call our reimplementation :((( 00196 KIconViewItem( QIconView *parent, QIconViewItem *after ) 00197 : QIconViewItem( parent, after ) { init(); } 00198 KIconViewItem( QIconView *parent, const QString &text ) 00199 : QIconViewItem( parent, text ) { init(); } 00200 KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text ) 00201 : QIconViewItem( parent, after, text ) { init(); } 00202 KIconViewItem( QIconView *parent, const QString &text, const QPixmap &icon ) 00203 : QIconViewItem( parent, text, icon ) { init(); } 00204 KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPixmap &icon ) 00205 : QIconViewItem( parent, after, text, icon ) { init(); } 00206 KIconViewItem( QIconView *parent, const QString &text, const QPicture &picture ) 00207 : QIconViewItem( parent, text, picture ) { init(); } 00208 KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPicture &picture ) 00209 : QIconViewItem( parent, after, text, picture ) { init(); } 00210 virtual ~KIconViewItem(); 00211 00212 protected: 00213 void init(); 00214 virtual void calcRect( const QString& text_ = QString::null ); 00215 virtual void paintItem( QPainter *p, const QColorGroup &c ); 00216 KWordWrap *wordWrap(); 00217 void paintPixmap( QPainter *p, const QColorGroup &c ); 00218 void paintText( QPainter *p, const QColorGroup &c ); 00219 00220 private: 00221 KWordWrap* m_wordWrap; 00222 class KIconViewItemPrivate; 00223 KIconViewItemPrivate *d; 00224 }; 00225 00226 #endif
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 10 18:55:08 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003