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

kdeui

  • kdeui
klistview.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
3  Copyright (C) 2000 Charles Samuels <charles@kde.org>
4  Copyright (C) 2000 Peter Putzer <putzer@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 #ifndef KLISTVIEW_H
21 #define KLISTVIEW_H
22 
23 #include <tqlistview.h>
24 
25 #include <tqptrlist.h>
26 #include <kdelibs_export.h>
27 
28 class TQDragObject;
29 class KConfig;
30 class KLineEdit;
53 class KDEUI_EXPORT KListView : public TQListView
54 {
55  friend class KListViewItem;
56 
57  Q_OBJECT
58  TQ_OBJECT
59  Q_ENUMS( SelectionModeExt )
60  Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth )
61  Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable )
62  Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable )
63  Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled )
64  Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen )
65  Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer )
66  Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn )
67  Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth )
68  Q_PROPERTY( TQColor alternateBackground READ alternateBackground WRITE setAlternateBackground )
69  Q_PROPERTY( bool shadeSortColumn READ shadeSortColumn WRITE setShadeSortColumn )
70 
71  Q_OVERRIDE( SelectionModeExt selectionMode READ selectionModeExt WRITE setSelectionModeExt )
72 
73 public:
105  enum SelectionModeExt {
106  Single = TQListView::Single,
107  Multi = TQListView::Multi,
108  Extended = TQListView::Extended,
109  NoSelection = TQListView::NoSelection,
110  FileManager
111  };
112 
119  KListView (TQWidget *parent = 0, const char *name = 0);
120 
124  virtual ~KListView();
125 
133  virtual void setAcceptDrops (bool);
134 
144  virtual bool isExecuteArea( const TQPoint& point );
145 
151  bool isExecuteArea( int x );
152 
158  TQPtrList<TQListViewItem> selectedItems() const;
159 
170  TQPtrList<TQListViewItem> selectedItems(bool includeHiddenItems) const; // ### BIC: KDE 4: use an implicitly shared class! (QValutList?) and merge with above, default to true
171 
178  void moveItem(TQListViewItem *item, TQListViewItem *parent, TQListViewItem *after);
179 
185  TQListViewItem *lastItem() const;
186 
192  TQListViewItem* lastChild () const;
193 
200  KLineEdit* renameLineEdit() const;
201 
208  bool itemsMovable() const;
209 
215  bool itemsRenameable() const;
216 
222  bool dragEnabled() const;
223 
229  bool autoOpen() const;
230 
236  bool isRenameable (int column) const;
237 
243  bool dropVisualizer() const;
244 
250  int tooltipColumn() const;
251 
258  bool createChildren() const KDE_DEPRECATED;
259 
265  bool dropHighlighter() const;
266 
273  int dropVisualizerWidth () const;
274 
281  SelectionModeExt selectionModeExt () const;
282 
288  int itemIndex( const TQListViewItem *item ) const;
289 
295  TQListViewItem* itemAtIndex(int index);
296 
301  void setFullWidth() KDE_DEPRECATED;
302 
308  void setFullWidth(bool fullWidth);
309 
315  bool fullWidth() const;
316 
322  virtual int addColumn(const TQString& label, int width = -1);
326  virtual int addColumn(const TQIconSet& iconset, const TQString& label, int width = -1);
332  virtual void removeColumn(int index);
333 
343  void setAlternateBackground(const TQColor &c);
349  const TQColor &alternateBackground() const;
350 
358  void saveLayout(KConfig *config, const TQString &group) const;
366  void restoreLayout(KConfig *config, const TQString &group);
373  virtual void setSorting(int column, bool ascending = true);
374 
378  int columnSorted(void) const;
379 
383  bool ascendingSort(void) const;
384 
388  virtual void takeItem(TQListViewItem *i);
389 
396  void setShadeSortColumn(bool shadeSortColumn);
397 
404  bool shadeSortColumn(void) const;
405 signals:
406 
416  void executed( TQListViewItem *item );
417 
429  void executed( TQListViewItem *item, const TQPoint &pos, int c );
430 
441  void dropped (TQDropEvent * e, TQListViewItem *after);
442 
455  void dropped (KListView* list, TQDropEvent* e, TQListViewItem* after);
456 
469  void dropped (KListView* list, TQDropEvent* e, TQListViewItem* parent, TQListViewItem* after);
470 
482  void dropped (TQDropEvent* e, TQListViewItem* parent, TQListViewItem* after);
483 
490  void moved();
491 
500  void aboutToMove();
501 
513  void moved (TQListViewItem *item, TQListViewItem *afterFirst, TQListViewItem *afterNow);
514 
515 
521  void moved(TQPtrList<TQListViewItem> &items, TQPtrList<TQListViewItem> &afterFirst, TQPtrList<TQListViewItem> &afterNow);
522 
530  void itemRenamed(TQListViewItem* item, const TQString &str, int col);
531 
535  void itemRenamed(TQListViewItem* item);
536 
547  void menuShortCutPressed (KListView* list, TQListViewItem* item);
548 
557  void contextMenu (KListView* l, TQListViewItem* i, const TQPoint& p);
558 
559  void itemAdded(TQListViewItem *item);
560  void itemRemoved(TQListViewItem *item);
561 
562 public slots:
566  virtual void rename(TQListViewItem *item, int c);
567 
578  void setRenameable (int column, bool yesno=true);
579 
586  virtual void setItemsMovable(bool b);
587 
595  virtual void setItemsRenameable(bool b);
596 
601  virtual void setDragEnabled(bool b);
602 
606  virtual void setAutoOpen(bool b);
607 
613  virtual void setDropVisualizer(bool b);
614 
619  void setDropVisualizerWidth (int w);
620 
627  virtual void setTooltipColumn(int column);
628 
634  virtual void setDropHighlighter(bool b);
635 
642  virtual void setCreateChildren(bool b) KDE_DEPRECATED;
643 
649  void setSelectionModeExt (SelectionModeExt mode);
650 
655  void setTabOrderedRenaming(bool b);
656 
661  bool tabOrderedRenaming() const;
662 
669  virtual void selectAll( bool select );
670 
671 protected:
680  inline bool below (const TQRect& rect, const TQPoint& p)
681  {
682  return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2));
683  }
684 
694  inline bool below (TQListViewItem* i, const TQPoint& p)
695  {
696  return below (itemRect(i), contentsToViewport(p));
697  }
698 
703  virtual bool event( TQEvent * );
704 
709  void emitExecute( TQListViewItem *item, const TQPoint &pos, int c );
710 
718  virtual void focusInEvent(TQFocusEvent* fe);
719 
727  virtual void focusOutEvent( TQFocusEvent *fe );
728 
736  virtual void leaveEvent( TQEvent *e );
737 
741  virtual TQString tooltip(TQListViewItem* item, int column) const;
742 
746  virtual bool showTooltip(TQListViewItem *item, const TQPoint &pos, int column) const;
747 
755  virtual void contentsDragMoveEvent (TQDragMoveEvent *event);
756 
764  virtual void contentsMousePressEvent( TQMouseEvent *e );
765 
773  virtual void contentsMouseMoveEvent( TQMouseEvent *e );
774 
782  virtual void contentsMouseDoubleClickEvent ( TQMouseEvent *e );
783 
791  virtual void contentsDragLeaveEvent (TQDragLeaveEvent *event);
792 
800  virtual void contentsMouseReleaseEvent (TQMouseEvent*);
801 
809  virtual void contentsDropEvent (TQDropEvent*);
810 
818  virtual void contentsDragEnterEvent (TQDragEnterEvent *);
819 
825  virtual TQDragObject *dragObject();
826 
832  virtual bool acceptDrag (TQDropEvent* event) const;
833 
841  virtual TQRect drawDropVisualizer (TQPainter *p, TQListViewItem *parent, TQListViewItem *after);
842 
849  virtual TQRect drawItemHighlighter(TQPainter *painter, TQListViewItem *item);
850 
857  virtual void startDrag();
858 
866  virtual void keyPressEvent (TQKeyEvent*);
867 
875  virtual void viewportPaintEvent(TQPaintEvent*);
876 
881  void activateAutomaticSelection();
886  void deactivateAutomaticSelection();
892  bool automaticSelection() const;
893 
897  virtual void viewportResizeEvent(TQResizeEvent* e);
898 
906  void disableAutoSelection();
907 
913  void resetAutoSelection();
914 
920  void resetKeyboardSelectionOperation();
921 
928  void setActiveMultiSelectItem(TQListViewItem *item);
929 
934  // KDE 4: remove
935  void doubleClicked( TQListViewItem *item, const TQPoint &pos, int c );
936 
937 protected slots:
942  void slotSettingsChanged(int);
943 
944  void slotMouseButtonClicked( int btn, TQListViewItem *item, const TQPoint &pos, int c );
945  void doneEditing(TQListViewItem *item, int row);
946 
950  void cleanDropVisualizer();
951 
955  void cleanItemHighlighter();
956 
960  void emitContextMenu (TQListViewItem*, const TQPoint&, int);
961 
965  void emitContextMenu (KListView*, TQListViewItem*);
966 
971  void slotOnItem( TQListViewItem *item );
972 
977  void slotOnViewport();
978 
983  void slotAutoSelect();
984 
985  void slotDragExpand();
986 
991  void slotHeaderChanged();
992 
993 protected:
997  virtual void movableDropEvent (TQListViewItem* parent, TQListViewItem* afterme);
998 
1005  virtual void findDrop(const TQPoint &pos, TQListViewItem *&parent, TQListViewItem *&after);
1006 
1010  void fileManagerKeyPressEvent (TQKeyEvent*);
1011 
1015  int depthToPixels( int depth );
1016 
1017 private:
1018  class Tooltip;
1019 protected:
1020  virtual void virtual_hook( int id, void* data );
1021 private:
1022  class KListViewPrivate;
1023  KListViewPrivate* const d;
1024  bool isExecuteArea( int x, TQListViewItem* item );
1025 };
1026 
1033 class KDEUI_EXPORT KListViewItem : public TQListViewItem
1034 {
1035  friend class KListView;
1036 public:
1043  KListViewItem(TQListView *parent);
1044  KListViewItem(TQListViewItem *parent);
1045  KListViewItem(TQListView *parent, TQListViewItem *after);
1046  KListViewItem(TQListViewItem *parent, TQListViewItem *after);
1047 
1048  KListViewItem(TQListView *parent,
1049  TQString, TQString = TQString::null,
1050  TQString = TQString::null, TQString = TQString::null,
1051  TQString = TQString::null, TQString = TQString::null,
1052  TQString = TQString::null, TQString = TQString::null);
1053 
1054  KListViewItem(TQListViewItem *parent,
1055  TQString, TQString = TQString::null,
1056  TQString = TQString::null, TQString = TQString::null,
1057  TQString = TQString::null, TQString = TQString::null,
1058  TQString = TQString::null, TQString = TQString::null);
1059 
1060  KListViewItem(TQListView *parent, TQListViewItem *after,
1061  TQString, TQString = TQString::null,
1062  TQString = TQString::null, TQString = TQString::null,
1063  TQString = TQString::null, TQString = TQString::null,
1064  TQString = TQString::null, TQString = TQString::null);
1065 
1066  KListViewItem(TQListViewItem *parent, TQListViewItem *after,
1067  TQString, TQString = TQString::null,
1068  TQString = TQString::null, TQString = TQString::null,
1069  TQString = TQString::null, TQString = TQString::null,
1070  TQString = TQString::null, TQString = TQString::null);
1071 
1072  virtual ~KListViewItem();
1073 
1074  virtual void insertItem(TQListViewItem *item);
1075  virtual void takeItem(TQListViewItem *item);
1079  bool isAlternate();
1083  const TQColor &backgroundColor() KDE_DEPRECATED; // #### should be removed in 4.0; use below instead
1084 
1093  TQColor backgroundColor(int column);
1094 
1095  virtual void paintCell(TQPainter *p, const TQColorGroup &cg,
1096  int column, int width, int alignment);
1097 
1098 private:
1099  void init();
1100 
1101 private:
1102  uint m_odd : 1;
1103  uint m_known : 1;
1104  uint m_unused : 30;
1105 };
1106 
1107 #endif
1108 
1109 // vim: ts=2 sw=2 et
KConfig
KLineEdit
An enhanced TQLineEdit widget for inputting text.
Definition: klineedit.h:146
KListViewItem
A listview item with support for alternate background colors.
Definition: klistview.h:1034
KListView
This Widget extends the functionality of TQListView to honor the system wide settings for Single Clic...
Definition: klistview.h:54
KListView::below
bool below(TQListViewItem *i, const TQPoint &p)
An overloaded version of below(const TQRect&, const TQPoint&).
Definition: klistview.h:694
KListView::takeItem
virtual void takeItem(TQListViewItem *i)
Reimplemented for internal reasons.
Definition: klistview.cpp:2292
KListView::SelectionModeExt
SelectionModeExt
Possible selection modes.
Definition: klistview.h:105

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.9.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |