|
|
@ -5313,8 +5313,9 @@ void TQIconView::keyPressEvent( TQKeyEvent *e )
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
Finds the closest item in the direction \a dir starting from the specified \a fromItem.
|
|
|
|
Finds the closest item in the direction \a dir starting from the specified \a fromItem.
|
|
|
|
If the arrangement is LeftToRight (icon view mode): use center as item reference
|
|
|
|
If the arrangement is LeftToRight (icon view mode): use (center, top) as item reference
|
|
|
|
If the arrangement is TopToBottom (multicolumn view mode): use left top corner as item reference
|
|
|
|
If the arrangement is TopToBottom (multicolumn view mode): use (left, top) as item reference
|
|
|
|
|
|
|
|
This is to allow for smooth scrolling when using the keyboard arrow keys.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
TQIconViewItem* TQIconView::findItem(Direction dir, const TQIconViewItem *fromItem) const
|
|
|
|
TQIconViewItem* TQIconView::findItem(Direction dir, const TQIconViewItem *fromItem) const
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -5322,12 +5323,9 @@ TQIconViewItem* TQIconView::findItem(Direction dir, const TQIconViewItem *fromIt
|
|
|
|
int distPri=0, distSec=0;
|
|
|
|
int distPri=0, distSec=0;
|
|
|
|
int itemDistancePri=0, itemDistanceSec=0;
|
|
|
|
int itemDistancePri=0, itemDistanceSec=0;
|
|
|
|
|
|
|
|
|
|
|
|
TQPoint pos;
|
|
|
|
TQPoint pos=fromItem->rect().topLeft();
|
|
|
|
if (d->arrangement == LeftToRight) {
|
|
|
|
if (d->arrangement == LeftToRight) {
|
|
|
|
pos=fromItem->rect().center();
|
|
|
|
pos.setX(fromItem->rect().center().x());
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
pos=fromItem->rect().topLeft();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQRect searchRect;
|
|
|
|
TQRect searchRect;
|
|
|
@ -5359,16 +5357,16 @@ TQIconViewItem* TQIconView::findItem(Direction dir, const TQIconViewItem *fromIt
|
|
|
|
// DirDown/DirUp : primary distance X, secondary distance Y
|
|
|
|
// DirDown/DirUp : primary distance X, secondary distance Y
|
|
|
|
// DirLeft/DirRight: primary distance Y, secondary distance X
|
|
|
|
// DirLeft/DirRight: primary distance Y, secondary distance X
|
|
|
|
if (d->arrangement == LeftToRight) {
|
|
|
|
if (d->arrangement == LeftToRight) {
|
|
|
|
// Left to right arrangement (icon view mode): use center as item reference
|
|
|
|
// Left to right arrangement (icon view mode): use (center, top) as item reference
|
|
|
|
switch (dir) {
|
|
|
|
switch (dir) {
|
|
|
|
case DirDown:
|
|
|
|
case DirDown:
|
|
|
|
if (ir.center().x() > pos.x()) {
|
|
|
|
if (ir.center().x() > pos.x()) {
|
|
|
|
distPri = ir.center().x()-pos.x();
|
|
|
|
distPri = ir.center().x()-pos.x();
|
|
|
|
distSec = ir.center().y();
|
|
|
|
distSec = ir.top();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ir.center().x() == pos.x() && ir.center().y() > pos.y()) {
|
|
|
|
else if (ir.center().x() == pos.x() && ir.top() > pos.y()) {
|
|
|
|
distPri = 0;
|
|
|
|
distPri = 0;
|
|
|
|
distSec = ir.center().y()-pos.y();
|
|
|
|
distSec = ir.top()-pos.y();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
itemOK = false;
|
|
|
|
itemOK = false;
|
|
|
@ -5378,11 +5376,11 @@ TQIconViewItem* TQIconView::findItem(Direction dir, const TQIconViewItem *fromIt
|
|
|
|
case DirUp:
|
|
|
|
case DirUp:
|
|
|
|
if (ir.center().x() < pos.x()) {
|
|
|
|
if (ir.center().x() < pos.x()) {
|
|
|
|
distPri = pos.x()-ir.center().x();
|
|
|
|
distPri = pos.x()-ir.center().x();
|
|
|
|
distSec = contentsHeight()-ir.center().y();
|
|
|
|
distSec = contentsHeight()-ir.top();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ir.center().x() == pos.x() && ir.center().y() < pos.y()) {
|
|
|
|
else if (ir.center().x() == pos.x() && ir.top() < pos.y()) {
|
|
|
|
distPri = 0;
|
|
|
|
distPri = 0;
|
|
|
|
distSec = pos.y()-ir.center().y();
|
|
|
|
distSec = pos.y()-ir.top();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
itemOK = false;
|
|
|
|
itemOK = false;
|
|
|
@ -5390,11 +5388,11 @@ TQIconViewItem* TQIconView::findItem(Direction dir, const TQIconViewItem *fromIt
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case DirRight:
|
|
|
|
case DirRight:
|
|
|
|
if (ir.center().y() > pos.y()) {
|
|
|
|
if (ir.top() > pos.y()) {
|
|
|
|
distPri = ir.center().y()-pos.y();
|
|
|
|
distPri = ir.top()-pos.y();
|
|
|
|
distSec = ir.center().x();
|
|
|
|
distSec = ir.center().x();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ir.center().y() == pos.y() && ir.center().x() > pos.x()) {
|
|
|
|
else if (ir.top() == pos.y() && ir.center().x() > pos.x()) {
|
|
|
|
distPri = 0;
|
|
|
|
distPri = 0;
|
|
|
|
distSec = ir.center().x()-pos.x();
|
|
|
|
distSec = ir.center().x()-pos.x();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -5404,11 +5402,11 @@ TQIconViewItem* TQIconView::findItem(Direction dir, const TQIconViewItem *fromIt
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case DirLeft:
|
|
|
|
case DirLeft:
|
|
|
|
if (ir.center().y() < pos.y()) {
|
|
|
|
if (ir.top() < pos.y()) {
|
|
|
|
distPri = pos.y()-ir.center().y();
|
|
|
|
distPri = pos.y()-ir.top();
|
|
|
|
distSec = contentsWidth()-ir.center().x();
|
|
|
|
distSec = contentsWidth()-ir.center().x();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ir.center().y() == pos.y() && ir.center().x() < pos.x()) {
|
|
|
|
else if (ir.top() == pos.y() && ir.center().x() < pos.x()) {
|
|
|
|
distPri = 0;
|
|
|
|
distPri = 0;
|
|
|
|
distSec = pos.x()-ir.center().x();
|
|
|
|
distSec = pos.x()-ir.center().x();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -5423,7 +5421,7 @@ TQIconViewItem* TQIconView::findItem(Direction dir, const TQIconViewItem *fromIt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
// Top to bottom arrangement (multicolumn view mode): use left top corner as item reference
|
|
|
|
// Top to bottom arrangement (multicolumn view mode): use (left, top) as item reference
|
|
|
|
switch (dir) {
|
|
|
|
switch (dir) {
|
|
|
|
case DirDown:
|
|
|
|
case DirDown:
|
|
|
|
if (ir.left() > pos.x()) {
|
|
|
|
if (ir.left() > pos.x()) {
|
|
|
|