• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdeui
 

kdeui

  • kdeui
kiconview.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 1999 Torben Weis <weis@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 #ifndef KICONVIEW_H
19 #define KICONVIEW_H
20 
21 #include <tqcursor.h>
22 #include <tqiconview.h>
23 
24 #include <kdelibs_export.h>
25 
42 class KDEUI_EXPORT KIconView : public TQIconView
43 {
44  friend class KIconViewItem;
45  Q_OBJECT
46  Q_ENUMS( Mode )
47  Q_PROPERTY( Mode mode READ mode WRITE setMode )
48 
49 public:
50  KIconView( TQWidget *parent = 0, const char *name = 0, WFlags f = 0 );
51 
52  ~KIconView();
53 
62  enum Mode { Execute, Select };
63 
73  void setMode( Mode m );
74 
78  Mode mode() const;
79 
83  virtual void setFont( const TQFont & );
84 
92  void setIconTextHeight( int n );
93 
98  int iconTextHeight() const;
99 
103  virtual void takeItem( TQIconViewItem * item );
104 
105 signals:
106 
116  void executed( TQIconViewItem *item );
117 
128  void executed( TQIconViewItem *item, const TQPoint &pos );
129 
138  void held( TQIconViewItem *item );
139 
153  void doubleClicked( TQIconViewItem *item, const TQPoint &pos );
154 
155 protected slots:
156  void slotOnItem( TQIconViewItem *item );
157  void slotOnViewport();
158  void slotSettingsChanged(int);
159 
163  void slotAutoSelect();
164 
165 protected:
166  void emitExecute( TQIconViewItem *item, const TQPoint &pos );
167  void updateDragHoldItem( TQDropEvent *e );
168 
169  virtual void focusOutEvent( TQFocusEvent *fe );
170  virtual void leaveEvent( TQEvent *e );
171  virtual void contentsMousePressEvent( TQMouseEvent *e );
172  virtual void contentsMouseDoubleClickEvent ( TQMouseEvent * e );
173  virtual void contentsMouseReleaseEvent( TQMouseEvent *e );
174  virtual void contentsDragEnterEvent( TQDragEnterEvent *e );
175  virtual void contentsDragLeaveEvent( TQDragLeaveEvent *e );
176  virtual void contentsDragMoveEvent( TQDragMoveEvent *e );
177  virtual void contentsDropEvent( TQDropEvent* e );
178  virtual void wheelEvent( TQWheelEvent *e );
179 
186  void cancelPendingHeldSignal();
187 
188 private slots:
189  void slotMouseButtonClicked( int btn, TQIconViewItem *item, const TQPoint &pos );
190  void slotDragHoldTimeout();
191 
192 private:
196  TQFontMetrics *itemFontMetrics() const;
200  TQPixmap selectedIconPixmap( TQPixmap *pix, const TQColor &col ) const;
201 
202  bool m_bUseSingle;
203  bool m_bChangeCursorOverItem;
204 
205  TQIconViewItem* m_pCurrentItem;
206 
207  TQTimer* m_pAutoSelect;
208  int m_autoSelectDelay;
209 
210 protected:
211  virtual void virtual_hook( int id, void* data );
212 private:
213  class KIconViewPrivate;
214  KIconViewPrivate *d;
215 };
216 
217 class KWordWrap;
226 class KDEUI_EXPORT KIconViewItem : public TQIconViewItem
227 {
228 public:
229  // Need to redefine all the constructors - I want Java !
230  KIconViewItem( TQIconView *parent )
231  : TQIconViewItem( parent ) { init(); } // We need to call it because the parent ctor won't call our reimplementation :(((
232  KIconViewItem( TQIconView *parent, TQIconViewItem *after )
233  : TQIconViewItem( parent, after ) { init(); }
234  KIconViewItem( TQIconView *parent, const TQString &text )
235  : TQIconViewItem( parent, text ) { init(); }
236  KIconViewItem( TQIconView *parent, TQIconViewItem *after, const TQString &text )
237  : TQIconViewItem( parent, after, text ) { init(); }
238  KIconViewItem( TQIconView *parent, const TQString &text, const TQPixmap &icon )
239  : TQIconViewItem( parent, text, icon ) { init(); }
240  KIconViewItem( TQIconView *parent, TQIconViewItem *after, const TQString &text, const TQPixmap &icon )
241  : TQIconViewItem( parent, after, text, icon ) { init(); }
242  KIconViewItem( TQIconView *parent, const TQString &text, const TQPicture &picture )
243  : TQIconViewItem( parent, text, picture ) { init(); }
244  KIconViewItem( TQIconView *parent, TQIconViewItem *after, const TQString &text, const TQPicture &picture )
245  : TQIconViewItem( parent, after, text, picture ) { init(); }
246  virtual ~KIconViewItem();
247 
259  void setPixmapSize( const TQSize& size );
260 
265  TQSize pixmapSize() const;
266 
267 protected:
268  void init();
269  virtual void calcRect( const TQString& text_ = TQString::null );
270  virtual void paintItem( TQPainter *p, const TQColorGroup &c );
271  KWordWrap *wordWrap();
272  void paintPixmap( TQPainter *p, const TQColorGroup &c );
273  void paintText( TQPainter *p, const TQColorGroup &c );
274 
275 private:
276  KWordWrap* m_wordWrap;
277  struct KIconViewItemPrivate;
278  KIconViewItemPrivate *d;
279 };
280 
281 #endif
KIconViewItem
A variant of TQIconViewItem 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 TQIconView that honors KDE&#39;s system-wide settings.
Definition: kiconview.h:42
KWordWrap
Word-wrap algorithm that takes into account beautifulness ;)
Definition: kwordwrap.h:48

kdeui

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

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.8.13
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |