summaryrefslogtreecommitdiff
path: root/libopie2/opieui/olistview.h
authormickeyl <mickeyl>2004-03-05 21:36:58 (UTC)
committer mickeyl <mickeyl>2004-03-05 21:36:58 (UTC)
commitb9d58b616102970872129b5bc2f55569910f5c03 (patch) (side-by-side diff)
tree593b40cce6f3da75593c90bff337b9b9c5092f7e /libopie2/opieui/olistview.h
parent4a18103940564be8585af8121203561e16f0a32c (diff)
downloadopie-b9d58b616102970872129b5bc2f55569910f5c03.zip
opie-b9d58b616102970872129b5bc2f55569910f5c03.tar.gz
opie-b9d58b616102970872129b5bc2f55569910f5c03.tar.bz2
add OCheckListItem
change my email address
Diffstat (limited to 'libopie2/opieui/olistview.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/olistview.h71
1 files changed, 63 insertions, 8 deletions
diff --git a/libopie2/opieui/olistview.h b/libopie2/opieui/olistview.h
index a00b43a..59b0973 100644
--- a/libopie2/opieui/olistview.h
+++ b/libopie2/opieui/olistview.h
@@ -1,16 +1,15 @@
/*
                This file is part of the Opie Project
-
- =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+ =. (C) 2003-2004 Michael 'Mickey' Lauer <mickey@vanille.de>
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
@@ -42,25 +41,25 @@ class OListViewItem;
/*======================================================================================
* OListView
*======================================================================================*/
/**
* @brief A list/tree 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 <mickey@tm.informatik.uni-frankfurt.de>
+ * @author Michael 'Mickey' Lauer <mickey@vanille.de>
*/
class OListView: public QListView
{
public:
/**
* Constructor.
*
* The parameters @a parent and @a name are handled by
* @ref QListView, as usual.
*/
OListView( QWidget* parent = 0, const char* name = 0 );
/**
@@ -113,29 +112,39 @@ class OListView: public QListView
virtual OListViewItem* childFactory();
#ifndef QT_NO_DATASTREAM
/**
* Serialize this object to @ref QDataStream @a stream
*/
virtual void serializeTo( QDataStream& stream ) const;
/**
* Serialize this object from a @ref QDataStream @a stream
*/
virtual void serializeFrom( QDataStream& s );
#endif
-protected slots:
- /**
+ public slots:
+ /**
+ * Expand all items
+ */
+ void expand();
+ /**
+ * Collapse all items
+ */
+ void collapse();
+
+ protected slots:
+ /**
* expand the current OListViewItem
*/
- void expand(QListViewItem*);
+ void expand(QListViewItem*);
private:
QColor m_alternateBackground;
bool m_fullWidth;
QPen m_columnSeparator;
};
#ifndef QT_NO_DATASTREAM
/**
* @relates OListView
* Writes @a listview to the @a stream and returns a reference to the stream.
*/
@@ -144,24 +153,25 @@ QDataStream& operator<<( QDataStream& stream, const OListView& listview );
* @relates OListView
* Reads @a listview from the @a stream and returns a reference to the stream.
*/
QDataStream& operator>>( QDataStream& stream, OListView& listview );
#endif // QT_NO_DATASTREAM
/*======================================================================================
* OListViewItem
*======================================================================================*/
class OListViewItem: public QListViewItem
{
+ friend class OCheckListItem;
public:
/**
* Constructors.
*/
OListViewItem( QListView * parent );
OListViewItem( QListViewItem * parent );
OListViewItem( QListView * parent, QListViewItem * after );
OListViewItem( QListViewItem * parent, QListViewItem * after );
OListViewItem( QListView * parent,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
@@ -241,36 +251,81 @@ class OListViewItem: public QListViewItem
* @relates QListViewItem
* Writes listview @a item and all subitems recursively to @a stream
* and returns a reference to the stream.
*/
QDataStream& operator<<( QDataStream& stream, const OListViewItem& item );
/**
* @relates QListViewItem
* Reads listview @a item from @a stream and returns a reference to the stream.
*/
QDataStream& operator>>( QDataStream& stream, OListViewItem& item );
#endif // QT_NO_DATASTREAM
+
+/*======================================================================================
+ * OCheckListItem
+ *======================================================================================*/
+
+class OCheckListItem : public QCheckListItem
+{
+ public:
+
+ OCheckListItem( QCheckListItem *parent, const QString &text,
+ Type = Controller );
+ OCheckListItem( QListViewItem *parent, const QString &text,
+ Type = Controller );
+ OCheckListItem( QListView *parent, const QString &text,
+ Type = Controller );
+ OCheckListItem( QListViewItem *parent, const QString &text,
+ const QPixmap & );
+ OCheckListItem( QListView *parent, const QString &text,
+ const QPixmap & );
+ ~OCheckListItem();
+ /**
+ * @returns the background color of the list item.
+ */
+ const QColor& backgroundColor();
+ /**
+ * @returns true, if the item is at an odd position and
+ * thus have to be painted with the alternate background color.
+ */
+ bool isAlternate();
+ /**
+ * @note: Reimplemented for internal purposes - the API is not affected
+ *
+ */
+ void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment );
+ /**
+ * Perform object initialization.
+ */
+ void init();
+
+ private:
+ bool m_known;
+ bool m_odd;
+};
+
+
/*======================================================================================
* ONamedListView
*======================================================================================*/
class ONamedListViewItem;
/**
* @brief An OListView variant with named columns.
*
* This class provides a higher-level interface to an OListView.
*
- * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+ * @author Michael 'Mickey' Lauer <mickey@vanille.de>
*/
class ONamedListView: public OListView
{
public:
/**
* Constructor.
*
* The parameters @a parent and @a name are handled by
* @ref OListView, as usual.
*/
ONamedListView( QWidget* parent = 0, const char* name = 0 );
/**
@@ -301,25 +356,25 @@ class ONamedListView: public OListView
virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const;
};
/*======================================================================================
* ONamedListViewItem
*======================================================================================*/
/**
* @brief An OListView variant with named columns.
*
* This class provides a higher-level interface to an OListViewItem.
*
- * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+ * @author Michael 'Mickey' Lauer <mickey@vanille.de>
*/
class ONamedListViewItem: public OListViewItem
{
public:
/**
* Constructor. Accepts the same parameters as a @ref OListViewItem,
* plus a @ref QStringList which holds an arbitrary number of @a texts.
*/
ONamedListViewItem( QListView* parent, const QStringList& texts );
ONamedListViewItem( QListViewItem* parent, const QStringList& texts );
ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts );
ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts );