author | mickeyl <mickeyl> | 2003-06-26 10:34:59 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-06-26 10:34:59 (UTC) |
commit | 8168239a5b1ff80abc02f93ed831c088ca5f2f3d (patch) (unidiff) | |
tree | d19069b730eeb82f02754955366569d52d088248 /libopie2 | |
parent | 3c5746daa26d8353fde9ba84c6183517e26a625a (diff) | |
download | opie-8168239a5b1ff80abc02f93ed831c088ca5f2f3d.zip opie-8168239a5b1ff80abc02f93ed831c088ca5f2f3d.tar.gz opie-8168239a5b1ff80abc02f93ed831c088ca5f2f3d.tar.bz2 |
first bunch of fixes for Qt 3.x compilation
-rw-r--r-- | libopie2/opieui/olistview.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libopie2/opieui/olistview.h b/libopie2/opieui/olistview.h index 1bbdd5b..109e309 100644 --- a/libopie2/opieui/olistview.h +++ b/libopie2/opieui/olistview.h | |||
@@ -1,296 +1,298 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 4 | =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OLISTVIEW_H | 31 | #ifndef OLISTVIEW_H |
32 | #define OLISTVIEW_H | 32 | #define OLISTVIEW_H |
33 | 33 | ||
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <qpen.h> | 36 | #include <qpen.h> |
37 | #include <qdatastream.h> | 37 | #include <qdatastream.h> |
38 | #include <qstringlist.h> | ||
38 | 39 | ||
39 | class OListViewItem; | 40 | class OListViewItem; |
40 | 41 | ||
42 | |||
41 | /*====================================================================================== | 43 | /*====================================================================================== |
42 | * OListView | 44 | * OListView |
43 | *======================================================================================*/ | 45 | *======================================================================================*/ |
44 | 46 | ||
45 | /** | 47 | /** |
46 | * @brief A list/tree widget. | 48 | * @brief A list/tree widget. |
47 | * | 49 | * |
48 | * A @ref QListView variant featuring visual and functional enhancements | 50 | * A @ref QListView variant featuring visual and functional enhancements |
49 | * like an alternate background for odd rows, an autostretch mode | 51 | * like an alternate background for odd rows, an autostretch mode |
50 | * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. | 52 | * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. |
51 | * | 53 | * |
52 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 54 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
53 | */ | 55 | */ |
54 | class OListView: public QListView | 56 | class OListView: public QListView |
55 | { | 57 | { |
56 | public: | 58 | public: |
57 | /** | 59 | /** |
58 | * Constructor. | 60 | * Constructor. |
59 | * | 61 | * |
60 | * The parameters @a parent and @a name are handled by | 62 | * The parameters @a parent and @a name are handled by |
61 | * @ref QListView, as usual. | 63 | * @ref QListView, as usual. |
62 | */ | 64 | */ |
63 | OListView( QWidget* parent = 0, const char* name = 0 ); | 65 | OListView( QWidget* parent = 0, const char* name = 0 ); |
64 | /** | 66 | /** |
65 | * Destructor. | 67 | * Destructor. |
66 | */ | 68 | */ |
67 | virtual ~OListView(); | 69 | virtual ~OListView(); |
68 | /** | 70 | /** |
69 | * Let the last column fit exactly all the available width. | 71 | * Let the last column fit exactly all the available width. |
70 | */ | 72 | */ |
71 | void setFullWidth( bool fullWidth ); | 73 | void setFullWidth( bool fullWidth ); |
72 | /** | 74 | /** |
73 | * Returns whether the last column is set to fit the available width. | 75 | * Returns whether the last column is set to fit the available width. |
74 | */ | 76 | */ |
75 | bool fullWidth() const; | 77 | bool fullWidth() const; |
76 | /** | 78 | /** |
77 | * Reimplemented for full width support | 79 | * Reimplemented for full width support |
78 | */ | 80 | */ |
79 | virtual int addColumn( const QString& label, int width = -1 ); | 81 | virtual int addColumn( const QString& label, int width = -1 ); |
80 | /** | 82 | /** |
81 | * Reimplemented for full width support | 83 | * Reimplemented for full width support |
82 | */ | 84 | */ |
83 | virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 ); | 85 | virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 ); |
84 | /** | 86 | /** |
85 | * Reimplemented for full width support | 87 | * Reimplemented for full width support |
86 | */ | 88 | */ |
87 | virtual void removeColumn(int index); | 89 | virtual void removeColumn(int index); |
88 | /** | 90 | /** |
89 | * Set the alternate background background @a color. | 91 | * Set the alternate background background @a color. |
90 | * Set to an invalid color to disable alternate colors. | 92 | * Set to an invalid color to disable alternate colors. |
91 | * This only has an effect if the items are OListViewItems | 93 | * This only has an effect if the items are OListViewItems |
92 | */ | 94 | */ |
93 | void setAlternateBackground( const QColor& color ); | 95 | void setAlternateBackground( const QColor& color ); |
94 | /** | 96 | /** |
95 | * Sets the column separator @a pen. | 97 | * Sets the column separator @a pen. |
96 | */ | 98 | */ |
97 | void setColumnSeparator( const QPen& pen ); | 99 | void setColumnSeparator( const QPen& pen ); |
98 | 100 | ||
99 | /** | 101 | /** |
100 | * @returns the alternate background color | 102 | * @returns the alternate background color |
101 | */ | 103 | */ |
102 | const QColor& alternateBackground() const; | 104 | const QColor& alternateBackground() const; |
103 | /** | 105 | /** |
104 | * @return the column separator pen | 106 | * @return the column separator pen |
105 | */ | 107 | */ |
106 | const QPen& columnSeparator() const; | 108 | const QPen& columnSeparator() const; |
107 | /** | 109 | /** |
108 | * Create a list view item as child of this object | 110 | * Create a list view item as child of this object |
109 | * @returns the new object | 111 | * @returns the new object |
110 | */ | 112 | */ |
111 | virtual OListViewItem* childFactory(); | 113 | virtual OListViewItem* childFactory(); |
112 | #ifndef QT_NO_DATASTREAM | 114 | #ifndef QT_NO_DATASTREAM |
113 | /** | 115 | /** |
114 | * Serialize this object to @ref QDataStream @a stream | 116 | * Serialize this object to @ref QDataStream @a stream |
115 | */ | 117 | */ |
116 | virtual void serializeTo( QDataStream& stream ) const; | 118 | virtual void serializeTo( QDataStream& stream ) const; |
117 | /** | 119 | /** |
118 | * Serialize this object from a @ref QDataStream @a stream | 120 | * Serialize this object from a @ref QDataStream @a stream |
119 | */ | 121 | */ |
120 | virtual void serializeFrom( QDataStream& s ); | 122 | virtual void serializeFrom( QDataStream& s ); |
121 | #endif | 123 | #endif |
122 | 124 | ||
123 | private: | 125 | private: |
124 | QColor m_alternateBackground; | 126 | QColor m_alternateBackground; |
125 | bool m_fullWidth; | 127 | bool m_fullWidth; |
126 | QPen m_columnSeparator; | 128 | QPen m_columnSeparator; |
127 | }; | 129 | }; |
128 | 130 | ||
129 | #ifndef QT_NO_DATASTREAM | 131 | #ifndef QT_NO_DATASTREAM |
130 | /** | 132 | /** |
131 | * @relates OListView | 133 | * @relates OListView |
132 | * Writes @a listview to the @a stream and returns a reference to the stream. | 134 | * Writes @a listview to the @a stream and returns a reference to the stream. |
133 | */ | 135 | */ |
134 | QDataStream& operator<<( QDataStream& stream, const OListView& listview ); | 136 | QDataStream& operator<<( QDataStream& stream, const OListView& listview ); |
135 | /** | 137 | /** |
136 | * @relates OListView | 138 | * @relates OListView |
137 | * Reads @a listview from the @a stream and returns a reference to the stream. | 139 | * Reads @a listview from the @a stream and returns a reference to the stream. |
138 | */ | 140 | */ |
139 | QDataStream& operator>>( QDataStream& stream, OListView& listview ); | 141 | QDataStream& operator>>( QDataStream& stream, OListView& listview ); |
140 | #endif // QT_NO_DATASTREAM | 142 | #endif // QT_NO_DATASTREAM |
141 | 143 | ||
142 | /*====================================================================================== | 144 | /*====================================================================================== |
143 | * OListViewItem | 145 | * OListViewItem |
144 | *======================================================================================*/ | 146 | *======================================================================================*/ |
145 | 147 | ||
146 | class OListViewItem: public QListViewItem | 148 | class OListViewItem: public QListViewItem |
147 | { | 149 | { |
148 | public: | 150 | public: |
149 | /** | 151 | /** |
150 | * Constructors. | 152 | * Constructors. |
151 | */ | 153 | */ |
152 | OListViewItem( QListView * parent ); | 154 | OListViewItem( QListView * parent ); |
153 | OListViewItem( QListViewItem * parent ); | 155 | OListViewItem( QListViewItem * parent ); |
154 | OListViewItem( QListView * parent, QListViewItem * after ); | 156 | OListViewItem( QListView * parent, QListViewItem * after ); |
155 | OListViewItem( QListViewItem * parent, QListViewItem * after ); | 157 | OListViewItem( QListViewItem * parent, QListViewItem * after ); |
156 | 158 | ||
157 | OListViewItem( QListView * parent, | 159 | OListViewItem( QListView * parent, |
158 | QString, QString = QString::null, | 160 | QString, QString = QString::null, |
159 | QString = QString::null, QString = QString::null, | 161 | QString = QString::null, QString = QString::null, |
160 | QString = QString::null, QString = QString::null, | 162 | QString = QString::null, QString = QString::null, |
161 | QString = QString::null, QString = QString::null ); | 163 | QString = QString::null, QString = QString::null ); |
162 | 164 | ||
163 | OListViewItem( QListViewItem * parent, | 165 | OListViewItem( QListViewItem * parent, |
164 | QString, QString = QString::null, | 166 | QString, QString = QString::null, |
165 | QString = QString::null, QString = QString::null, | 167 | QString = QString::null, QString = QString::null, |
166 | QString = QString::null, QString = QString::null, | 168 | QString = QString::null, QString = QString::null, |
167 | QString = QString::null, QString = QString::null ); | 169 | QString = QString::null, QString = QString::null ); |
168 | 170 | ||
169 | OListViewItem( QListView * parent, QListViewItem * after, | 171 | OListViewItem( QListView * parent, QListViewItem * after, |
170 | QString, QString = QString::null, | 172 | QString, QString = QString::null, |
171 | QString = QString::null, QString = QString::null, | 173 | QString = QString::null, QString = QString::null, |
172 | QString = QString::null, QString = QString::null, | 174 | QString = QString::null, QString = QString::null, |
173 | QString = QString::null, QString = QString::null ); | 175 | QString = QString::null, QString = QString::null ); |
174 | 176 | ||
175 | OListViewItem( QListViewItem * parent, QListViewItem * after, | 177 | OListViewItem( QListViewItem * parent, QListViewItem * after, |
176 | QString, QString = QString::null, | 178 | QString, QString = QString::null, |
177 | QString = QString::null, QString = QString::null, | 179 | QString = QString::null, QString = QString::null, |
178 | QString = QString::null, QString = QString::null, | 180 | QString = QString::null, QString = QString::null, |
179 | QString = QString::null, QString = QString::null ); | 181 | QString = QString::null, QString = QString::null ); |
180 | /** | 182 | /** |
181 | * Destructor. | 183 | * Destructor. |
182 | */ | 184 | */ |
183 | virtual ~OListViewItem(); | 185 | virtual ~OListViewItem(); |
184 | /** | 186 | /** |
185 | * @returns the background color of the list item. | 187 | * @returns the background color of the list item. |
186 | */ | 188 | */ |
187 | const QColor& backgroundColor(); | 189 | const QColor& backgroundColor(); |
188 | /** | 190 | /** |
189 | * @returns true, if the item is at an odd position and | 191 | * @returns true, if the item is at an odd position and |
190 | * thus have to be painted with the alternate background color. | 192 | * thus have to be painted with the alternate background color. |
191 | */ | 193 | */ |
192 | bool isAlternate(); | 194 | bool isAlternate(); |
193 | /** | 195 | /** |
194 | * @note: Reimplemented for internal purposes - the API is not affected | 196 | * @note: Reimplemented for internal purposes - the API is not affected |
195 | * | 197 | * |
196 | */ | 198 | */ |
197 | void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); | 199 | void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); |
198 | /** | 200 | /** |
199 | * Perform object initialization. | 201 | * Perform object initialization. |
200 | */ | 202 | */ |
201 | void init(); | 203 | void init(); |
202 | /** | 204 | /** |
203 | * create a list view item as child of this object | 205 | * create a list view item as child of this object |
204 | * @returns the new object | 206 | * @returns the new object |
205 | */ | 207 | */ |
206 | virtual OListViewItem* childFactory(); | 208 | virtual OListViewItem* childFactory(); |
207 | #ifndef QT_NO_DATASTREAM | 209 | #ifndef QT_NO_DATASTREAM |
208 | /** | 210 | /** |
209 | * serialize this object to or from a @ref QDataStream | 211 | * serialize this object to or from a @ref QDataStream |
210 | * @param s the stream used to serialize this object. | 212 | * @param s the stream used to serialize this object. |
211 | */ | 213 | */ |
212 | virtual void serializeTo( QDataStream& s ) const; | 214 | virtual void serializeTo( QDataStream& s ) const; |
213 | 215 | ||
214 | /** | 216 | /** |
215 | * serialize this object to or from a @ref QDataStream | 217 | * serialize this object to or from a @ref QDataStream |
216 | * @param s the stream used to serialize this object. | 218 | * @param s the stream used to serialize this object. |
217 | */ | 219 | */ |
218 | virtual void serializeFrom( QDataStream& s ); | 220 | virtual void serializeFrom( QDataStream& s ); |
219 | #endif | 221 | #endif |
220 | 222 | ||
221 | private: | 223 | private: |
222 | bool m_known; | 224 | bool m_known; |
223 | bool m_odd; | 225 | bool m_odd; |
224 | }; | 226 | }; |
225 | 227 | ||
226 | #ifndef QT_NO_DATASTREAM | 228 | #ifndef QT_NO_DATASTREAM |
227 | /** | 229 | /** |
228 | * @relates QListViewItem | 230 | * @relates QListViewItem |
229 | * Writes listview @a item and all subitems recursively to @a stream | 231 | * Writes listview @a item and all subitems recursively to @a stream |
230 | * and returns a reference to the stream. | 232 | * and returns a reference to the stream. |
231 | */ | 233 | */ |
232 | QDataStream& operator<<( QDataStream& stream, const OListViewItem& item ); | 234 | QDataStream& operator<<( QDataStream& stream, const OListViewItem& item ); |
233 | /** | 235 | /** |
234 | * @relates QListViewItem | 236 | * @relates QListViewItem |
235 | * Reads listview @a item from @a stream and returns a reference to the stream. | 237 | * Reads listview @a item from @a stream and returns a reference to the stream. |
236 | */ | 238 | */ |
237 | QDataStream& operator>>( QDataStream& stream, OListViewItem& item ); | 239 | QDataStream& operator>>( QDataStream& stream, OListViewItem& item ); |
238 | #endif // QT_NO_DATASTREAM | 240 | #endif // QT_NO_DATASTREAM |
239 | 241 | ||
240 | /*====================================================================================== | 242 | /*====================================================================================== |
241 | * ONamedListView | 243 | * ONamedListView |
242 | *======================================================================================*/ | 244 | *======================================================================================*/ |
243 | 245 | ||
244 | class ONamedListViewItem; | 246 | class ONamedListViewItem; |
245 | 247 | ||
246 | /** | 248 | /** |
247 | * @brief An OListView variant with named columns. | 249 | * @brief An OListView variant with named columns. |
248 | * | 250 | * |
249 | * This class provides a higher-level interface to an OListView. | 251 | * This class provides a higher-level interface to an OListView. |
250 | * | 252 | * |
251 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 253 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
252 | */ | 254 | */ |
253 | class ONamedListView: public OListView | 255 | class ONamedListView: public OListView |
254 | { | 256 | { |
255 | public: | 257 | public: |
256 | /** | 258 | /** |
257 | * Constructor. | 259 | * Constructor. |
258 | * | 260 | * |
259 | * The parameters @a parent and @a name are handled by | 261 | * The parameters @a parent and @a name are handled by |
260 | * @ref OListView, as usual. | 262 | * @ref OListView, as usual. |
261 | */ | 263 | */ |
262 | ONamedListView( QWidget* parent = 0, const char* name = 0 ); | 264 | ONamedListView( QWidget* parent = 0, const char* name = 0 ); |
263 | /** | 265 | /** |
264 | * Destructor. | 266 | * Destructor. |
265 | */ | 267 | */ |
266 | virtual ~ONamedListView(); | 268 | virtual ~ONamedListView(); |
267 | /** | 269 | /** |
268 | * Add a number of @a columns to the listview. | 270 | * Add a number of @a columns to the listview. |
269 | */ | 271 | */ |
270 | virtual void addColumns( const QStringList& columns ); | 272 | virtual void addColumns( const QStringList& columns ); |
271 | /** | 273 | /** |
272 | * @returns the column index matching to @a text or -1 if not found. | 274 | * @returns the column index matching to @a text or -1 if not found. |
273 | */ | 275 | */ |
274 | virtual int findColumn( const QString& text ) const; | 276 | virtual int findColumn( const QString& text ) const; |
275 | /** | 277 | /** |
276 | * @returns the first item which has a @a text in column @a column. | 278 | * @returns the first item which has a @a text in column @a column. |
277 | * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> | 279 | * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> |
278 | * <li>set it to 0 to search only among direct childs, | 280 | * <li>set it to 0 to search only among direct childs, |
279 | * <li>set it to 1 to search direct childs and all 1st order subchilds | 281 | * <li>set it to 1 to search direct childs and all 1st order subchilds |
280 | * <li>set it to -1 for maximum recursion. | 282 | * <li>set it to -1 for maximum recursion. |
281 | * </ul> | 283 | * </ul> |
282 | * @sa ONamedListViewItem::find() | 284 | * @sa ONamedListViewItem::find() |
283 | */ | 285 | */ |
284 | virtual ONamedListViewItem* find( ONamedListViewItem* start, int column, const QString& text, int recurse = -1 ) const; | 286 | virtual ONamedListViewItem* find( ONamedListViewItem* start, int column, const QString& text, int recurse = -1 ) const; |
285 | virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; | 287 | virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; |
286 | 288 | ||
287 | virtual ONamedListViewItem* find( ONamedListViewItem* start, const QString& column, const QString& text, int recurse = -1 ) const; | 289 | virtual ONamedListViewItem* find( ONamedListViewItem* start, const QString& column, const QString& text, int recurse = -1 ) const; |
288 | virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; | 290 | virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; |
289 | }; | 291 | }; |
290 | 292 | ||
291 | /*====================================================================================== | 293 | /*====================================================================================== |
292 | * ONamedListViewItem | 294 | * ONamedListViewItem |
293 | *======================================================================================*/ | 295 | *======================================================================================*/ |
294 | 296 | ||
295 | /** | 297 | /** |
296 | * @brief An OListView variant with named columns. | 298 | * @brief An OListView variant with named columns. |