24 #include <tqdragobject.h>
28 #include <tqtooltip.h>
30 #include <tqpainter.h>
32 #include <tdeglobalsettings.h>
33 #include <tdeconfig.h>
35 #include <tdeapplication.h>
39 #include "tdelistview.h"
40 #include "tdelistviewlineedit.h"
42 class TDEListView::Tooltip :
public TQToolTip
45 Tooltip (
TDEListView* parent, TQToolTipGroup* group = 0L);
46 virtual ~Tooltip () {}
52 virtual void maybeTip (
const TQPoint&);
58 TDEListView::Tooltip::Tooltip (
TDEListView* parent, TQToolTipGroup* group)
59 : TQToolTip (parent, group),
64 void TDEListView::Tooltip::maybeTip (
const TQPoint&)
69 class TDEListView::TDEListViewPrivate
79 cursorInExecuteArea(false),
81 selectedBySimpleMove(false),
82 selectedUsingMouse(false),
91 pressedOnSelected (false),
92 wasShiftEvent (false),
97 selectionDirection(0),
100 selectionMode (Single),
103 mDropVisualizerWidth (4),
109 initialFileManagerItem(0)
111 renameable.append(0);
112 connect(editor, TQ_SIGNAL(done(TQListViewItem*,
int)), listview, TQ_SLOT(doneEditing(TQListViewItem*,
int)));
113 connect(editor, TQ_SIGNAL(
renameNext(TQListViewItem*,
int)), listview, TQ_SLOT(renameNextProxy(TQListViewItem*,
int)));
114 connect(editor, TQ_SIGNAL(
renamePrev(TQListViewItem*,
int)), listview, TQ_SLOT(renamePrevProxy(TQListViewItem*,
int)));
117 ~TDEListViewPrivate ()
122 TQListViewItem* pCurrentItem;
129 TQListViewItem* dragOverItem;
130 TQPoint dragOverPoint;
132 TQPoint startDragPos;
136 TQValueList<int> renameable;
138 bool cursorInExecuteArea:1;
140 bool bChangeCursorOverItem:1;
142 bool selectedBySimpleMove : 1;
143 bool selectedUsingMouse:1;
152 bool pressedOnSelected:1;
153 bool wasShiftEvent:1;
155 bool sortAscending:1;
161 int selectionDirection;
167 bool showContextMenusOnPress;
169 TQRect mOldDropVisualizer;
170 int mDropVisualizerWidth;
171 TQRect mOldDropHighlighter;
172 TQListViewItem *afterItemDrop;
173 TQListViewItem *parentItemDrop;
175 TQListViewItem *paintAbove;
176 TQListViewItem *paintCurrent;
177 TQListViewItem *paintBelow;
183 TQListViewItem *initialFileManagerItem;
187 TDEListViewLineEdit::TDEListViewLineEdit(
TDEListView *parent)
188 :
KLineEdit(parent->viewport()), item(0), col(0), p(parent), m_renSett()
192 connect( parent, TQ_SIGNAL( selectionChanged() ), TQ_SLOT( slotSelectionChanged() ));
193 connect( parent, TQ_SIGNAL( itemRemoved( TQListViewItem * ) ),
194 TQ_SLOT( slotItemRemoved( TQListViewItem * ) ));
197 TDEListViewLineEdit::~TDEListViewLineEdit()
201 TQListViewItem *TDEListViewLineEdit::currentItem()
const
206 void TDEListViewLineEdit::load(TQListViewItem *i,
int c)
211 TQRect rect(p->itemRect(i));
215 int fieldX = rect.x() - 1;
216 int fieldW = p->columnWidth(col) + 2;
218 TQHeader*
const pHeader = p->header();
220 const int pos = pHeader->mapToIndex(col);
221 for (
int index = 0; index < pos; ++index )
222 fieldX += p->columnWidth( pHeader->mapToSection( index ));
225 int d = i->depth() + (p->rootIsDecorated() ? 1 : 0);
226 d *= p->treeStepSize();
231 if ( i->pixmap( col ) ) {
232 int d = i->pixmap( col )->width();
237 setGeometry(fieldX, rect.y() - 1, fieldW, rect.height() + 2);
246 static int nextCol (
TDEListView *pl, TQListViewItem *pi,
int start,
int dir)
251 for (; ((dir == +1) ? (start < pl->columns()) : (start >= 0)); start += dir)
259 static TQListViewItem *prevItem (TQListViewItem *pi)
261 TQListViewItem *pa = pi->itemAbove();
266 if (pa && pa->parent() == pi->parent())
272 static TQListViewItem *lastQChild (TQListViewItem *pi)
280 for (TQListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling())
289 const int ncols = p->columns();
290 const int dir = forward ? +1 : -1;
291 const int restart = forward ? 0 : (ncols - 1);
292 TQListViewItem *top = (pitem && pitem->parent())
293 ? pitem->parent()->firstChild()
295 TQListViewItem *pi = pitem;
307 if ((column = nextCol(p, pi, column + dir, dir)) != -1 ||
308 (column = nextCol(p, (pi = (forward ? pi->nextSibling() : prevItem(pi))), restart, dir)) != -1 ||
309 (column = nextCol(p, (pi = (forward ? top : lastQChild(pitem))), restart, dir)) != -1)
313 p->setCurrentItem(pi);
335 bool TDEListViewLineEdit::event(TQEvent *pe)
337 if (pe->type() == TQEvent::KeyPress)
339 TQKeyEvent *k = (TQKeyEvent*)pe;
341 if (m_renSett.m_useRenameSignals &&
342 (m_renSett.m_SCNext.contains(kk) || m_renSett.m_SCPrev.contains(kk)))
347 else if ((k->key() == TQt::Key_Backtab || k->key() == TQt::Key_Tab) &&
349 !(k->state() & ControlButton || k->state() & AltButton))
351 selectNextCell(item, col, (k->key() == Key_Tab && !(k->state() & ShiftButton)));
355 return KLineEdit::event(pe);
361 if (m_renSett.m_useRenameSignals &&
362 (m_renSett.m_SCNext.contains(kk) || m_renSett.m_SCPrev.contains(kk)))
364 TQListViewItem *i=item;
368 if (m_renSett.m_SCNext.contains(kk))
377 else if (e->key() == TQt::Key_Return || e->key() == TQt::Key_Enter)
379 else if(e->key() == TQt::Key_Escape)
381 else if (e->key() == TQt::Key_Down || e->key() == TQt::Key_Up)
390 void TDEListViewLineEdit::terminate()
395 void TDEListViewLineEdit::terminate(
bool commit)
401 item->setText(col, text());
403 TQListViewItem *i=item;
415 TQFocusEvent * focusEv =
static_cast<TQFocusEvent*
>(ev);
417 if (focusEv->reason() != TQFocusEvent::Popup && focusEv->reason() != TQFocusEvent::ActiveWindow)
423 void TDEListViewLineEdit::paintEvent( TQPaintEvent *e )
425 KLineEdit::paintEvent( e );
429 p.setClipRegion( e->region() );
430 p.drawRect( rect() );
437 void TDEListViewLineEdit::slotSelectionChanged()
448 if (currentItem() != i)
458 : TQListView(parent, name), d(new TDEListViewPrivate(this))
460 setDragAutoScroll(
true);
462 connect(
this, TQ_SIGNAL( onViewport() ),
464 connect(
this, TQ_SIGNAL( onItem( TQListViewItem * ) ),
465 this, TQ_SLOT(
slotOnItem( TQListViewItem * ) ) );
467 connect (
this, TQ_SIGNAL(contentsMoving(
int,
int)),
469 connect (
this, TQ_SIGNAL(contentsMoving(
int,
int)),
476 kapp->addKipcEventMask( KIPC::SettingsChanged );
479 connect(&d->autoSelect, TQ_SIGNAL( timeout() ),
481 connect(&d->dragExpand, TQ_SIGNAL( timeout() ),
482 this, TQ_SLOT( slotDragExpand() ) );
485 if (d->showContextMenusOnPress)
487 connect (
this, TQ_SIGNAL (rightButtonPressed (TQListViewItem*,
const TQPoint&,
int)),
488 this, TQ_SLOT (
emitContextMenu (TQListViewItem*,
const TQPoint&,
int)));
492 connect (
this, TQ_SIGNAL (rightButtonClicked (TQListViewItem*,
const TQPoint&,
int)),
493 this, TQ_SLOT (
emitContextMenu (TQListViewItem*,
const TQPoint&,
int)));
508 TQListViewItem* item = itemAt( point );
523 if ( allColumnsShowFocus() ) {
528 int width = columnWidth( 0 );
530 TQHeader*
const thisHeader = header();
531 const int pos = thisHeader->mapToIndex( 0 );
533 for (
int index = 0; index < pos; ++index ) {
534 offset += columnWidth( thisHeader->mapToSection( index ) );
541 if ( item && d->useSmallExecuteArea ) {
542 width = treeStepSize()*( item->depth() + ( rootIsDecorated() ? 1 : 0 ) );
543 width += itemMargin();
544 int ca = AlignHorizontal_Mask & columnAlignment( 0 );
545 if ( ca == AlignLeft || ca == AlignAuto ) {
546 width += item->width( fontMetrics(),
this, 0 );
547 if ( width > columnWidth( 0 ) ) {
548 width = columnWidth( 0 );
553 if (!allColumnsShowFocus()) {
554 offset += treeStepSize()*( item->depth() + ( rootIsDecorated() ? 1 : 0 ) );
558 return ( x > offset && x < ( offset + width ) );
564 TQPoint vp = viewport()->mapFromGlobal( TQCursor::pos() );
565 if ( item &&
isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) {
566 d->autoSelect.start( d->autoSelectDelay,
true );
567 d->pCurrentItem = item;
573 if ( d->bChangeCursorOverItem )
574 viewport()->unsetCursor();
576 d->autoSelect.stop();
577 d->pCurrentItem = 0L;
584 case TDEApplication::SETTINGS_MOUSE:
588 disconnect(
this, TQ_SIGNAL (mouseButtonClicked (
int, TQListViewItem*,
const TQPoint &,
int)),
589 this, TQ_SLOT (slotMouseButtonClicked (
int, TQListViewItem*,
const TQPoint &,
int)));
592 connect (
this, TQ_SIGNAL (mouseButtonClicked (
int, TQListViewItem*,
const TQPoint &,
int)),
593 this, TQ_SLOT (slotMouseButtonClicked(
int, TQListViewItem*,
const TQPoint &,
int)));
596 if ( !d->disableAutoSelection )
599 if( !d->bUseSingle || !d->bChangeCursorOverItem )
600 viewport()->unsetCursor();
604 case TDEApplication::SETTINGS_POPUPMENU:
608 if (d->showContextMenusOnPress)
610 disconnect (0L, 0L,
this, TQ_SLOT (
emitContextMenu (TQListViewItem*,
const TQPoint&,
int)));
612 connect(
this, TQ_SIGNAL (rightButtonPressed (TQListViewItem*,
const TQPoint&,
int)),
613 this, TQ_SLOT (
emitContextMenu (TQListViewItem*,
const TQPoint&,
int)));
617 disconnect (0L, 0L,
this, TQ_SLOT (
emitContextMenu (TQListViewItem*,
const TQPoint&,
int)));
619 connect(
this, TQ_SIGNAL (rightButtonClicked (TQListViewItem*,
const TQPoint&,
int)),
620 this, TQ_SLOT (
emitContextMenu (TQListViewItem*,
const TQPoint&,
int)));
635 if (!isActiveWindow())
637 d->autoSelect.stop();
647 TQListViewItem* previousItem = currentItem();
648 setCurrentItem( d->pCurrentItem );
650 if( d->pCurrentItem ) {
652 if( (keybstate & TQt::ShiftButton) ) {
653 bool block = signalsBlocked();
654 blockSignals(
true );
657 if( !(keybstate & TQt::ControlButton) )
660 bool select = !d->pCurrentItem->isSelected();
661 bool update = viewport()->isUpdatesEnabled();
662 viewport()->setUpdatesEnabled(
false );
664 bool down = previousItem->itemPos() < d->pCurrentItem->itemPos();
665 TQListViewItemIterator lit( down ? previousItem : d->pCurrentItem );
666 for ( ; lit.current(); ++lit ) {
667 if ( down && lit.current() == d->pCurrentItem ) {
668 d->pCurrentItem->setSelected( select );
671 if ( !down && lit.current() == previousItem ) {
672 previousItem->setSelected( select );
675 lit.current()->setSelected( select );
678 blockSignals( block );
679 viewport()->setUpdatesEnabled( update );
682 emit selectionChanged();
684 if( selectionMode() == TQListView::Single )
685 emit selectionChanged( d->pCurrentItem );
687 else if( (keybstate & TDEApplication::ControlModifier) )
688 setSelected( d->pCurrentItem, !d->pCurrentItem->isSelected() );
690 bool block = signalsBlocked();
691 blockSignals(
true );
693 if( !d->pCurrentItem->isSelected() )
696 blockSignals( block );
698 setSelected( d->pCurrentItem,
true );
702 kdDebug() <<
"TDEListView::slotAutoSelect: That�s not supposed to happen!!!!" <<
endl;
708 const int colCount = columns();
709 if (d->fullWidth && colCount)
712 const int lastColumn = colCount - 1;
713 for (
int i = 0; i < lastColumn; ++i) w += columnWidth(i);
714 setColumnWidth( lastColumn, viewport()->width() - w - 1 );
724 if ( !d->bUseSingle )
726 viewport()->unsetCursor();
734 d->autoSelect.stop();
737 if( !( ((keybstate & TQt::ShiftButton) || (keybstate & TQt::ControlButton)) ) ) {
738 viewport()->unsetCursor();
749 TQListView::focusInEvent( fe );
750 if ((d->selectedBySimpleMove)
751 && (d->selectionMode == FileManager)
752 && (fe->reason()!=TQFocusEvent::Popup)
753 && (fe->reason()!=TQFocusEvent::ActiveWindow)
756 currentItem()->setSelected(
true);
757 currentItem()->repaint();
758 emit selectionChanged();
767 d->autoSelect.stop();
769 if ((d->selectedBySimpleMove)
770 && (d->selectionMode == FileManager)
771 && (fe->reason()!=TQFocusEvent::Popup)
772 && (fe->reason()!=TQFocusEvent::ActiveWindow)
774 && (!d->editor->isVisible()))
776 currentItem()->setSelected(
false);
777 currentItem()->repaint();
778 emit selectionChanged();
781 TQListView::focusOutEvent( fe );
786 d->autoSelect.stop();
788 TQListView::leaveEvent( e );
793 if (e->type() == TQEvent::ApplicationPaletteChange)
796 return TQListView::event(e);
801 if( (
selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) )
803 bool block = signalsBlocked();
804 blockSignals(
true );
808 blockSignals( block );
812 d->selectedBySimpleMove=
false;
813 d->selectedUsingMouse=
true;
816 currentItem()->setSelected(
false);
817 currentItem()->repaint();
822 TQPoint p( contentsToViewport( e->pos() ) );
823 TQListViewItem *at = itemAt (p);
826 bool rootDecoClicked = at
827 && ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) +
828 treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() )
829 && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) );
831 if (e->button() == TQt::LeftButton && !rootDecoClicked)
834 d->startDragPos = e->pos();
839 d->pressedOnSelected = at->isSelected();
843 TQListView::contentsMousePressEvent( e );
848 if (!
dragEnabled() || d->startDragPos.isNull() || !d->validDrag)
849 TQListView::contentsMouseMoveEvent (e);
851 TQPoint vp = contentsToViewport(e->pos());
852 TQListViewItem *item = itemAt( vp );
855 if ( item && d->bChangeCursorOverItem && d->bUseSingle )
858 if( (item != d->pCurrentItem) ||
863 if( d->cursorInExecuteArea )
866 viewport()->unsetCursor();
871 TQPoint newPos = e->pos();
872 if (dragOn && d->validDrag &&
873 (newPos.x() > d->startDragPos.x()+d->dragDelay ||
874 newPos.x() < d->startDragPos.x()-d->dragDelay ||
875 newPos.y() > d->startDragPos.y()+d->dragDelay ||
876 newPos.y() < d->startDragPos.y()-d->dragDelay))
879 TQListView::contentsMouseReleaseEvent( 0 );
881 d->startDragPos = TQPoint();
882 d->validDrag =
false;
888 if (e->button() == TQt::LeftButton)
893 TQPoint p( contentsToViewport( e->pos() ) );
894 TQListViewItem *at = itemAt (p);
898 bool rootDecoClicked =
899 ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) +
900 treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() )
901 && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) );
903 if (!rootDecoClicked)
905 int col = header()->mapToLogical( header()->cellAt( p.x() ) );
906 if ( d->renameable.contains(col) )
912 d->pressedOnSelected =
false;
913 d->validDrag =
false;
914 d->startDragPos = TQPoint();
916 TQListView::contentsMouseReleaseEvent( e );
924 if ( !e || e->button() != TQt::LeftButton ) {
928 TQPoint vp = contentsToViewport(e->pos());
929 TQListViewItem *item = itemAt( vp );
930 emit TQListView::doubleClicked( item );
932 int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1;
937 if( (e->button() == TQt::LeftButton) && !d->bUseSingle ) {
943 void TDEListView::slotMouseButtonClicked(
int btn, TQListViewItem *item,
const TQPoint &pos,
int c )
945 if( (btn == TQt::LeftButton) && item ) {
954 d->dragExpand.stop();
959 TQListViewItem *afterme;
960 TQListViewItem *parent;
962 findDrop(e->pos(), parent, afterme);
969 emit
dropped(
this, e, afterme);
970 emit
dropped(e, parent, afterme);
971 emit
dropped(
this, e, parent, afterme);
978 TQPtrList<TQListViewItem> items, afterFirsts, afterNows;
979 TQListViewItem *current=currentItem();
981 for (TQListViewItem *i = firstChild(), *iNext=0; i; i = iNext)
983 iNext=i->itemBelow();
984 if (!i->isSelected())
992 i->setSelected(
false);
994 TQListViewItem *afterFirst = i->itemAbove();
1006 emit
moved(i, afterFirst, afterme);
1009 afterFirsts.append (afterFirst);
1010 afterNows.append (afterme);
1015 for (TQListViewItem *i=items.first(); i; i=items.next() )
1016 i->setSelected(
true);
1018 setCurrentItem(current);
1020 emit
moved(items,afterFirsts,afterNows);
1030 event->acceptAction();
1033 findDrop(
event->pos(), d->parentItemDrop, d->afterItemDrop);
1034 TQPoint vp = contentsToViewport(
event->pos() );
1035 TQListViewItem *item =
isExecuteArea( vp ) ? itemAt( vp ) : 0L;
1037 if ( item != d->dragOverItem )
1039 d->dragExpand.stop();
1040 d->dragOverItem = item;
1041 d->dragOverPoint = vp;
1042 if ( d->dragOverItem && d->dragOverItem->isExpandable() && !d->dragOverItem->isOpen() )
1043 d->dragExpand.start( TQApplication::startDragTime(),
true );
1048 if (tmpRect != d->mOldDropVisualizer)
1051 d->mOldDropVisualizer=tmpRect;
1052 viewport()->repaint(tmpRect);
1058 if (tmpRect != d->mOldDropHighlighter)
1061 d->mOldDropHighlighter=tmpRect;
1062 viewport()->repaint(tmpRect);
1070 void TDEListView::slotDragExpand()
1072 if ( itemAt( d->dragOverPoint ) == d->dragOverItem )
1073 d->dragOverItem->setOpen(
true );
1078 d->dragExpand.stop();
1085 if (d->mOldDropVisualizer.isValid())
1087 TQRect rect=d->mOldDropVisualizer;
1088 d->mOldDropVisualizer = TQRect();
1089 viewport()->repaint(rect,
true);
1095 return treeStepSize() * ( depth + (rootIsDecorated() ? 1 : 0) ) + itemMargin();
1100 TQPoint p (contentsToViewport(pos));
1103 TQListViewItem *atpos = itemAt(p);
1105 TQListViewItem *above;
1111 if (p.y() - itemRect(atpos).topLeft().y() < (atpos->height()/2))
1112 above = atpos->itemAbove();
1121 if (above->firstChild() && above->isOpen())
1130 if (above->isExpandable())
1134 (above->isOpen() && above->childCount() > 0) )
1144 TQListViewItem * betterAbove = above->parent();
1145 TQListViewItem * last = above;
1146 while ( betterAbove )
1150 if ( !last->nextSibling() )
1153 above = betterAbove;
1157 betterAbove = betterAbove->parent();
1164 parent = after ? after->parent() : 0L ;
1169 TQListViewItem* lastchild = firstChild();
1172 for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling());
1181 for (TQListViewItemIterator it (last); it.current(); ++it)
1182 last = it.current();
1199 if (drag->drag() && drag->target() != viewport())
1209 return new TQStoredDrag(
"application/x-qlistviewitem", viewport());
1219 return d->itemsMovable;
1224 d->itemsRenameable=b;
1229 return d->itemsRenameable;
1240 return d->dragEnabled;
1255 return d->dropVisualizer;
1260 d->dropVisualizer=b;
1270 TQPtrList<TQListViewItem> list;
1276 switch(selectionMode())
1281 if(selectedItem() && (includeHiddenItems || selectedItem()->isVisible()))
1282 list.append(selectedItem());
1286 int flags = TQListViewItemIterator::Selected;
1287 if (!includeHiddenItems)
1289 flags |= TQListViewItemIterator::Visible;
1292 TQListViewItemIterator it(
const_cast<TDEListView *
>(
this), flags);
1294 for(; it.current(); ++it)
1295 list.append(it.current());
1308 TQListViewItem *i = parent;
1318 item->moveItem(after);
1325 item->parent()->takeItem(item);
1330 parent->insertItem(item);
1343 d->mDropVisualizerWidth = w > 0 ? w : 1;
1347 TQListViewItem *after)
1349 TQRect insertmarker;
1351 if (!after && !parent)
1352 insertmarker = TQRect (0, 0, viewport()->width(), d->mDropVisualizerWidth/2);
1358 TQListViewItem* it = 0L;
1359 if (after->isOpen())
1362 it = after->firstChild();
1364 while (it->nextSibling() || it->firstChild())
1365 if ( it->nextSibling() )
1366 it = it->nextSibling();
1368 it = it->firstChild();
1371 insertmarker = itemRect (it ? it : after);
1372 level = after->depth();
1376 insertmarker = itemRect (parent);
1377 level = parent->depth() + 1;
1379 insertmarker.setLeft( treeStepSize() * ( level + (rootIsDecorated() ? 1 : 0) ) + itemMargin() );
1380 insertmarker.setRight (viewport()->width());
1381 insertmarker.setTop (insertmarker.bottom() - d->mDropVisualizerWidth/2 + 1);
1382 insertmarker.setBottom (insertmarker.bottom() + d->mDropVisualizerWidth/2);
1388 p->fillRect(insertmarker, Dense4Pattern);
1390 return insertmarker;
1400 r.setLeft(r.left()+(item->depth()+(rootIsDecorated() ? 1 : 0))*treeStepSize());
1402 style().drawPrimitive(TQStyle::PE_FocusRect, painter, r, colorGroup(),
1403 TQStyle::Style_FocusAtBorder, colorGroup().highlight());
1411 if (d->mOldDropHighlighter.isValid())
1413 TQRect rect=d->mOldDropHighlighter;
1414 d->mOldDropHighlighter = TQRect();
1415 viewport()->repaint(rect,
true);
1421 if (d->renameable.contains(c))
1423 ensureItemVisible(item);
1424 d->editor->load(item,c);
1430 return d->renameable.contains(col);
1435 if (col>=header()->count())
return;
1437 d->renameable.remove(col);
1442 void TDEListView::doneEditing(TQListViewItem *item,
int row)
1448 void TDEListView::renameNextProxy(TQListViewItem *item,
int col)
1453 void TDEListView::renamePrevProxy(TQListViewItem *item,
int col)
1461 return acceptDrops() &&
itemsMovable() && (e->source()==viewport());
1466 d->createChildren=b;
1471 return d->createChildren;
1477 return d->tooltipColumn;
1482 d->tooltipColumn=column;
1487 d->dropHighlighter=b;
1492 return d->dropHighlighter;
1502 return item->text(column);
1512 return d->tabRename;
1518 if (e->key() == d->contextMenuKey)
1524 if (d->selectionMode != FileManager)
1525 TQListView::keyPressEvent (e);
1532 d->selectedBySimpleMove=
true;
1533 d->selectedUsingMouse=
false;
1536 currentItem()->setSelected(
true);
1537 currentItem()->repaint();
1538 emit selectionChanged();
1544 d->selectedBySimpleMove=
false;
1549 return d->selectedBySimpleMove;
1554 d->wasShiftEvent =
false;
1555 d->selectionDirection = 0;
1559 TQListViewItem* origItem = currentItem();
1560 if (!d->initialFileManagerItem) {
1561 d->initialFileManagerItem = origItem;
1563 setCurrentItem(item);
1569 int e_state=(e->state() & ~Keypad);
1572 if ((e->key()!=Key_Shift) && (e->key()!=Key_Control)
1573 && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)) {
1574 if ((e_state==ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove)) {
1576 d->selectionRegion = 0;
1577 d->initialFileManagerItem = NULL;
1579 d->selectionDirection=0;
1580 d->wasShiftEvent = (e_state == ShiftButton);
1585 TQListViewItem* item = currentItem();
1590 TQListViewItem* repaintItem1 = item;
1591 TQListViewItem* repaintItem2 = 0L;
1592 TQListViewItem* visItem = 0L;
1594 TQListViewItem* nextItem = 0L;
1597 bool shiftOrCtrl((e_state==ControlButton) || (e_state==ShiftButton));
1599 for (TQListViewItem *tmpItem=firstChild(); tmpItem; tmpItem=tmpItem->nextSibling()) {
1604 && (e_state==TQt::NoButton)
1605 && ((e->key()==Key_Down)
1606 || (e->key()==Key_Up)
1607 || (e->key()==Key_Next)
1608 || (e->key()==Key_Prior)
1609 || (e->key()==Key_Home)
1610 || (e->key()==Key_End))) {
1611 d->selectedBySimpleMove=
true;
1612 d->selectedUsingMouse=
false;
1615 d->selectedBySimpleMove=
false;
1618 bool emitSelectionChanged(
false);
1623 emitSelectionChanged=
true;
1628 if (d->selectedBySimpleMove) {
1629 d->selectedBySimpleMove=
false;
1631 item->setSelected(!item->isSelected());
1632 emitSelectionChanged=
true;
1637 if (d->selectedBySimpleMove) {
1638 d->selectedBySimpleMove=
false;
1639 if (!item->isSelected()) item->setSelected(
true);
1642 item->setSelected(!item->isSelected());
1645 nextItem=item->itemBelow();
1648 repaintItem2=nextItem;
1650 setCurrentItem(nextItem);
1652 d->selectionDirection=1;
1653 emitSelectionChanged=
true;
1657 nextItem=item->itemBelow();
1659 d->selectionDirection=1;
1660 d->selectedBySimpleMove=
false;
1661 if (!d->initialFileManagerItem) {
1662 d->initialFileManagerItem = item;
1663 item->setSelected(
true);
1665 nextItem->setSelected(
true);
1667 emitSelectionChanged=
true;
1668 d->selectionRegion=1;
1671 if (item == d->initialFileManagerItem) {
1672 item->setSelected(
true);
1674 nextItem->setSelected(
true);
1676 emitSelectionChanged=
true;
1677 d->selectionRegion=1;
1680 if (d->selectionRegion == 1) {
1682 nextItem->setSelected(
true);
1684 emitSelectionChanged=
true;
1686 else if (d->selectionRegion == -1) {
1687 item->setSelected(
false);
1688 emitSelectionChanged=
true;
1693 else if ((d->selectedBySimpleMove) && (nextItem)) {
1694 item->setSelected(
false);
1695 emitSelectionChanged=
true;
1699 if (d->selectedBySimpleMove) {
1700 nextItem->setSelected(
true);
1702 repaintItem2=nextItem;
1704 setCurrentItem(nextItem);
1709 nextItem=item->itemAbove();
1711 d->selectionDirection=-1;
1712 d->selectedBySimpleMove=
false;
1713 if (!d->initialFileManagerItem) {
1714 d->initialFileManagerItem = item;
1715 item->setSelected(
true);
1717 nextItem->setSelected(
true);
1719 emitSelectionChanged=
true;
1720 d->selectionRegion=-1;
1723 if (item == d->initialFileManagerItem) {
1724 item->setSelected(
true);
1726 nextItem->setSelected(
true);
1728 emitSelectionChanged=
true;
1729 d->selectionRegion=-1;
1732 if (d->selectionRegion == -1) {
1734 nextItem->setSelected(
true);
1736 emitSelectionChanged=
true;
1738 else if (d->selectionRegion == 1) {
1739 item->setSelected(
false);
1740 emitSelectionChanged=
true;
1745 else if ((d->selectedBySimpleMove) && (nextItem)) {
1746 item->setSelected(
false);
1747 emitSelectionChanged=
true;
1751 if (d->selectedBySimpleMove) {
1752 nextItem->setSelected(
true);
1754 repaintItem2=nextItem;
1756 setCurrentItem(nextItem);
1763 if (d->selectedBySimpleMove) {
1764 item->setSelected(
false);
1767 d->selectedBySimpleMove=
false;
1772 if (!d->initialFileManagerItem) {
1773 d->initialFileManagerItem = nextItem;
1774 nextItem->setSelected(
true);
1775 emitSelectionChanged=
true;
1776 d->selectionRegion=1;
1779 if (nextItem == d->initialFileManagerItem) {
1780 nextItem->setSelected(
true);
1781 emitSelectionChanged=
true;
1782 d->selectionRegion=1;
1785 if (d->selectionRegion == 1) {
1786 nextItem->setSelected(
true);
1787 emitSelectionChanged=
true;
1789 else if (d->selectionRegion == -1) {
1790 nextItem->setSelected(
false);
1791 emitSelectionChanged=
true;
1796 if (!nextItem->itemBelow()) {
1797 if (d->selectedBySimpleMove) {
1798 nextItem->setSelected(
true);
1800 repaintItem2=nextItem;
1802 setCurrentItem(nextItem);
1804 nextItem=nextItem->itemBelow();
1806 emitSelectionChanged=
true;
1812 if (d->selectedBySimpleMove) {
1813 item->setSelected(
false);
1816 d->selectedBySimpleMove=
false;
1821 if (!d->initialFileManagerItem) {
1822 d->initialFileManagerItem = nextItem;
1823 nextItem->setSelected(
true);
1824 emitSelectionChanged=
true;
1825 d->selectionRegion=-1;
1828 if (nextItem == d->initialFileManagerItem) {
1829 nextItem->setSelected(
true);
1830 emitSelectionChanged=
true;
1831 d->selectionRegion=-1;
1834 if (d->selectionRegion == -1) {
1835 nextItem->setSelected(
true);
1836 emitSelectionChanged=
true;
1838 else if (d->selectionRegion == 1) {
1839 nextItem->setSelected(
false);
1840 emitSelectionChanged=
true;
1845 if (!nextItem->itemAbove()) {
1846 if (d->selectedBySimpleMove) {
1847 nextItem->setSelected(
true);
1849 repaintItem2=nextItem;
1851 setCurrentItem(nextItem);
1853 nextItem=nextItem->itemAbove();
1855 emitSelectionChanged=
true;
1859 items=visibleHeight()/item->height();
1861 if (d->selectedBySimpleMove) {
1862 item->setSelected(
false);
1865 d->selectedBySimpleMove=
false;
1866 d->selectionDirection=1;
1869 for (
int i=0; i<items; i++) {
1871 if (!d->initialFileManagerItem) {
1872 d->initialFileManagerItem = nextItem;
1873 nextItem->setSelected(
true);
1874 emitSelectionChanged=
true;
1875 d->selectionRegion=1;
1878 if (nextItem == d->initialFileManagerItem) {
1879 nextItem->setSelected(
true);
1880 emitSelectionChanged=
true;
1881 d->selectionRegion=1;
1884 if (d->selectionRegion == 1) {
1885 nextItem->setSelected(
true);
1886 emitSelectionChanged=
true;
1888 else if (d->selectionRegion == -1) {
1890 nextItem->setSelected(
true);
1893 nextItem->setSelected(
false);
1895 emitSelectionChanged=
true;
1901 if ((i==items-1) || (!nextItem->itemBelow())) {
1902 if (d->selectedBySimpleMove) {
1903 nextItem->setSelected(
true);
1905 ensureItemVisible(nextItem);
1906 setCurrentItem(nextItem);
1908 if ((shiftOrCtrl) || (d->selectedBySimpleMove)) {
1909 emit selectionChanged();
1913 nextItem=nextItem->itemBelow();
1918 items=visibleHeight()/item->height();
1920 if (d->selectedBySimpleMove) {
1921 item->setSelected(
false);
1924 d->selectionDirection=-1;
1925 d->selectedBySimpleMove=
false;
1928 for (
int i=0; i<items; i++) {
1930 if (!d->initialFileManagerItem) {
1931 d->initialFileManagerItem = nextItem;
1932 nextItem->setSelected(
true);
1933 emitSelectionChanged=
true;
1934 d->selectionRegion=-1;
1937 if (nextItem == d->initialFileManagerItem) {
1938 nextItem->setSelected(
true);
1939 emitSelectionChanged=
true;
1940 d->selectionRegion=-1;
1943 if (d->selectionRegion == -1) {
1944 nextItem->setSelected(
true);
1945 emitSelectionChanged=
true;
1947 else if (d->selectionRegion == 1) {
1949 nextItem->setSelected(
true);
1952 nextItem->setSelected(
false);
1954 emitSelectionChanged=
true;
1960 if ((i==items-1) || (!nextItem->itemAbove())) {
1961 if (d->selectedBySimpleMove) {
1962 nextItem->setSelected(
true);
1964 ensureItemVisible(nextItem);
1965 setCurrentItem(nextItem);
1967 if ((shiftOrCtrl) || (d->selectedBySimpleMove)) {
1968 emit selectionChanged();
1972 nextItem=nextItem->itemAbove();
1977 if ( item->isOpen() ) {
1978 setOpen( item,
false );
1982 if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) {
1983 setOpen( item,
true );
1987 bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control)
1988 && (e->key()!=Key_Meta) && (e->key()!=Key_Alt));
1990 bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected());
1991 if (realKey && selectCurrentItem) {
1992 item->setSelected(
false);
1995 TQListView::SelectionMode oldSelectionMode = selectionMode();
1996 setSelectionMode (TQListView::Multi);
1997 TQListView::keyPressEvent (e);
1998 setSelectionMode (oldSelectionMode);
1999 if (realKey && selectCurrentItem) {
2000 currentItem()->setSelected(
true);
2001 emitSelectionChanged=
true;
2003 repaintItem2=currentItem();
2005 visItem=currentItem();
2011 ensureItemVisible(visItem);
2016 ir = ir.unite( itemRect(repaintItem1) );
2019 ir = ir.unite( itemRect(repaintItem2) );
2022 if ( !ir.isEmpty() ) {
2025 ir.moveBy( -ir.x(), 0 );
2027 viewport()->repaint( ir,
false );
2037 if (emitSelectionChanged) {
2038 emit selectionChanged();
2044 d->selectionMode = mode;
2052 setSelectionMode (
static_cast<TQListView::SelectionMode
>(
static_cast<int>(mode)));
2056 setSelectionMode (TQListView::Extended);
2060 kdWarning () <<
"Warning: illegal selection mode " << int(mode) <<
" set!" <<
endl;
2067 return d->selectionMode;
2075 if ( item == firstChild() )
2078 TQListViewItemIterator it(firstChild());
2080 for (; it.current() && it.current() != item; ++it, ++j );
2095 for (TQListViewItemIterator it=firstChild(); it.current(); ++it)
2098 return it.current();
2110 p = viewport()->mapToGlobal(itemRect(i).center());
2112 p = mapToGlobal(rect().center());
2124 TQListView::setAcceptDrops (val);
2125 viewport()->setAcceptDrops (val);
2130 return d->mDropVisualizerWidth;
2137 d->paintCurrent = 0;
2141 TQListView::viewportPaintEvent(e);
2143 if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer))
2145 TQPainter painter(viewport());
2148 painter.fillRect(d->mOldDropVisualizer, Dense4Pattern);
2150 if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter))
2152 TQPainter painter(viewport());
2155 style().drawPrimitive(TQStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(),
2156 TQStyle::Style_FocusAtBorder);
2158 d->painting =
false;
2169 header()->setStretchEnabled(
fullWidth, columns()-1);
2174 return d->fullWidth;
2179 int result = TQListView::addColumn(label, width);
2181 header()->setStretchEnabled(
false, columns()-2);
2182 header()->setStretchEnabled(
true, columns()-1);
2189 int result = TQListView::addColumn(iconset, label, width);
2191 header()->setStretchEnabled(
false, columns()-2);
2192 header()->setStretchEnabled(
true, columns()-1);
2199 TQListView::removeColumn(index);
2200 if (d->fullWidth && index == columns()) header()->setStretchEnabled(
true, columns()-1);
2205 TQListView::viewportResizeEvent(e);
2210 return d->alternateBackground;
2215 d->alternateBackground = c;
2227 return d->shadeSortColumn;
2233 TQStringList widths, order;
2235 const int colCount = columns();
2236 TQHeader*
const thisHeader = header();
2237 for (
int i = 0; i < colCount; ++i)
2239 widths << TQString::number(columnWidth(i));
2240 order << TQString::number(thisHeader->mapToIndex(i));
2244 config->
writeEntry(
"SortColumn", d->sortColumn);
2245 config->
writeEntry(
"SortAscending", d->sortAscending);
2254 TQStringList::ConstIterator it = cols.constBegin();
2255 const TQStringList::ConstIterator itEnd = cols.constEnd();
2256 for (; it != itEnd; ++it)
2257 setColumnWidth(i++, (*it).toInt());
2264 const int colCount = columns();
2265 for (i = 0; i < colCount; ++i)
2267 TQStringList::ConstIterator it = cols.constBegin();
2268 const TQStringList::ConstIterator itEnd = cols.constEnd();
2271 for (; (it != itEnd) && ((*it).toInt() != i); ++it, ++section) ;
2273 if ( it != itEnd ) {
2275 header()->moveSection(section, i);
2279 if (config->
hasKey(
"SortColumn"))
2285 TQListViewItem *selected = 0;
2287 if (selectionMode() == TQListView::Single) {
2288 selected = selectedItem();
2289 if (selected && !selected->isVisible())
2292 else if (selectionMode() != TQListView::NoSelection) {
2293 TQListViewItem *item = firstChild();
2294 while (item && !selected) {
2295 if (item->isSelected() && item->isVisible())
2297 item = item->itemBelow();
2301 d->sortColumn = column;
2302 d->sortAscending = ascending;
2303 TQListView::setSorting(column, ascending);
2306 ensureItemVisible(selected);
2308 TQListViewItem* item = firstChild();
2311 if (kItem) kItem->m_known =
false;
2312 item = item->itemBelow();
2318 return d->sortColumn;
2323 return d->sortAscending;
2328 if(item && item == d->editor->currentItem())
2329 d->editor->terminate();
2331 TQListView::takeItem(item);
2336 if ( d->disableAutoSelection )
2339 d->disableAutoSelection =
true;
2340 d->autoSelect.stop();
2341 d->autoSelectDelay = -1;
2346 if ( !d->disableAutoSelection )
2349 d->disableAutoSelection =
false;
2355 emit TQListView::doubleClicked( item, pos, c );
2359 : TQListViewItem(parent)
2365 : TQListViewItem(parent)
2371 : TQListViewItem(parent, after)
2377 : TQListViewItem(parent, after)
2383 TQString label1, TQString label2, TQString label3, TQString label4,
2384 TQString label5, TQString label6, TQString label7, TQString label8)
2385 : TQListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
2391 TQString label1, TQString label2, TQString label3, TQString label4,
2392 TQString label5, TQString label6, TQString label7, TQString label8)
2393 : TQListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
2399 TQString label1, TQString label2, TQString label3, TQString label4,
2400 TQString label5, TQString label6, TQString label7, TQString label8)
2401 : TQListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8)
2407 TQString label1, TQString label2, TQString label3, TQString label4,
2408 TQString label5, TQString label6, TQString label7, TQString label8)
2409 : TQListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8)
2414 TDEListViewItem::~TDEListViewItem()
2417 emit
static_cast<TDEListView *
>(listView())->itemRemoved(
this);
2420 void TDEListViewItem::init()
2422 m_odd = m_known =
false;
2424 setDragEnabled( dragEnabled() || lv->
dragEnabled() );
2425 emit lv->itemAdded(
this);
2428 void TDEListViewItem::insertItem(TQListViewItem *item)
2430 TQListViewItem::insertItem(item);
2432 emit
static_cast<TDEListView *
>(listView())->itemAdded(item);
2435 void TDEListViewItem::takeItem(TQListViewItem *item)
2437 TQListViewItem::takeItem(item);
2439 emit
static_cast<TDEListView *
>(listView())->itemRemoved(item);
2445 return static_cast< TDEListView*
>(listView())->alternateBackground();
2446 return listView()->viewport()->colorGroup().base();
2454 view->viewport()->colorGroup().base();
2459 if ( color == TQt::black )
2460 color = TQColor(55, 55, 55);
2464 color.hsv(&h, &s, &v);
2466 color = color.dark(104);
2468 color = color.light(120);
2482 TDEListView::TDEListViewPrivate*
const lvD = lv->d;
2501 if (lvD->painting) {
2502 if (lvD->paintCurrent !=
this)
2504 lvD->paintAbove = lvD->paintBelow ==
this ? lvD->paintCurrent : itemAbove();
2505 lvD->paintCurrent =
this;
2506 lvD->paintBelow = itemBelow();
2516 m_known = above ? above->m_known :
true;
2519 m_odd = above ? !above->m_odd :
false;
2524 bool previous =
true;
2529 previous = item->m_odd;
2539 previous = !previous;
2540 item->m_odd = previous;
2541 item->m_known =
true;
2550 void TDEListViewItem::paintCell(TQPainter *p,
const TQColorGroup &cg,
int column,
int width,
int alignment)
2552 TQColorGroup _cg = cg;
2553 TQListView* lv = listView();
2554 const TQPixmap *pm = lv->viewport()->backgroundPixmap();
2556 if (pm && !pm->isNull())
2558 _cg.setBrush(TQColorGroup::Base, TQBrush(
backgroundColor(column), *pm));
2559 TQPoint o = p->brushOrigin();
2560 p->setBrushOrigin( o.x()-lv->contentsX(), o.y()-lv->contentsY() );
2564 _cg.setColor((lv->viewport()->backgroundMode() == TQt::FixedColor) ?
2565 TQColorGroup::Background : TQColorGroup::Base,
2568 TQListViewItem::paintCell(p, _cg, column, width, alignment);
2581 bool b = signalsBlocked();
2582 blockSignals( TRUE );
2583 bool anything = FALSE;
2584 TQListViewItemIterator it(
this );
2585 while ( it.current() ) {
2586 TQListViewItem *i = it.current();
2587 if ( select == TRUE ) {
2588 if ( (
bool)i->isVisible() == TRUE ) {
2589 i->setSelected( TRUE );
2592 if ( (
bool)i->isVisible() == FALSE ) {
2593 i->setSelected( FALSE );
2598 if ( (
bool)i->isSelected() != select ) {
2599 i->setSelected( select );
2607 emit selectionChanged();
2611 }
else if ( currentItem() ) {
2612 TQListViewItem * i = currentItem();
2613 setSelected( i, select );
2619 d->useSmallExecuteArea = enable;
2624 return d->useSmallExecuteArea;
2629 d->editor->setRenameSettings(renSett);
2632 void TDEListView::virtual_hook(
int,
void* )
2635 #include "tdelistview.moc"
2636 #include "tdelistviewlineedit.moc"
static TQCursor handCursor()
Returns the proper hand cursor according to the current GUI style (static function).
An enhanced TQLineEdit widget for inputting text.
virtual void setText(const TQString &)
Re-implemented to enable text squeezing.
virtual void focusOutEvent(TQFocusEvent *)
Re-implemented for internal reasons.
virtual void keyPressEvent(TQKeyEvent *)
Re-implemented for internal reasons.
static ButtonState keyboardMouseState()
int readNumEntry(const TQString &pKey, int nDefault=0) const
bool readBoolEntry(const TQString &pKey, bool bDefault=false) const
int readListEntry(const TQString &pKey, TQStrList &list, char sep=',') const
bool hasKey(const TQString &key) const
void writeEntry(const TQString &pKey, const TQString &pValue, bool bPersistent=true, bool bGlobal=false, bool bNLS=false)
static bool showContextMenusOnPress()
static bool changeCursorOverIcon()
static TQColor alternateBackgroundColor()
static int autoSelectDelay()
static bool singleClick()
static int contextMenuKey()
static int dndEventDelay()
A listview item with support for alternate background colors.
bool isAlternate()
returns true if this item is to be drawn with the alternate background
const TQColor & backgroundColor() TDE_DEPRECATED
returns the background color for this item
TDEListViewItem(TQListView *parent)
constructors.
the editor for a TDEListView.
void selectNextCell(TQListViewItem *pi, int column, bool forward)
void renamePrev(TQListViewItem *item, int col)
This signal is emitted when item renaming is completed by a Shift+TAB.
void slotItemRemoved(TQListViewItem *i)
virtual void keyPressEvent(TQKeyEvent *e)
Re-implemented for internal reasons.
virtual void focusOutEvent(TQFocusEvent *)
Re-implemented for internal reasons.
void renameNext(TQListViewItem *item, int col)
This signal is emitted when item renaming is completed by a TAB.
This Widget extends the functionality of TQListView to honor the system wide settings for Single Clic...
void setTabOrderedRenaming(bool b)
Enable/disable tabbing between editable cells.
void setActiveMultiSelectItem(TQListViewItem *item)
In FileManager selection mode: set the current keyboard cursor selection item; e.g.
bool isRenameable(int column) const
void resetAutoSelection()
Reset AutoSelection to the system wide setting.
virtual void contentsMouseMoveEvent(TQMouseEvent *e)
Reimplemented for internal reasons.
void setUseSmallExecuteArea(bool enable)
virtual void removeColumn(int index)
Reimplemented for full width support.
int tooltipColumn() const
virtual void takeItem(TQListViewItem *i)
Reimplemented for internal reasons.
TQPtrList< TQListViewItem > selectedItems() const
virtual void contentsMouseReleaseEvent(TQMouseEvent *)
Reimplemented for internal reasons.
void setDropVisualizerWidth(int w)
Set the width of the (default) drop-visualizer.
virtual void contentsDropEvent(TQDropEvent *)
Reimplemented for internal reasons.
virtual void setTooltipColumn(int column)
Set which column should be used for automatic tooltips.
virtual int addColumn(const TQString &label, int width=-1)
Reimplemented for full width support.
void slotHeaderChanged()
Reacts to header changes in full width mode.
virtual void setAcceptDrops(bool)
Reimplemented for internal reasons.
bool createChildren() const TDE_DEPRECATED
For future expansions.
void aboutToMove()
Connect to this signal if you want to do some preprocessing before a move is made,...
bool dropVisualizer() const
virtual bool event(TQEvent *)
Reimplemented to reload the alternate background in palette changes.
bool fullWidth() const
Returns whether the last column is set to fit the available width.
TQListViewItem * itemAtIndex(int index)
Returns the item of index within the item tree or 0 if index doesn't exist in this list view.
void setFullWidth() TDE_DEPRECATED
void slotOnItem(TQListViewItem *item)
Accessory slot for AutoSelect.
void moved()
This signal is emitted when ever the user moves an item in the list via DnD.
void setSelectionModeExt(SelectionModeExt mode)
Set the selection mode.
void setAlternateBackground(const TQColor &c)
sets the alternate background background color.
void renamePrev(TQListViewItem *item, int col)
This signal is emitted when item renaming is completed by a Shift+TAB.
virtual void setItemsMovable(bool b)
Set whether items in the list view can be moved.
virtual void viewportResizeEvent(TQResizeEvent *e)
Reimplemented for setFullWidth()
virtual bool isExecuteArea(const TQPoint &point)
This function determines whether the given coordinates are within the execute area.
void slotOnViewport()
Accessory slot for AutoSelect/ChangeCursorOverItem.
void restoreLayout(TDEConfig *config, const TQString &group)
Reads the list view's layout from a TDEConfig group as stored with saveLayout.
virtual void setCreateChildren(bool b) TDE_DEPRECATED
For future expansions.
virtual void viewportPaintEvent(TQPaintEvent *)
Reimplemented for internal reasons.
SelectionModeExt
Possible selection modes.
virtual void findDrop(const TQPoint &pos, TQListViewItem *&parent, TQListViewItem *&after)
Where is the nearest TQListViewItem that I'm going to drop?
void setShadeSortColumn(bool shadeSortColumn)
Set to true if the currently sorted column should be drawn shaded.
virtual void movableDropEvent(TQListViewItem *parent, TQListViewItem *afterme)
Handle dropEvent when itemsMovable() is set to true.
TDEListView(TQWidget *parent=0, const char *name=0)
Constructor.
virtual void selectAll(bool select)
Override TQListView selectAll() so that filtered items are not selected.
virtual TQRect drawItemHighlighter(TQPainter *painter, TQListViewItem *item)
Paint the drag rectangle.
virtual void focusInEvent(TQFocusEvent *fe)
Reimplemented for internal reasons.
void slotAutoSelect()
Process AutoSelection.
void saveLayout(TDEConfig *config, const TQString &group) const
Saves the list view's layout (column widtsh, column order, sort column) to a TDEConfig group.
virtual void leaveEvent(TQEvent *e)
Reimplemented for internal reasons.
virtual bool acceptDrag(TQDropEvent *event) const
void emitExecute(TQListViewItem *item, const TQPoint &pos, int c)
Emit signal executed.
void executed(TQListViewItem *item)
This signal is emitted whenever the user executes an listview item.
void doubleClicked(TQListViewItem *item, const TQPoint &pos, int c)
bool automaticSelection() const
In FileManager selection mode: return whether it is currently in the mode where the current item is s...
TQListViewItem * lastChild() const
int dropVisualizerWidth() const
The dropVisualizerWidth defaults to 4.
virtual void setDropHighlighter(bool b)
Enable/Disable the drawing of a drop-highlighter (a rectangle around the item under the mouse cursor)...
void deactivateAutomaticSelection()
In FileManager selection mode: explicitly deactivate the mode in which the current item is automatica...
virtual TQDragObject * dragObject()
bool useSmallExecuteArea() const
void setRenameable(int column, bool yesno=true)
By default, if you called setItemsRenameable(true), only the first column is renameable.
virtual void contentsDragLeaveEvent(TQDragLeaveEvent *event)
Reimplemented for internal reasons.
void emitContextMenu(TQListViewItem *, const TQPoint &, int)
Emit the contextMenu signal.
virtual void setSorting(int column, bool ascending=true)
Reimplemented to remember the current sort column and order.
void cleanItemHighlighter()
Repaint the rect where I was drawing the drop rectangle.
int itemIndex(const TQListViewItem *item) const
Returns the index of item within the item tree or -1 if item doesn't exist in this list view.
virtual void setItemsRenameable(bool b)
Enables inplace-renaming of items.
virtual void contentsDragMoveEvent(TQDragMoveEvent *event)
Reimplemented for internal reasons.
void moveItem(TQListViewItem *item, TQListViewItem *parent, TQListViewItem *after)
Arbitrarily move item to parent, positioned immediately after item after.
bool ascendingSort(void) const
void cleanDropVisualizer()
Repaint the rect where I was drawing the drop line.
virtual void contentsDragEnterEvent(TQDragEnterEvent *)
Reimplemented for internal reasons.
virtual void rename(TQListViewItem *item, int c)
Rename column c of item.
void dropped(TQDropEvent *e, TQListViewItem *after)
This signal gets emitted whenever something acceptable is dropped onto the listview.
virtual void contentsMousePressEvent(TQMouseEvent *e)
Reimplemented for internal reasons.
void fileManagerKeyPressEvent(TQKeyEvent *)
A special keyPressEvent (for FileManager selection mode).
virtual void contentsMouseDoubleClickEvent(TQMouseEvent *e)
Reimplemented for internal reasons.
int columnSorted(void) const
void contextMenu(TDEListView *l, TQListViewItem *i, const TQPoint &p)
This signal is emitted whenever a context-menu should be shown for item i.
virtual void keyPressEvent(TQKeyEvent *)
Reimplemented for internal reasons.
const TQColor & alternateBackground() const
void renameNext(TQListViewItem *item, int col)
This signal is emitted when item renaming is completed by a TAB.
TQListViewItem * lastItem() const
void setRenameSettings(const TDEListViewRenameSettings &renSett)
Allows to set the rename settings for the TDEListViewLineEdit editor.
virtual bool showTooltip(TQListViewItem *item, const TQPoint &pos, int column) const
virtual void setDropVisualizer(bool b)
Enable/Disable the drawing of a drop-visualizer (a bar that shows where a dropped item would be inser...
virtual TQString tooltip(TQListViewItem *item, int column) const
bool dropHighlighter() const
bool itemsMovable() const
bool tabOrderedRenaming() const
Returns whether tab ordered renaming is enabled.
bool shadeSortColumn(void) const
See if the sort column should be drawn shaded.
virtual ~TDEListView()
Destructor.
void activateAutomaticSelection()
In FileManager selection mode: explicitly activate the mode in which the current item is automaticall...
SelectionModeExt selectionModeExt() const
KLineEdit * renameLineEdit() const
virtual void focusOutEvent(TQFocusEvent *fe)
Reimplemented for internal reasons.
void itemRenamed(TQListViewItem *item, const TQString &str, int col)
This signal gets emitted when an item is renamed via in-place renaming.
virtual void startDrag()
This method calls dragObject() and starts the drag.
bool itemsRenameable() const
void disableAutoSelection()
Disable AutoSelection.
void resetKeyboardSelectionOperation()
In FileManager selection mode: reset the keyboard selection operation; e.g.
void menuShortCutPressed(TDEListView *list, TQListViewItem *item)
This signal is emitted when the shortcut key for popup-menus is pressed.
virtual void setDragEnabled(bool b)
Enable/Disable the dragging of items.
virtual TQRect drawDropVisualizer(TQPainter *p, TQListViewItem *parent, TQListViewItem *after)
Paint the drag line.
void slotSettingsChanged(int)
Update internal settings whenever the global ones change.
int depthToPixels(int depth)
Convert the depth of an item into its indentation in pixels.
virtual void setAutoOpen(bool b)
Enable/Disable AutoOpen (not implemented currently).
kndbgstream & endl(kndbgstream &s)
kdbgstream kdWarning(int area=0)
kdbgstream kdDebug(int area=0)
const TDEShortcut & home()