File indexing completed on 2025-01-05 04:25:45

0001 /****************************************************************************************
0002  * Copyright (c) 2010 Rick W. Chen <stuffcorpse@archlinux.us>                           *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef UPCOMINGEVENTSSTACK_H
0018 #define UPCOMINGEVENTSSTACK_H 
0019 
0020 #include <QGraphicsWidget>
0021 #include <QIcon>
0022 
0023 class UpcomingEventsStackItem;
0024 class UpcomingEventsStackPrivate;
0025 
0026 class UpcomingEventsStack : public QGraphicsWidget
0027 {
0028     Q_OBJECT
0029     Q_PROPERTY( int count READ count )
0030     Q_PROPERTY( bool empty READ isEmpty )
0031 
0032 public:
0033     explicit UpcomingEventsStack( QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = 0 );
0034     ~UpcomingEventsStack();
0035 
0036     int count() const; ///< number of list widgets in the stack widget
0037 
0038     void clear(); ///< clears the stack widget
0039 
0040     bool isEmpty() const; ///< whether the stack is empty
0041 
0042     bool hasItem( const QString &name ) const;
0043 
0044     UpcomingEventsStackItem *item( const QString &name ) const;
0045     QList<UpcomingEventsStackItem *> items( const QRegExp &pattern ) const;
0046 
0047     UpcomingEventsStackItem *create( const QString &name ); ///< creates a new stack item
0048     void remove( const QString &name ); ///< remove stack item with name
0049 
0050 public Q_SLOTS:
0051     void maximizeItem( const QString &name ); ///< expand item with name and collapse all else
0052     void cleanupListWidgets();
0053 
0054 Q_SIGNALS:
0055     void collapseStateChanged();
0056 
0057 private:
0058     UpcomingEventsStackPrivate *const d_ptr;
0059     Q_DECLARE_PRIVATE( UpcomingEventsStack )
0060     Q_DISABLE_COPY( UpcomingEventsStack )
0061 
0062     Q_PRIVATE_SLOT( d_ptr, void _itemDestroyed() )
0063 };
0064 
0065 #endif /* UPCOMINGEVENTSSTACK_H */