From d0e64d0c7961de1c3ecb886ae76c6701f268d767 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Sun, 02 Mar 2003 16:38:17 +0000 Subject: first attempt to add session persistence --- (limited to 'noncore/net/wellenreiter/cornucopia/olistview.h') 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 @@ -33,14 +33,17 @@ #ifndef OLISTVIEW_H #define OLISTVIEW_H -#include #include +#include #include +#include + +class OListViewFactory; /** - * A @ref QListView variant featuring visual enhancements - * like an alternate background for odd rows and an autostretch - * mode for the width of the widget. + * A @ref QListView variant featuring visual and functional enhancements + * like an alternate background for odd rows, an autostretch mode + * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. * * @author Michael 'Mickey' Lauer * @short OListView list/tree widget. @@ -112,13 +115,51 @@ */ const QPen& columnSeparator() const; + #ifndef QT_NO_DATASTREAM + /** + * serialize this object to a @ref QDataStream + * @param s the stream used to serialize this object. + */ + virtual void serializeTo( QDataStream& s ) const; + + /** + * serialize this object from a @ref QDataStream + * @param s the stream used to serialize this object. + */ + virtual void serializeFrom( QDataStream& s ); + #endif + + /** + * returns a factory for OListView classes + * creates one on the fly if it doesn't exist + * @return the XML Factory + */ + #ifndef QT_NO_XML + //OListViewFactory* Factory(); + #endif + private: QColor m_alternateBackground; bool m_fullWidth; QPen m_columnSeparator; - + #ifndef QT_NO_XML + //OListViewFactory* m_Factory; + #endif }; +#ifndef QT_NO_DATASTREAM +/** + * \relates QListView + * Writes a listview to the stream and returns a reference to the stream. + */ +QDataStream& operator<<( QDataStream& s, const OListView& lv ); +/** + * \relates QListView + * Reads a listview from the stream and returns a reference to the stream. + */ +QDataStream& operator>>( QDataStream& s, OListView& lv ); +#endif // QT_NO_DATASTREAM + //****************************** OListViewItem ****************************************************************** class OListViewItem: public QListViewItem @@ -146,23 +187,51 @@ class OListViewItem: public QListViewItem QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null ); - + OListViewItem( QListViewItem * parent, QListViewItem * after, QString, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null ); - + virtual ~OListViewItem(); - + const QColor& backgroundColor(); bool isAlternate(); void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ); void init(); + #ifndef QT_NO_DATASTREAM + /** + * serialize this object to or from a @ref QDataStream + * @param s the stream used to serialize this object. + */ + virtual void serializeTo( QDataStream& s ) const; + + /** + * serialize this object to or from a @ref QDataStream + * @param s the stream used to serialize this object. + */ + virtual void serializeFrom( QDataStream& s ); + #endif + private: bool m_known; bool m_odd; }; -#endif +#ifndef QT_NO_DATASTREAM +/** + * \relates QListViewItem + * Writes a listview item and all subitems recursively to the stream + * and returns a reference to the stream. + */ +QDataStream& operator<<( QDataStream &s, const OListViewItem& lvi ); +/** + * \relates QListViewItem + * Reads a listview item from the stream and returns a reference to the stream. + */ +QDataStream& operator>>( QDataStream &s, OListViewItem& lvi ); +#endif // QT_NO_DATASTREAM + +#endif // OLISTVIEW_H -- cgit v0.9.0.2