~ubuntu-branches/ubuntu/lucid/lastfm/lucid

« back to all changes in this revision

Viewing changes to src/SideBarTreeStyle.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Devid Filoni
  • Date: 2008-07-14 16:46:20 UTC
  • mfrom: (1.1.7 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080714164620-67hoz9fs177wpgmr
Tags: 1:1.5.1.31879.dfsg-1ubuntu1
* Merge from Debian unstable (LP: #248100), remaining changes:
  - debian/rules: add dh_icons call
  + debian/control:
    - switch iceweasel to firefox in Recommends field
    - modify debhelper version to >= 5.0.51~
    - modify Maintainer to Ubuntu MOTU Developers

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *   Free Software Foundation, Inc.,                                       *
19
19
 *   51 Franklin Steet, Fifth Floor, Boston, MA  02110-1301, USA.          *
20
20
 ***************************************************************************/
21
 
 
22
 
#include <QPainter>
23
 
#include <QStyleOption>
24
 
#include <QWidget>
25
 
#include <QDebug>
26
 
#include "SideBarTreeStyle.h"
27
 
 
28
 
void
29
 
TreeStyle::drawPrimitive( PrimitiveElement element, 
30
 
                          const QStyleOption* option,
31
 
                          QPainter* painter,
32
 
                          const QWidget* widget ) const
33
 
{
34
 
        if (element == PE_IndicatorBranch)
35
 
        {
36
 
                static const int decoration_size = 9;
37
 
                int mid_h = option->rect.x() + option->rect.width() / 2;
38
 
                int mid_v = option->rect.y() + option->rect.height() / 2;
39
 
                int bef_h = mid_h;
40
 
                int bef_v = mid_v;
41
 
                int aft_h = mid_h;
42
 
                int aft_v = mid_v;
43
 
                if (option->state & State_Children)
44
 
                {
45
 
                        int delta = decoration_size / 2;
46
 
                        bef_h -= delta;
47
 
                        bef_v -= delta;
48
 
                        aft_h += delta;
49
 
                        aft_v += delta;
50
 
            painter->setPen(option->palette.dark().color());
51
 
                        painter->drawLine(bef_h + 2, bef_v + 4, bef_h + 6, bef_v + 4);
52
 
                        if (!(option->state & State_Open))
53
 
                        {
54
 
                                painter->drawLine(bef_h + 4, bef_v + 2, bef_h + 4, bef_v + 6);
55
 
                        }
56
 
                        QPen oldPen = painter->pen();
57
 
                        painter->drawRect(bef_h, bef_v, decoration_size - 1, decoration_size - 1);
58
 
                        painter->setPen(oldPen);
59
 
                }
60
 
        }
61
 
        else
62
 
                QWindowsStyle::drawPrimitive(element, option, painter, widget);
63
 
}