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

tdeui

  • tdeui
tdelistview.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
21#ifndef TDELISTVIEW_H
22#define TDELISTVIEW_H
23
24#include <tqheader.h>
25#include <tqlistview.h>
26#include <tdeshortcut.h>
27#include <tqptrlist.h>
28#include <tdelibs_export.h>
29
30class TQDragObject;
31class TDEConfig;
32class KLineEdit;
33
34// Used to set the 'move to next/previous item' after renaming is completed
35class TDEListViewRenameSettings
36{
37 public:
38 bool m_useRenameSignals; // if true, emits renameNext/renamePrev signals
39 TDEShortcut m_SCNext; // the shortcut key for moving to the next cell
40 TDEShortcut m_SCPrev; // the shortcut key for moving to the previous cell
41
42 TDEListViewRenameSettings()
43 : m_useRenameSignals(false), m_SCNext(), m_SCPrev() {}
44
45 TDEListViewRenameSettings(bool useRenameSignals, TDEShortcut scNext, TDEShortcut scPrev)
46 : m_useRenameSignals(useRenameSignals), m_SCNext(scNext), m_SCPrev(scPrev) {}
47
48 TDEListViewRenameSettings(const TDEListViewRenameSettings &that)
49 : m_useRenameSignals(that.m_useRenameSignals), m_SCNext(that.m_SCNext), m_SCPrev(that.m_SCPrev) {}
50
51 TDEListViewRenameSettings& operator=(const TDEListViewRenameSettings &that)
52 {
53 if (this==&that) return *this;
54 m_useRenameSignals = that.m_useRenameSignals;
55 m_SCNext = that.m_SCNext;
56 m_SCPrev = that.m_SCPrev;
57 return *this;
58 }
59};
60
61
84class TDEUI_EXPORT TDEListView : public TQListView
85{
86 friend class TDEListViewItem;
87
88 TQ_OBJECT
89
90 TQ_ENUMS( SelectionModeExt )
91 TQ_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth )
92 TQ_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable )
93 TQ_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable )
94 TQ_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled )
95 TQ_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen )
96 TQ_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer )
97 TQ_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn )
98 TQ_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth )
99 TQ_PROPERTY( TQColor alternateBackground READ alternateBackground WRITE setAlternateBackground )
100 TQ_PROPERTY( bool shadeSortColumn READ shadeSortColumn WRITE setShadeSortColumn )
101
102 TQ_OVERRIDE( SelectionModeExt selectionMode READ selectionModeExt WRITE setSelectionModeExt )
103
104public:
136 enum SelectionModeExt {
137 Single = TQListView::Single,
138 Multi = TQListView::Multi,
139 Extended = TQListView::Extended,
140 NoSelection = TQListView::NoSelection,
141 FileManager
142 };
143
150 TDEListView (TQWidget *parent = 0, const char *name = 0);
151
155 virtual ~TDEListView();
156
164 virtual void setAcceptDrops (bool);
165
175 virtual bool isExecuteArea( const TQPoint& point );
176
182 bool isExecuteArea( int x );
183
189 TQPtrList<TQListViewItem> selectedItems() const;
190
201 TQPtrList<TQListViewItem> selectedItems(bool includeHiddenItems) const; // ### BIC: KDE 4: use an implicitly shared class! (QValutList?) and merge with above, default to true
202
209 void moveItem(TQListViewItem *item, TQListViewItem *parent, TQListViewItem *after);
210
216 TQListViewItem *lastItem() const;
217
223 TQListViewItem* lastChild () const;
224
231 KLineEdit* renameLineEdit() const;
232
239 bool itemsMovable() const;
240
246 bool itemsRenameable() const;
247
253 bool dragEnabled() const;
254
260 bool autoOpen() const;
261
267 bool isRenameable (int column) const;
268
274 bool dropVisualizer() const;
275
281 int tooltipColumn() const;
282
289 bool createChildren() const TDE_DEPRECATED;
290
296 bool dropHighlighter() const;
297
304 int dropVisualizerWidth () const;
305
312 SelectionModeExt selectionModeExt () const;
313
319 int itemIndex( const TQListViewItem *item ) const;
320
326 TQListViewItem* itemAtIndex(int index);
327
332 void setFullWidth() TDE_DEPRECATED;
333
339 void setFullWidth(bool fullWidth);
340
346 bool fullWidth() const;
347
353 virtual int addColumn(const TQString& label, int width = -1);
357 virtual int addColumn(const TQIconSet& iconset, const TQString& label, int width = -1);
363 virtual void removeColumn(int index);
364
374 void setAlternateBackground(const TQColor &c);
380 const TQColor &alternateBackground() const;
381
389 void saveLayout(TDEConfig *config, const TQString &group) const;
397 void restoreLayout(TDEConfig *config, const TQString &group);
404 virtual void setSorting(int column, bool ascending = true);
405
409 int columnSorted(void) const;
410
414 bool ascendingSort(void) const;
415
419 virtual void takeItem(TQListViewItem *i);
420
427 void setShadeSortColumn(bool shadeSortColumn);
428
435 bool shadeSortColumn(void) const;
436
443 void setUseSmallExecuteArea(bool enable);
444
450 bool useSmallExecuteArea() const;
451
460 void setRenameSettings(const TDEListViewRenameSettings &renSett);
461
462
463signals:
464
474 void executed( TQListViewItem *item );
475
487 void executed( TQListViewItem *item, const TQPoint &pos, int c );
488
499 void dropped (TQDropEvent * e, TQListViewItem *after);
500
513 void dropped (TDEListView* list, TQDropEvent* e, TQListViewItem* after);
514
527 void dropped (TDEListView* list, TQDropEvent* e, TQListViewItem* parent, TQListViewItem* after);
528
540 void dropped (TQDropEvent* e, TQListViewItem* parent, TQListViewItem* after);
541
548 void moved();
549
558 void aboutToMove();
559
571 void moved (TQListViewItem *item, TQListViewItem *afterFirst, TQListViewItem *afterNow);
572
573
579 void moved(TQPtrList<TQListViewItem> &items, TQPtrList<TQListViewItem> &afterFirst, TQPtrList<TQListViewItem> &afterNow);
580
588 void itemRenamed(TQListViewItem* item, const TQString &str, int col);
589
593 void itemRenamed(TQListViewItem* item);
594
605 void menuShortCutPressed (TDEListView* list, TQListViewItem* item);
606
615 void contextMenu(TDEListView* l, TQListViewItem* i, const TQPoint& p);
616
617 void itemAdded(TQListViewItem *item);
618 void itemRemoved(TQListViewItem *item);
619
631 void renameNext(TQListViewItem* item, int col);
632
644 void renamePrev(TQListViewItem* item, int col);
645
646public slots:
650 virtual void rename(TQListViewItem *item, int c);
651
662 void setRenameable (int column, bool yesno=true);
663
670 virtual void setItemsMovable(bool b);
671
679 virtual void setItemsRenameable(bool b);
680
685 virtual void setDragEnabled(bool b);
686
690 virtual void setAutoOpen(bool b);
691
697 virtual void setDropVisualizer(bool b);
698
703 void setDropVisualizerWidth (int w);
704
711 virtual void setTooltipColumn(int column);
712
718 virtual void setDropHighlighter(bool b);
719
726 virtual void setCreateChildren(bool b) TDE_DEPRECATED;
727
733 void setSelectionModeExt (SelectionModeExt mode);
734
739 void setTabOrderedRenaming(bool b);
740
745 bool tabOrderedRenaming() const;
746
753 virtual void selectAll( bool select );
754
755protected:
764 inline bool below (const TQRect& rect, const TQPoint& p)
765 {
766 return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2));
767 }
768
778 inline bool below (TQListViewItem* i, const TQPoint& p)
779 {
780 return below (itemRect(i), contentsToViewport(p));
781 }
782
787 virtual bool event( TQEvent * );
788
793 void emitExecute( TQListViewItem *item, const TQPoint &pos, int c );
794
802 virtual void focusInEvent(TQFocusEvent* fe);
803
811 virtual void focusOutEvent( TQFocusEvent *fe );
812
820 virtual void leaveEvent( TQEvent *e );
821
825 virtual TQString tooltip(TQListViewItem* item, int column) const;
826
830 virtual bool showTooltip(TQListViewItem *item, const TQPoint &pos, int column) const;
831
839 virtual void contentsDragMoveEvent (TQDragMoveEvent *event);
840
848 virtual void contentsMousePressEvent( TQMouseEvent *e );
849
857 virtual void contentsMouseMoveEvent( TQMouseEvent *e );
858
866 virtual void contentsMouseDoubleClickEvent ( TQMouseEvent *e );
867
875 virtual void contentsDragLeaveEvent (TQDragLeaveEvent *event);
876
884 virtual void contentsMouseReleaseEvent (TQMouseEvent*);
885
893 virtual void contentsDropEvent (TQDropEvent*);
894
902 virtual void contentsDragEnterEvent (TQDragEnterEvent *);
903
909 virtual TQDragObject *dragObject();
910
916 virtual bool acceptDrag (TQDropEvent* event) const;
917
925 virtual TQRect drawDropVisualizer (TQPainter *p, TQListViewItem *parent, TQListViewItem *after);
926
933 virtual TQRect drawItemHighlighter(TQPainter *painter, TQListViewItem *item);
934
941 virtual void startDrag();
942
950 virtual void keyPressEvent (TQKeyEvent*);
951
959 virtual void viewportPaintEvent(TQPaintEvent*);
960
965 void activateAutomaticSelection();
970 void deactivateAutomaticSelection();
976 bool automaticSelection() const;
977
981 virtual void viewportResizeEvent(TQResizeEvent* e);
982
990 void disableAutoSelection();
991
997 void resetAutoSelection();
998
1004 void resetKeyboardSelectionOperation();
1005
1012 void setActiveMultiSelectItem(TQListViewItem *item);
1013
1018 // KDE 4: remove
1019 void doubleClicked( TQListViewItem *item, const TQPoint &pos, int c );
1020
1021protected slots:
1026 void slotSettingsChanged(int);
1027 void slotMouseButtonClicked( int btn, TQListViewItem *item, const TQPoint &pos, int c );
1028 void doneEditing(TQListViewItem *item, int row);
1029 void renameNextProxy(TQListViewItem *item, int col);
1030 void renamePrevProxy(TQListViewItem *item, int col);
1031
1035 void cleanDropVisualizer();
1036
1040 void cleanItemHighlighter();
1041
1045 void emitContextMenu (TQListViewItem*, const TQPoint&, int);
1046
1050 void emitContextMenu (TDEListView*, TQListViewItem*);
1051
1056 void slotOnItem( TQListViewItem *item );
1057
1062 void slotOnViewport();
1063
1068 void slotAutoSelect();
1069
1070 void slotDragExpand();
1071
1076 void slotHeaderChanged();
1077
1078protected:
1082 virtual void movableDropEvent (TQListViewItem* parent, TQListViewItem* afterme);
1083
1090 virtual void findDrop(const TQPoint &pos, TQListViewItem *&parent, TQListViewItem *&after);
1091
1095 void fileManagerKeyPressEvent (TQKeyEvent*);
1096
1100 int depthToPixels( int depth );
1101
1102private:
1103 class Tooltip;
1104protected:
1105 virtual void virtual_hook( int id, void* data );
1106private:
1107 class TDEListViewPrivate;
1108 TDEListViewPrivate* const d;
1109 bool isExecuteArea( int x, TQListViewItem* item );
1110};
1111
1118class TDEUI_EXPORT TDEListViewItem : public TQListViewItem
1119{
1120 friend class TDEListView;
1121public:
1128 TDEListViewItem(TQListView *parent);
1129 TDEListViewItem(TQListViewItem *parent);
1130 TDEListViewItem(TQListView *parent, TQListViewItem *after);
1131 TDEListViewItem(TQListViewItem *parent, TQListViewItem *after);
1132
1133 TDEListViewItem(TQListView *parent,
1134 TQString, TQString = TQString::null,
1135 TQString = TQString::null, TQString = TQString::null,
1136 TQString = TQString::null, TQString = TQString::null,
1137 TQString = TQString::null, TQString = TQString::null);
1138
1139 TDEListViewItem(TQListViewItem *parent,
1140 TQString, TQString = TQString::null,
1141 TQString = TQString::null, TQString = TQString::null,
1142 TQString = TQString::null, TQString = TQString::null,
1143 TQString = TQString::null, TQString = TQString::null);
1144
1145 TDEListViewItem(TQListView *parent, TQListViewItem *after,
1146 TQString, TQString = TQString::null,
1147 TQString = TQString::null, TQString = TQString::null,
1148 TQString = TQString::null, TQString = TQString::null,
1149 TQString = TQString::null, TQString = TQString::null);
1150
1151 TDEListViewItem(TQListViewItem *parent, TQListViewItem *after,
1152 TQString, TQString = TQString::null,
1153 TQString = TQString::null, TQString = TQString::null,
1154 TQString = TQString::null, TQString = TQString::null,
1155 TQString = TQString::null, TQString = TQString::null);
1156
1157 virtual ~TDEListViewItem();
1158
1159 virtual void insertItem(TQListViewItem *item);
1160 virtual void takeItem(TQListViewItem *item);
1164 bool isAlternate();
1168 const TQColor &backgroundColor() TDE_DEPRECATED; // #### should be removed in 4.0; use below instead
1169
1178 TQColor backgroundColor(int column);
1179
1180 virtual void paintCell(TQPainter *p, const TQColorGroup &cg,
1181 int column, int width, int alignment);
1182
1183private:
1184 void init();
1185
1186private:
1187 uint m_odd : 1;
1188 uint m_known : 1;
1189 uint m_unused : 30;
1190};
1191
1192#endif
KLineEdit
An enhanced TQLineEdit widget for inputting text.
Definition: klineedit.h:146
TDEConfig
TDEListViewItem
A listview item with support for alternate background colors.
Definition: tdelistview.h:1119
TDEListView
This Widget extends the functionality of TQListView to honor the system wide settings for Single Clic...
Definition: tdelistview.h:85
TDEListView::takeItem
virtual void takeItem(TQListViewItem *i)
Reimplemented for internal reasons.
Definition: tdelistview.cpp:2326
TDEListView::SelectionModeExt
SelectionModeExt
Possible selection modes.
Definition: tdelistview.h:136
TDEListView::below
bool below(TQListViewItem *i, const TQPoint &p)
An overloaded version of below(const TQRect&, const TQPoint&).
Definition: tdelistview.h:778
TDEShortcut

tdeui

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

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.