summaryrefslogtreecommitdiff
path: root/libopie2/opieui/oversatileviewitem.cpp
Unidiff
Diffstat (limited to 'libopie2/opieui/oversatileviewitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/oversatileviewitem.cpp132
1 files changed, 132 insertions, 0 deletions
diff --git a/libopie2/opieui/oversatileviewitem.cpp b/libopie2/opieui/oversatileviewitem.cpp
new file mode 100644
index 0000000..379ce24
--- a/dev/null
+++ b/libopie2/opieui/oversatileviewitem.cpp
@@ -0,0 +1,132 @@
1/*
2                 This file is part of the Opie Project
3
4 =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 .=l.
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28
29*/
30
31#include <opie2/oversatileviewitem.h>
32#include <opie2/oversatileview.h>
33
34OVersatileViewItem::OVersatileViewItem( OVersatileView * parent )
35 :OListViewItem( parent->_listview ), QIconViewItem( parent->_iconview ),
36 _versatileview( parent )
37{
38 init();
39}
40
41OVersatileViewItem::OVersatileViewItem( OVersatileView * parent, OVersatileViewItem * after )
42 :OListViewItem( parent->_listview, after ), QIconViewItem( parent->_iconview, after ),
43 _versatileview( parent )
44{
45 init();
46}
47
48OVersatileViewItem::OVersatileViewItem( OVersatileView * parent,
49 QString a, QString b, QString c, QString d,
50 QString e, QString f, QString g, QString h )
51 :OListViewItem( parent->_listview, a, b, c, d, e, f, g, h ),
52 QIconViewItem( parent->_iconview, a ),
53 _versatileview( parent )
54{
55 init();
56}
57
58OVersatileViewItem::OVersatileViewItem( OVersatileView * parent, OVersatileViewItem* after,
59 QString a, QString b, QString c, QString d,
60 QString e, QString f, QString g, QString h )
61 :OListViewItem( parent->_listview, after, a, b, c, d, e, f, g, h ),
62 QIconViewItem( parent->_iconview, after, a ),
63 _versatileview( parent )
64{
65 init();
66}
67
68OVersatileViewItem::OVersatileViewItem( OVersatileViewItem * parent,
69 QString a, QString b, QString c, QString d,
70 QString e, QString f, QString g, QString h )
71 :OListViewItem( parent, a, b, c, d, e, f, g, h ),
72 QIconViewItem( parent->_versatileview->_iconview, a ),
73 _versatileview( parent->_versatileview )
74{
75 init();
76}
77
78OVersatileViewItem::OVersatileViewItem( OVersatileViewItem * parent, OVersatileViewItem* after,
79 QString a, QString b, QString c, QString d,
80 QString e, QString f, QString g, QString h )
81 :OListViewItem( parent, after, a, b, c, d, e, f, g, h ),
82 QIconViewItem( parent->_versatileview->_iconview, after, a ),
83 _versatileview( parent->_versatileview )
84{
85 init();
86}
87
88OVersatileViewItem::~OVersatileViewItem()
89{
90}
91
92OVersatileView* OVersatileViewItem::versatileView() const
93{
94 return _versatileview;
95}
96
97void OVersatileViewItem::init()
98{
99 if ( not firstChild() )
100 {
101 // I'm a sweet yellow and browne autumn leaf
102
103 OListViewItem::setPixmap( 0, _versatileview->_treeleaf );
104 QIconViewItem::setPixmap( _versatileview->_iconleaf );
105 }
106 else
107 {
108 // I'm a node and I have a little baby child
109
110 if ( isOpen() )
111 {
112 OListViewItem::setPixmap( 0, _versatileview->_treeopened );
113 QIconViewItem::setPixmap( _versatileview->_iconopened );
114 }
115 else
116 {
117 OListViewItem::setPixmap( 0, _versatileview->_treeclosed );
118 QIconViewItem::setPixmap( _versatileview->_iconclosed );
119 }
120 }
121
122}
123
124void OVersatileViewItem::setRenameEnabled( bool allow )
125{
126 #if (QT_VERSION >= 0x030000)
127 OListViewItem::setRenameEnabled( 0, allow ); // TODO: Backport to Qt-Embedded 2.x?
128 #endif
129 QIconViewItem::setRenameEnabled( allow );
130}
131
132