• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kdeui

kiconview.h

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, 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   void updateDragHoldItem( QDropEvent *e );
00168 
00169   virtual void focusOutEvent( QFocusEvent *fe );
00170   virtual void leaveEvent( QEvent *e );
00171   virtual void contentsMousePressEvent( QMouseEvent *e );
00172   virtual void contentsMouseDoubleClickEvent ( QMouseEvent * e );
00173   virtual void contentsMouseReleaseEvent( QMouseEvent *e );
00174   virtual void contentsDragEnterEvent( QDragEnterEvent *e );
00175   virtual void contentsDragLeaveEvent( QDragLeaveEvent *e );
00176   virtual void contentsDragMoveEvent( QDragMoveEvent *e );
00177   virtual void contentsDropEvent( QDropEvent* e );
00178   virtual void wheelEvent( QWheelEvent *e );
00179 
00186   void cancelPendingHeldSignal();
00187   
00188 private slots:
00189   void slotMouseButtonClicked( int btn, QIconViewItem *item, const QPoint &pos );
00190   void slotDragHoldTimeout();
00191 
00192 private:
00196   QFontMetrics *itemFontMetrics() const;
00200   QPixmap selectedIconPixmap( QPixmap *pix, const QColor &col ) const;
00201 
00202   bool m_bUseSingle;
00203   bool m_bChangeCursorOverItem;
00204 
00205   QIconViewItem* m_pCurrentItem;
00206 
00207   QTimer* m_pAutoSelect;
00208   int m_autoSelectDelay;
00209 
00210 protected:
00211   virtual void virtual_hook( int id, void* data );
00212 private:
00213   class KIconViewPrivate;
00214   KIconViewPrivate *d;
00215 };
00216 
00217 class KWordWrap;
00226 class KDEUI_EXPORT KIconViewItem : public QIconViewItem
00227 {
00228 public:
00229     // Need to redefine all the constructors - I want Java !
00230     KIconViewItem( QIconView *parent )
00231         : QIconViewItem( parent ) { init(); } // We need to call it because the parent ctor won't call our reimplementation :(((
00232     KIconViewItem( QIconView *parent, QIconViewItem *after )
00233         : QIconViewItem( parent, after ) { init(); }
00234     KIconViewItem( QIconView *parent, const QString &text )
00235         : QIconViewItem( parent, text ) { init(); }
00236     KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text )
00237         : QIconViewItem( parent, after, text ) { init(); }
00238     KIconViewItem( QIconView *parent, const QString &text, const QPixmap &icon )
00239         : QIconViewItem( parent, text, icon ) { init(); }
00240     KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPixmap &icon )
00241         : QIconViewItem( parent, after, text, icon ) { init(); }
00242     KIconViewItem( QIconView *parent, const QString &text, const QPicture &picture )
00243         : QIconViewItem( parent, text, picture ) { init(); }
00244     KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPicture &picture )
00245         : QIconViewItem( parent, after, text, picture ) { init(); }
00246     virtual ~KIconViewItem();
00247 
00259     void setPixmapSize( const QSize& size );
00260 
00265     QSize pixmapSize() const;
00266 
00267 protected:
00268     void init();
00269     virtual void calcRect( const QString& text_ = QString::null );
00270     virtual void paintItem( QPainter *p, const QColorGroup &c );
00271     KWordWrap *wordWrap();
00272     void paintPixmap( QPainter *p, const QColorGroup &c );
00273     void paintText( QPainter *p, const QColorGroup &c );
00274 
00275 private:
00276     KWordWrap* m_wordWrap;
00277     struct KIconViewItemPrivate;
00278     KIconViewItemPrivate *d;
00279 };
00280 
00281 #endif

kdeui

Skip menu "kdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal