kiconview.h
/* This file is part of the KDE libraries
Copyright (C) 1999 Torben Weis <weis@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KICONVIEW_H
#define KICONVIEW_H
#include <qcursor.h>
#include <qiconview.h>
#include <kdelibs_export.h>
class KDEUI_EXPORT KIconView : public QIconView
{
friend class KIconViewItem;
Q_OBJECT
Q_ENUMS( Mode )
Q_PROPERTY( Mode mode READ mode WRITE setMode )
public:
KIconView( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
~KIconView();
enum Mode { Execute, Select };
void setMode( Mode m );
Mode mode() const;
virtual void setFont( const QFont & );
void setIconTextHeight( int n );
int iconTextHeight() const;
virtual void takeItem( QIconViewItem * item );
signals:
void executed( QIconViewItem *item );
void executed( QIconViewItem *item, const QPoint &pos );
void held( QIconViewItem *item );
void doubleClicked( QIconViewItem *item, const QPoint &pos );
protected slots:
void slotOnItem( QIconViewItem *item );
void slotOnViewport();
void slotSettingsChanged(int);
void slotAutoSelect();
protected:
void emitExecute( QIconViewItem *item, const QPoint &pos );
void updateDragHoldItem( QDropEvent *e );
virtual void focusOutEvent( QFocusEvent *fe );
virtual void leaveEvent( QEvent *e );
virtual void contentsMousePressEvent( QMouseEvent *e );
virtual void contentsMouseDoubleClickEvent ( QMouseEvent * e );
virtual void contentsMouseReleaseEvent( QMouseEvent *e );
virtual void contentsDragEnterEvent( QDragEnterEvent *e );
virtual void contentsDragLeaveEvent( QDragLeaveEvent *e );
virtual void contentsDragMoveEvent( QDragMoveEvent *e );
virtual void contentsDropEvent( QDropEvent* e );
virtual void wheelEvent( QWheelEvent *e );
void cancelPendingHeldSignal();
private slots:
void slotMouseButtonClicked( int btn, QIconViewItem *item, const QPoint &pos );
void slotDragHoldTimeout();
private:
QFontMetrics *itemFontMetrics() const;
QPixmap selectedIconPixmap( QPixmap *pix, const QColor &col ) const;
bool m_bUseSingle;
bool m_bChangeCursorOverItem;
QIconViewItem* m_pCurrentItem;
QTimer* m_pAutoSelect;
int m_autoSelectDelay;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KIconViewPrivate;
KIconViewPrivate *d;
};
class KWordWrap;
class KDEUI_EXPORT KIconViewItem : public QIconViewItem
{
public:
// Need to redefine all the constructors - I want Java !
KIconViewItem( QIconView *parent )
: QIconViewItem( parent ) { init(); } // We need to call it because the parent ctor won't call our reimplementation :(((
KIconViewItem( QIconView *parent, QIconViewItem *after )
: QIconViewItem( parent, after ) { init(); }
KIconViewItem( QIconView *parent, const QString &text )
: QIconViewItem( parent, text ) { init(); }
KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text )
: QIconViewItem( parent, after, text ) { init(); }
KIconViewItem( QIconView *parent, const QString &text, const QPixmap &icon )
: QIconViewItem( parent, text, icon ) { init(); }
KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPixmap &icon )
: QIconViewItem( parent, after, text, icon ) { init(); }
KIconViewItem( QIconView *parent, const QString &text, const QPicture &picture )
: QIconViewItem( parent, text, picture ) { init(); }
KIconViewItem( QIconView *parent, QIconViewItem *after, const QString &text, const QPicture &picture )
: QIconViewItem( parent, after, text, picture ) { init(); }
virtual ~KIconViewItem();
void setPixmapSize( const QSize& size );
QSize pixmapSize() const;
protected:
void init();
virtual void calcRect( const QString& text_ = QString::null );
virtual void paintItem( QPainter *p, const QColorGroup &c );
KWordWrap *wordWrap();
void paintPixmap( QPainter *p, const QColorGroup &c );
void paintText( QPainter *p, const QColorGroup &c );
private:
KWordWrap* m_wordWrap;
struct KIconViewItemPrivate;
KIconViewItemPrivate *d;
};
#endif
KIconViewItem
A variant of QIconViewItem that wraps words better.
Definition: kiconview.h:226
KIconView::Mode
Mode
KIconView has two different operating modes.
Definition: kiconview.h:62
KIconView
A variant of QIconView that honors KDE's system-wide settings.
Definition: kiconview.h:42
KWordWrap
Word-wrap algorithm that takes into account beautifulness ;)
Definition: kwordwrap.h:48

KDE Home | KDE Accessibility Home | Description of Access Keys