Diffstat (limited to 'noncore/net/wellenreiter/cornucopia/olistview.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/cornucopia/olistview.h | 237 |
1 files changed, 0 insertions, 237 deletions
diff --git a/noncore/net/wellenreiter/cornucopia/olistview.h b/noncore/net/wellenreiter/cornucopia/olistview.h deleted file mode 100644 index 8911e22..0000000 --- a/noncore/net/wellenreiter/cornucopia/olistview.h +++ b/dev/null | |||
@@ -1,237 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) 2003 Michael 'Mickey' Lauer | ||
5 | <mickey@tm.informatik.uni-frankfurt.de> | ||
6 | =. | ||
7 | .=l. | ||
8 | .>+-= | ||
9 | _;:, .> :=|. This program is free software; you can | ||
10 | .> <`_, > . <= redistribute it and/or modify it under | ||
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
12 | .="- .-=="i, .._ License as published by the Free Software | ||
13 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
14 | ._= =} : or (at your option) any later version. | ||
15 | .%`+i> _;_. | ||
16 | .i_,=:_. -<s. This program is distributed in the hope that | ||
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
18 | : .. .:, . . . without even the implied warranty of | ||
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
21 | ..}^=.= = ; Library General Public License for more | ||
22 | ++= -. .` .: details. | ||
23 | : = ...= . :.=- | ||
24 | -. .:....=;==+<; You should have received a copy of the GNU | ||
25 | -_. . . )=. = Library General Public License along with | ||
26 | -- :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
29 | Boston, MA 02111-1307, USA. | ||
30 | |||
31 | */ | ||
32 | |||
33 | #ifndef OLISTVIEW_H | ||
34 | #define OLISTVIEW_H | ||
35 | |||
36 | #include <qcolor.h> | ||
37 | #include <qlistview.h> | ||
38 | #include <qpen.h> | ||
39 | #include <qdatastream.h> | ||
40 | |||
41 | class OListViewItem; | ||
42 | |||
43 | /** | ||
44 | * A @ref QListView variant featuring visual and functional enhancements | ||
45 | * like an alternate background for odd rows, an autostretch mode | ||
46 | * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. | ||
47 | * | ||
48 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
49 | * @short OListView list/tree widget. | ||
50 | */ | ||
51 | class OListView: public QListView | ||
52 | { | ||
53 | public: | ||
54 | /** | ||
55 | * Constructor. | ||
56 | * | ||
57 | * The parameters @p parent and @p name are handled by | ||
58 | * @ref QListView, as usual. | ||
59 | */ | ||
60 | OListView ( QWidget *parent = 0, const char *name = 0 ); | ||
61 | |||
62 | /** | ||
63 | * Destructor. | ||
64 | */ | ||
65 | virtual ~OListView(); | ||
66 | |||
67 | /** | ||
68 | * Let the last column fit exactly all the available width. | ||
69 | */ | ||
70 | void setFullWidth( bool fullWidth ); | ||
71 | |||
72 | /** | ||
73 | * Returns whether the last column is set to fit the available width. | ||
74 | */ | ||
75 | bool fullWidth() const; | ||
76 | |||
77 | /** | ||
78 | * Reimplemented for full width support | ||
79 | */ | ||
80 | virtual int addColumn( const QString& label, int width = -1 ); | ||
81 | |||
82 | /** | ||
83 | * Reimplemented for full width support | ||
84 | */ | ||
85 | virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 ); | ||
86 | |||
87 | /** | ||
88 | * Reimplemented for full width support | ||
89 | */ | ||
90 | virtual void removeColumn(int index); | ||
91 | |||
92 | /** | ||
93 | * sets the alternate background background color. | ||
94 | * This only has an effect if the items are OListViewItems | ||
95 | * | ||
96 | * @param c the color to use for every other item. Set to an invalid | ||
97 | * color to disable alternate colors. | ||
98 | */ | ||
99 | void setAlternateBackground( const QColor &c ); | ||
100 | |||
101 | /** | ||
102 | * sets the column separator pen. | ||
103 | * | ||
104 | * @param p the pen used to draw the column separator. | ||
105 | */ | ||
106 | void setColumnSeparator( const QPen &p ); | ||
107 | |||
108 | /** | ||
109 | * @return the alternate background color | ||
110 | */ | ||
111 | const QColor& alternateBackground() const; | ||
112 | |||
113 | /** | ||
114 | * @return the column separator pen | ||
115 | */ | ||
116 | const QPen& columnSeparator() const; | ||
117 | |||
118 | /** | ||
119 | * create a list view item as child of this object | ||
120 | * @return the new object | ||
121 | */ | ||
122 | virtual OListViewItem* childFactory(); | ||
123 | |||
124 | #ifndef QT_NO_DATASTREAM | ||
125 | /** | ||
126 | * serialize this object to a @ref QDataStream | ||
127 | * @param s the stream used to serialize this object. | ||
128 | */ | ||
129 | virtual void serializeTo( QDataStream& s ) const; | ||
130 | |||
131 | /** | ||
132 | * serialize this object from a @ref QDataStream | ||
133 | * @param s the stream used to serialize this object. | ||
134 | */ | ||
135 | virtual void serializeFrom( QDataStream& s ); | ||
136 | #endif | ||
137 | |||
138 | private: | ||
139 | QColor m_alternateBackground; | ||
140 | bool m_fullWidth; | ||
141 | QPen m_columnSeparator; | ||
142 | }; | ||
143 | |||
144 | #ifndef QT_NO_DATASTREAM | ||
145 | /** | ||
146 | * \relates QListView | ||
147 | * Writes a listview to the stream and returns a reference to the stream. | ||
148 | */ | ||
149 | QDataStream& operator<<( QDataStream& s, const OListView& lv ); | ||
150 | /** | ||
151 | * \relates QListView | ||
152 | * Reads a listview from the stream and returns a reference to the stream. | ||
153 | */ | ||
154 | QDataStream& operator>>( QDataStream& s, OListView& lv ); | ||
155 | #endif // QT_NO_DATASTREAM | ||
156 | |||
157 | //****************************** OListViewItem ****************************************************************** | ||
158 | |||
159 | class OListViewItem: public QListViewItem | ||
160 | { | ||
161 | public: | ||
162 | OListViewItem( QListView * parent ); | ||
163 | OListViewItem( QListViewItem * parent ); | ||
164 | OListViewItem( QListView * parent, QListViewItem * after ); | ||
165 | OListViewItem( QListViewItem * parent, QListViewItem * after ); | ||
166 | |||
167 | OListViewItem( QListView * parent, | ||
168 | QString, QString = QString::null, | ||
169 | QString = QString::null, QString = QString::null, | ||
170 | QString = QString::null, QString = QString::null, | ||
171 | QString = QString::null, QString = QString::null ); | ||
172 | |||
173 | OListViewItem( QListViewItem * parent, | ||
174 | QString, QString = QString::null, | ||
175 | QString = QString::null, QString = QString::null, | ||
176 | QString = QString::null, QString = QString::null, | ||
177 | QString = QString::null, QString = QString::null ); | ||
178 | |||
179 | OListViewItem( QListView * parent, QListViewItem * after, | ||
180 | QString, QString = QString::null, | ||
181 | QString = QString::null, QString = QString::null, | ||
182 | QString = QString::null, QString = QString::null, | ||
183 | QString = QString::null, QString = QString::null ); | ||
184 | |||
185 | OListViewItem( QListViewItem * parent, QListViewItem * after, | ||
186 | QString, QString = QString::null, | ||
187 | QString = QString::null, QString = QString::null, | ||
188 | QString = QString::null, QString = QString::null, | ||
189 | QString = QString::null, QString = QString::null ); | ||
190 | |||
191 | virtual ~OListViewItem(); | ||
192 | |||
193 | const QColor& backgroundColor(); | ||
194 | bool isAlternate(); | ||
195 | void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); | ||
196 | void init(); | ||
197 | |||
198 | /** | ||
199 | * create a list view item as child of this object | ||
200 | * @return the new object | ||
201 | */ | ||
202 | virtual OListViewItem* childFactory(); | ||
203 | |||
204 | #ifndef QT_NO_DATASTREAM | ||
205 | /** | ||
206 | * serialize this object to or from a @ref QDataStream | ||
207 | * @param s the stream used to serialize this object. | ||
208 | */ | ||
209 | virtual void serializeTo( QDataStream& s ) const; | ||
210 | |||
211 | /** | ||
212 | * serialize this object to or from a @ref QDataStream | ||
213 | * @param s the stream used to serialize this object. | ||
214 | */ | ||
215 | virtual void serializeFrom( QDataStream& s ); | ||
216 | #endif | ||
217 | |||
218 | private: | ||
219 | bool m_known; | ||
220 | bool m_odd; | ||
221 | }; | ||
222 | |||
223 | #ifndef QT_NO_DATASTREAM | ||
224 | /** | ||
225 | * \relates QListViewItem | ||
226 | * Writes a listview item and all subitems recursively to the stream | ||
227 | * and returns a reference to the stream. | ||
228 | */ | ||
229 | QDataStream& operator<<( QDataStream &s, const OListViewItem& lvi ); | ||
230 | /** | ||
231 | * \relates QListViewItem | ||
232 | * Reads a listview item from the stream and returns a reference to the stream. | ||
233 | */ | ||
234 | QDataStream& operator>>( QDataStream &s, OListViewItem& lvi ); | ||
235 | #endif // QT_NO_DATASTREAM | ||
236 | |||
237 | #endif // OLISTVIEW_H | ||