-rw-r--r-- | libopie2/opieui/olistview.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/libopie2/opieui/olistview.h b/libopie2/opieui/olistview.h index 99770bf..1bbdd5b 100644 --- a/libopie2/opieui/olistview.h +++ b/libopie2/opieui/olistview.h @@ -148,163 +148,194 @@ class OListViewItem: public QListViewItem 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, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null ); OListViewItem( QListViewItem * parent, QString, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null ); OListViewItem( QListView * 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 ); 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 ); /** * Destructor. */ virtual ~OListViewItem(); /** * @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(); /** * create a list view item as child of this object * @returns the new object */ virtual OListViewItem* childFactory(); #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; }; #ifndef QT_NO_DATASTREAM /** * @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 /*====================================================================================== * ONamedListView *======================================================================================*/ +class ONamedListViewItem; + /** * @brief An OListView variant with named columns. * - * This class provides a higher-level interface to the columns in an OListView. + * This class provides a higher-level interface to an OListView. * * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.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 ); /** * Destructor. */ virtual ~ONamedListView(); /** * Add a number of @a columns to the listview. */ virtual void addColumns( const QStringList& columns ); + /** + * @returns the column index matching to @a text or -1 if not found. + */ + virtual int findColumn( const QString& text ) const; + /** + * @returns the first item which has a @a text in column @a column. + * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> + * <li>set it to 0 to search only among direct childs, + * <li>set it to 1 to search direct childs and all 1st order subchilds + * <li>set it to -1 for maximum recursion. + * </ul> + * @sa ONamedListViewItem::find() + */ + virtual ONamedListViewItem* find( ONamedListViewItem* start, int column, const QString& text, int recurse = -1 ) const; + virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; + + virtual ONamedListViewItem* find( ONamedListViewItem* start, const QString& column, const QString& text, int recurse = -1 ) const; + 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 the columns in an OListViewItem. + * This class provides a higher-level interface to an OListViewItem. * * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.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 ); /** * Destructor. */ virtual ~ONamedListViewItem(); /** * Sets the text in column @a column to @a text. * This method differs from @ref QListViewItem::setText() in that it * accepts a string as column indicator instead of an int. */ virtual void setText( const QString& column, const QString& text ); /** * Sets a number of @a texts for this item. */ virtual void setText( const QStringList& texts ); + /** + * @returns the first child which has a @a text in column @a column. + * Set @a recurse to indicate how much subchild levels to search, e.g.<ul> + * <li>set it to 0 to search only among direct childs, + * <li>set it to 1 to search direct childs and all 1st order subchilds + * <li>set it to -1 for maximum recursion. + * </ul> + * @sa ONamedListView::find() + */ + virtual ONamedListViewItem* find( int column, const QString& text, int recurse = -1 ) const; + virtual ONamedListViewItem* find( const QString& column, const QString& text, int recurse = -1 ) const; }; #endif // OLISTVIEW_H |