Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

olistview.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003               =.             (C) 2003-2004 Michael 'Mickey' Lauer <mickey@vanille.de>
00004             .=l.
00005            .>+-=
00006  _;:,     .>    :=|.         This program is free software; you can
00007 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00008 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00009 .="- .-=="i,     .._         License as published by the Free Software
00010  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00011      ._= =}       :          or (at your option) any later version.
00012     .%`+i>       _;_.
00013     .i_,=:_.      -<s.       This program is distributed in the hope that
00014      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00015     : ..    .:,     . . .    without even the implied warranty of
00016     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00017   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00018 ..}^=.=       =       ;      Library General Public License for more
00019 ++=   -.     .`     .:       details.
00020  :     =  ...= . :.=-
00021  -.   .:....=;==+<;          You should have received a copy of the GNU
00022   -_. . .   )=.  =           Library General Public License along with
00023     --        :-=`           this library; see the file COPYING.LIB.
00024                              If not, write to the Free Software Foundation,
00025                              Inc., 59 Temple Place - Suite 330,
00026                              Boston, MA 02111-1307, USA.
00027 
00028 */
00029 
00030 #ifndef OLISTVIEW_H
00031 #define OLISTVIEW_H
00032 
00033 #include <qcolor.h>
00034 #include <qlistview.h>
00035 #include <qpen.h>
00036 #include <qdatastream.h>
00037 #include <qstringlist.h>
00038 
00039 
00040 namespace Opie {
00041 namespace Ui   {
00042 class OListViewItem;
00043 
00044 
00045 /*======================================================================================
00046  * OListView
00047  *======================================================================================*/
00048 
00058 class OListView: public QListView
00059 {
00060     Q_OBJECT
00061   public:
00068     OListView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
00072     virtual ~OListView();
00076     void setFullWidth( bool fullWidth );
00080     bool fullWidth() const;
00084     virtual int addColumn( const QString& label, int width = -1 );
00088     virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 );
00092     virtual void removeColumn(int index);
00098     void setAlternateBackground( const QColor& color );
00102     void setColumnSeparator( const QPen& pen );
00103 
00107     const QColor& alternateBackground() const;
00111     const QPen& columnSeparator() const;
00116     virtual OListViewItem* childFactory();
00117 #ifndef QT_NO_DATASTREAM
00118 
00121     virtual void serializeTo( QDataStream& stream ) const;
00125     virtual void serializeFrom( QDataStream& s );
00126 #endif
00127 
00128   public slots:
00132      void expand();
00136      void collapse();
00137 
00138   protected slots:
00142     void expand(QListViewItem*);
00143 
00144   private:
00145     QColor m_alternateBackground;
00146     bool m_fullWidth : 1;
00147     QPen m_columnSeparator;
00148     class Private;
00149     Private *d;
00150 };
00151 
00152 #ifndef QT_NO_DATASTREAM
00153 
00157 QDataStream& operator<<( QDataStream& stream, const OListView& listview );
00162 QDataStream& operator>>( QDataStream& stream, OListView& listview );
00163 #endif // QT_NO_DATASTREAM
00164 
00165 /*======================================================================================
00166  * OListViewItem
00167  *======================================================================================*/
00168 
00169 class OListViewItem: public QListViewItem
00170 {
00171     friend class OCheckListItem;
00172   public:
00176     OListViewItem( QListView * parent );
00177     OListViewItem( QListViewItem * parent );
00178     OListViewItem( QListView * parent, QListViewItem * after );
00179     OListViewItem( QListViewItem * parent, QListViewItem * after );
00180 
00181     OListViewItem( QListView * parent,
00182         QString,     QString = QString::null,
00183         QString = QString::null, QString = QString::null,
00184         QString = QString::null, QString = QString::null,
00185         QString = QString::null, QString = QString::null );
00186 
00187     OListViewItem( QListViewItem * parent,
00188         QString,     QString = QString::null,
00189         QString = QString::null, QString = QString::null,
00190         QString = QString::null, QString = QString::null,
00191         QString = QString::null, QString = QString::null );
00192 
00193     OListViewItem( QListView * parent, QListViewItem * after,
00194         QString,     QString = QString::null,
00195         QString = QString::null, QString = QString::null,
00196         QString = QString::null, QString = QString::null,
00197         QString = QString::null, QString = QString::null );
00198 
00199     OListViewItem( QListViewItem * parent, QListViewItem * after,
00200         QString,     QString = QString::null,
00201         QString = QString::null, QString = QString::null,
00202         QString = QString::null, QString = QString::null,
00203         QString = QString::null, QString = QString::null );
00207     virtual ~OListViewItem();
00211     const QColor& backgroundColor();
00216     bool isAlternate();
00221     void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment );
00225     void init();
00230     virtual OListViewItem* childFactory();
00231     #ifndef QT_NO_DATASTREAM
00232 
00236     virtual void serializeTo( QDataStream& s ) const;
00237 
00242     virtual void serializeFrom( QDataStream& s );
00243     #endif
00244 
00248     virtual void expand(){};
00249 
00250   private:
00251     bool m_known : 1;
00252     bool m_odd   : 1;
00253     class Private;
00254     Private *d;
00255 };
00256 
00257 #ifndef QT_NO_DATASTREAM
00258 
00263 QDataStream& operator<<( QDataStream& stream, const OListViewItem& item );
00268 QDataStream& operator>>( QDataStream& stream, OListViewItem& item );
00269 #endif // QT_NO_DATASTREAM
00270 
00271 
00272 /*======================================================================================
00273  * OCheckListItem
00274  *======================================================================================*/
00275 
00276 class OCheckListItem : public QCheckListItem
00277 {
00278   public:
00279 
00280     OCheckListItem( QCheckListItem *parent, const QString &text,
00281                     Type = Controller );
00282     OCheckListItem( QListViewItem *parent, const QString &text,
00283                     Type = Controller );
00284     OCheckListItem( QListView *parent, const QString &text,
00285                     Type = Controller );
00286     OCheckListItem( QListViewItem *parent, const QString &text,
00287                     const QPixmap & );
00288     OCheckListItem( QListView *parent, const QString &text,
00289                     const QPixmap & );
00290     ~OCheckListItem();
00294     const QColor& backgroundColor();
00299     bool isAlternate();
00304     void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment );
00308     void init();
00309 
00310   private:
00311     bool m_known;
00312     bool m_odd;
00313 };
00314 
00315 
00316 /*======================================================================================
00317  * ONamedListView
00318  *======================================================================================*/
00319 
00320 class ONamedListViewItem;
00321 
00329 class ONamedListView: public OListView
00330 {
00331   public:
00338     ONamedListView( QWidget* parent = 0, const char* name = 0 );
00342     virtual ~ONamedListView();
00346     virtual void addColumns( const QStringList& columns );
00350     virtual int findColumn( const QString& text ) const;
00360     virtual ONamedListViewItem* find( ONamedListViewItem* start, int column, const QString& text, int recurse = -1 ) const;
00361     virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const;
00362 
00363     virtual ONamedListViewItem* find( ONamedListViewItem* start, const QString& column, const QString& text, int recurse = -1 ) const;
00364     virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const;
00365   private:
00366     class Private;
00367     Private *d;
00368 };
00369 
00370 /*======================================================================================
00371  * ONamedListViewItem
00372  *======================================================================================*/
00373 
00381 class ONamedListViewItem: public OListViewItem
00382 {
00383   public:
00388     ONamedListViewItem( QListView* parent, const QStringList& texts );
00389     ONamedListViewItem( QListViewItem* parent, const QStringList& texts );
00390     ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts );
00391     ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts );
00395     virtual ~ONamedListViewItem();
00401     virtual void setText( const QString& column, const QString& text );
00405     virtual void setText( const QStringList& texts );
00415     virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const;
00416     virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const;
00417 
00418   private:
00419     class Private;
00420     Private *d;
00421 
00422 };
00423 }
00424 }
00425 
00426 #endif // OLISTVIEW_H

Generated on Sat Nov 5 16:15:54 2005 for OPIE by  doxygen 1.4.2