Diffstat (limited to 'noncore/net/wellenreiter/cornucopia/olistview.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/cornucopia/olistview.h | 87 |
1 files changed, 78 insertions, 9 deletions
diff --git a/noncore/net/wellenreiter/cornucopia/olistview.h b/noncore/net/wellenreiter/cornucopia/olistview.h index 4b9e4b0..9df5500 100644 --- a/noncore/net/wellenreiter/cornucopia/olistview.h +++ b/noncore/net/wellenreiter/cornucopia/olistview.h | |||
@@ -24,32 +24,35 @@ | |||
24 | -. .:....=;==+<; You should have received a copy of the GNU | 24 | -. .:....=;==+<; You should have received a copy of the GNU |
25 | -_. . . )=. = Library General Public License along with | 25 | -_. . . )=. = Library General Public License along with |
26 | -- :-=` this library; see the file COPYING.LIB. | 26 | -- :-=` this library; see the file COPYING.LIB. |
27 | If not, write to the Free Software Foundation, | 27 | If not, write to the Free Software Foundation, |
28 | Inc., 59 Temple Place - Suite 330, | 28 | Inc., 59 Temple Place - Suite 330, |
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | 30 | ||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #ifndef OLISTVIEW_H | 33 | #ifndef OLISTVIEW_H |
34 | #define OLISTVIEW_H | 34 | #define OLISTVIEW_H |
35 | 35 | ||
36 | #include <qlistview.h> | ||
37 | #include <qcolor.h> | 36 | #include <qcolor.h> |
37 | #include <qlistview.h> | ||
38 | #include <qpen.h> | 38 | #include <qpen.h> |
39 | #include <qdatastream.h> | ||
40 | |||
41 | class OListViewFactory; | ||
39 | 42 | ||
40 | /** | 43 | /** |
41 | * A @ref QListView variant featuring visual enhancements | 44 | * A @ref QListView variant featuring visual and functional enhancements |
42 | * like an alternate background for odd rows and an autostretch | 45 | * like an alternate background for odd rows, an autostretch mode |
43 | * mode for the width of the widget. | 46 | * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. |
44 | * | 47 | * |
45 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 48 | * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
46 | * @short OListView list/tree widget. | 49 | * @short OListView list/tree widget. |
47 | */ | 50 | */ |
48 | class OListView: public QListView | 51 | class OListView: public QListView |
49 | { | 52 | { |
50 | public: | 53 | public: |
51 | /** | 54 | /** |
52 | * Constructor. | 55 | * Constructor. |
53 | * | 56 | * |
54 | * The parameters @p parent and @p name are handled by | 57 | * The parameters @p parent and @p name are handled by |
55 | * @ref QListView, as usual. | 58 | * @ref QListView, as usual. |
@@ -103,31 +106,69 @@ | |||
103 | void setColumnSeparator( const QPen &p ); | 106 | void setColumnSeparator( const QPen &p ); |
104 | 107 | ||
105 | /** | 108 | /** |
106 | * @return the alternate background color | 109 | * @return the alternate background color |
107 | */ | 110 | */ |
108 | const QColor& alternateBackground() const; | 111 | const QColor& alternateBackground() const; |
109 | 112 | ||
110 | /** | 113 | /** |
111 | * @return the column separator pen | 114 | * @return the column separator pen |
112 | */ | 115 | */ |
113 | const QPen& columnSeparator() const; | 116 | const QPen& columnSeparator() const; |
114 | 117 | ||
118 | #ifndef QT_NO_DATASTREAM | ||
119 | /** | ||
120 | * serialize this object to a @ref QDataStream | ||
121 | * @param s the stream used to serialize this object. | ||
122 | */ | ||
123 | virtual void serializeTo( QDataStream& s ) const; | ||
124 | |||
125 | /** | ||
126 | * serialize this object from a @ref QDataStream | ||
127 | * @param s the stream used to serialize this object. | ||
128 | */ | ||
129 | virtual void serializeFrom( QDataStream& s ); | ||
130 | #endif | ||
131 | |||
132 | /** | ||
133 | * returns a factory for OListView classes | ||
134 | * creates one on the fly if it doesn't exist | ||
135 | * @return the XML Factory | ||
136 | */ | ||
137 | #ifndef QT_NO_XML | ||
138 | //OListViewFactory* Factory(); | ||
139 | #endif | ||
140 | |||
115 | private: | 141 | private: |
116 | QColor m_alternateBackground; | 142 | QColor m_alternateBackground; |
117 | bool m_fullWidth; | 143 | bool m_fullWidth; |
118 | QPen m_columnSeparator; | 144 | QPen m_columnSeparator; |
119 | 145 | #ifndef QT_NO_XML | |
146 | //OListViewFactory* m_Factory; | ||
147 | #endif | ||
120 | }; | 148 | }; |
121 | 149 | ||
150 | #ifndef QT_NO_DATASTREAM | ||
151 | /** | ||
152 | * \relates QListView | ||
153 | * Writes a listview to the stream and returns a reference to the stream. | ||
154 | */ | ||
155 | QDataStream& operator<<( QDataStream& s, const OListView& lv ); | ||
156 | /** | ||
157 | * \relates QListView | ||
158 | * Reads a listview from the stream and returns a reference to the stream. | ||
159 | */ | ||
160 | QDataStream& operator>>( QDataStream& s, OListView& lv ); | ||
161 | #endif // QT_NO_DATASTREAM | ||
162 | |||
122 | //****************************** OListViewItem ****************************************************************** | 163 | //****************************** OListViewItem ****************************************************************** |
123 | 164 | ||
124 | class OListViewItem: public QListViewItem | 165 | class OListViewItem: public QListViewItem |
125 | { | 166 | { |
126 | public: | 167 | public: |
127 | OListViewItem( QListView * parent ); | 168 | OListViewItem( QListView * parent ); |
128 | OListViewItem( QListViewItem * parent ); | 169 | OListViewItem( QListViewItem * parent ); |
129 | OListViewItem( QListView * parent, QListViewItem * after ); | 170 | OListViewItem( QListView * parent, QListViewItem * after ); |
130 | OListViewItem( QListViewItem * parent, QListViewItem * after ); | 171 | OListViewItem( QListViewItem * parent, QListViewItem * after ); |
131 | 172 | ||
132 | OListViewItem( QListView * parent, | 173 | OListViewItem( QListView * parent, |
133 | QString, QString = QString::null, | 174 | QString, QString = QString::null, |
@@ -137,32 +178,60 @@ class OListViewItem: public QListViewItem | |||
137 | 178 | ||
138 | OListViewItem( QListViewItem * parent, | 179 | OListViewItem( QListViewItem * parent, |
139 | QString, QString = QString::null, | 180 | QString, QString = QString::null, |
140 | QString = QString::null, QString = QString::null, | 181 | QString = QString::null, QString = QString::null, |
141 | QString = QString::null, QString = QString::null, | 182 | QString = QString::null, QString = QString::null, |
142 | QString = QString::null, QString = QString::null ); | 183 | QString = QString::null, QString = QString::null ); |
143 | 184 | ||
144 | OListViewItem( QListView * parent, QListViewItem * after, | 185 | OListViewItem( QListView * parent, QListViewItem * after, |
145 | QString, QString = QString::null, | 186 | QString, QString = QString::null, |
146 | QString = QString::null, QString = QString::null, | 187 | QString = QString::null, QString = QString::null, |
147 | QString = QString::null, QString = QString::null, | 188 | QString = QString::null, QString = QString::null, |
148 | QString = QString::null, QString = QString::null ); | 189 | QString = QString::null, QString = QString::null ); |
149 | 190 | ||
150 | OListViewItem( QListViewItem * parent, QListViewItem * after, | 191 | OListViewItem( QListViewItem * parent, QListViewItem * after, |
151 | QString, QString = QString::null, | 192 | QString, QString = QString::null, |
152 | QString = QString::null, QString = QString::null, | 193 | QString = QString::null, QString = QString::null, |
153 | QString = QString::null, QString = QString::null, | 194 | QString = QString::null, QString = QString::null, |
154 | QString = QString::null, QString = QString::null ); | 195 | QString = QString::null, QString = QString::null ); |
155 | 196 | ||
156 | virtual ~OListViewItem(); | 197 | virtual ~OListViewItem(); |
157 | 198 | ||
158 | const QColor& backgroundColor(); | 199 | const QColor& backgroundColor(); |
159 | bool isAlternate(); | 200 | bool isAlternate(); |
160 | void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); | 201 | void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); |
161 | void init(); | 202 | void init(); |
162 | 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 | |||
163 | private: | 218 | private: |
164 | bool m_known; | 219 | bool m_known; |
165 | bool m_odd; | 220 | bool m_odd; |
166 | }; | 221 | }; |
167 | 222 | ||
168 | #endif | 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 | ||