summaryrefslogtreecommitdiffstats
path: root/ksquirrel/sq_filethumbviewitem.cpp
blob: 99a7a6872d4f829a8dae4db404a155845450c018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/***************************************************************************
                          sq_filethumbviewitem.cpp  -  description
                             -------------------
    begin                : ??? ??? 12 2004
    copyright            : (C) 2004 by Baryshev Dmitry
    email                : ksquirrel.iv@gmail.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <tqstring.h>
#include <tqpainter.h>

#include <kwordwrap.h>

#include "sq_filethumbviewitem.h"

SQ_FileThumbViewItem::SQ_FileThumbViewItem(TQIconView *parent, const TQString &text, const TQPixmap &pixmap, KFileItem *fi):
    KFileIconViewItem(parent, text, pixmap, fi), m_listed(false)
{}

SQ_FileThumbViewItem::~SQ_FileThumbViewItem()
{}

void SQ_FileThumbViewItem::paintItem(TQPainter *p, const TQColorGroup &cg)
{
    KIconViewItem::paintPixmap(p, cg);
    paintText(p, cg);
}

void SQ_FileThumbViewItem::paintText(TQPainter *p, const TQColorGroup &cg)
{
    TQRect rectText = textRect(false);
    TQRect rc = pixmapRect(false);

    rectText.setX(rc.x());
    rectText.setWidth(rc.width()-2);

    if(isSelected())
    {
        p->fillRect(rectText, cg.highlight());
        p->setPen(TQPen(cg.highlightedText()));
    }
    else
    {
        if(iconView()->itemTextBackground() != Qt::NoBrush)
            p->fillRect(rectText, iconView()->itemTextBackground());

        p->setPen(cg.text());
    }

    wordWrap()->drawText(p, textRect(false).x(), textRect(false).y(), AlignCenter);
}

void SQ_FileThumbViewItem::paintFocus(TQPainter *, const TQColorGroup &)
{}