|
|
@ -173,7 +173,7 @@ ThumbBarView::ThumbBarView(TQWidget* parent, int orientation, bool exifRotate,
|
|
|
|
setFrameStyle(TQFrame::NoFrame);
|
|
|
|
setFrameStyle(TQFrame::NoFrame);
|
|
|
|
setAcceptDrops(true);
|
|
|
|
setAcceptDrops(true);
|
|
|
|
|
|
|
|
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setHScrollBarMode(TQScrollView::AlwaysOff);
|
|
|
|
setHScrollBarMode(TQScrollView::AlwaysOff);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -204,7 +204,7 @@ void ThumbBarView::resizeEvent(TQResizeEvent* e)
|
|
|
|
|
|
|
|
|
|
|
|
TQScrollView::resizeEvent(e);
|
|
|
|
TQScrollView::resizeEvent(e);
|
|
|
|
|
|
|
|
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->tileSize = width() - 2*d->margin - verticalScrollBar()->sizeHint().width();
|
|
|
|
d->tileSize = width() - 2*d->margin - verticalScrollBar()->sizeHint().width();
|
|
|
|
verticalScrollBar()->setLineStep(d->tileSize);
|
|
|
|
verticalScrollBar()->setLineStep(d->tileSize);
|
|
|
@ -345,7 +345,7 @@ ThumbBarItem* ThumbBarView::findItem(const TQPoint& pos) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int itemPos;
|
|
|
|
int itemPos;
|
|
|
|
|
|
|
|
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
itemPos = pos.y();
|
|
|
|
itemPos = pos.y();
|
|
|
|
else
|
|
|
|
else
|
|
|
|
itemPos = pos.x();
|
|
|
|
itemPos = pos.x();
|
|
|
@ -403,7 +403,7 @@ void ThumbBarView::ensureItemVisible(ThumbBarItem* item)
|
|
|
|
// We want the complete thumb visible and the next one.
|
|
|
|
// We want the complete thumb visible and the next one.
|
|
|
|
// find the middle of the image and give a margin of 1,5 image
|
|
|
|
// find the middle of the image and give a margin of 1,5 image
|
|
|
|
// When changed, watch regression for bug 104031
|
|
|
|
// When changed, watch regression for bug 104031
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
ensureVisible(0, (int)(item->d->pos + d->margin + d->tileSize*.5),
|
|
|
|
ensureVisible(0, (int)(item->d->pos + d->margin + d->tileSize*.5),
|
|
|
|
0, (int)(d->tileSize*1.5 + 3*d->margin));
|
|
|
|
0, (int)(d->tileSize*1.5 + 3*d->margin));
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -455,7 +455,7 @@ void ThumbBarView::viewportPaintEvent(TQPaintEvent* e)
|
|
|
|
TQPixmap bgPix, tile;
|
|
|
|
TQPixmap bgPix, tile;
|
|
|
|
TQRect er(e->rect());
|
|
|
|
TQRect er(e->rect());
|
|
|
|
|
|
|
|
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cy = viewportToContents(er.topLeft()).y();
|
|
|
|
cy = viewportToContents(er.topLeft()).y();
|
|
|
|
|
|
|
|
|
|
|
@ -484,7 +484,7 @@ void ThumbBarView::viewportPaintEvent(TQPaintEvent* e)
|
|
|
|
|
|
|
|
|
|
|
|
for (ThumbBarItem *item = d->firstItem; item; item = item->d->next)
|
|
|
|
for (ThumbBarItem *item = d->firstItem; item; item = item->d->next)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (y1 <= item->d->pos && item->d->pos <= y2)
|
|
|
|
if (y1 <= item->d->pos && item->d->pos <= y2)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -540,7 +540,7 @@ void ThumbBarView::viewportPaintEvent(TQPaintEvent* e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
bitBlt(viewport(), 0, er.y(), &bgPix);
|
|
|
|
bitBlt(viewport(), 0, er.y(), &bgPix);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
bitBlt(viewport(), er.x(), 0, &bgPix);
|
|
|
|
bitBlt(viewport(), er.x(), 0, &bgPix);
|
|
|
@ -570,7 +570,7 @@ void ThumbBarView::contentsMouseMoveEvent(TQMouseEvent *e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!e) return;
|
|
|
|
if (!e) return;
|
|
|
|
|
|
|
|
|
|
|
|
if (d->dragging && (e->state() & Qt::LeftButton))
|
|
|
|
if (d->dragging && (e->state() & TQt::LeftButton))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( findItem(d->dragStartPos) &&
|
|
|
|
if ( findItem(d->dragStartPos) &&
|
|
|
|
(d->dragStartPos - e->pos()).manhattanLength() > TQApplication::startDragDistance() )
|
|
|
|
(d->dragStartPos - e->pos()).manhattanLength() > TQApplication::startDragDistance() )
|
|
|
@ -600,14 +600,14 @@ void ThumbBarView::contentsWheelEvent(TQWheelEvent *e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (e->state() & TQt::ShiftButton)
|
|
|
|
if (e->state() & TQt::ShiftButton)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
scrollBy(0, verticalScrollBar()->pageStep());
|
|
|
|
scrollBy(0, verticalScrollBar()->pageStep());
|
|
|
|
else
|
|
|
|
else
|
|
|
|
scrollBy(horizontalScrollBar()->pageStep(), 0);
|
|
|
|
scrollBy(horizontalScrollBar()->pageStep(), 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
scrollBy(0, verticalScrollBar()->lineStep());
|
|
|
|
scrollBy(0, verticalScrollBar()->lineStep());
|
|
|
|
else
|
|
|
|
else
|
|
|
|
scrollBy(horizontalScrollBar()->lineStep(), 0);
|
|
|
|
scrollBy(horizontalScrollBar()->lineStep(), 0);
|
|
|
@ -618,14 +618,14 @@ void ThumbBarView::contentsWheelEvent(TQWheelEvent *e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (e->state() & TQt::ShiftButton)
|
|
|
|
if (e->state() & TQt::ShiftButton)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
scrollBy(0, (-1)*verticalScrollBar()->pageStep());
|
|
|
|
scrollBy(0, (-1)*verticalScrollBar()->pageStep());
|
|
|
|
else
|
|
|
|
else
|
|
|
|
scrollBy((-1)*horizontalScrollBar()->pageStep(), 0);
|
|
|
|
scrollBy((-1)*horizontalScrollBar()->pageStep(), 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
scrollBy(0, (-1)*verticalScrollBar()->lineStep());
|
|
|
|
scrollBy(0, (-1)*verticalScrollBar()->lineStep());
|
|
|
|
else
|
|
|
|
else
|
|
|
|
scrollBy((-1)*horizontalScrollBar()->lineStep(), 0);
|
|
|
|
scrollBy((-1)*horizontalScrollBar()->lineStep(), 0);
|
|
|
@ -736,7 +736,7 @@ void ThumbBarView::rearrangeItems()
|
|
|
|
item = item->d->next;
|
|
|
|
item = item->d->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
resizeContents(visibleWidth(), d->count*(d->tileSize+2*d->margin));
|
|
|
|
resizeContents(visibleWidth(), d->count*(d->tileSize+2*d->margin));
|
|
|
|
else
|
|
|
|
else
|
|
|
|
resizeContents(d->count*(d->tileSize+2*d->margin), visibleHeight());
|
|
|
|
resizeContents(d->count*(d->tileSize+2*d->margin), visibleHeight());
|
|
|
@ -763,7 +763,7 @@ void ThumbBarView::repaintItem(ThumbBarItem* item)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (item)
|
|
|
|
if (item)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (d->orientation ==Qt::Vertical)
|
|
|
|
if (d->orientation ==TQt::Vertical)
|
|
|
|
repaintContents(0, item->d->pos, visibleWidth(), d->tileSize+2*d->margin);
|
|
|
|
repaintContents(0, item->d->pos, visibleWidth(), d->tileSize+2*d->margin);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
repaintContents(item->d->pos, 0, d->tileSize+2*d->margin, visibleHeight());
|
|
|
|
repaintContents(item->d->pos, 0, d->tileSize+2*d->margin, visibleHeight());
|
|
|
|