File indexing completed on 2024-05-05 04:49:26

0001 /****************************************************************************************
0002  * Copyright (c) 2004-2008 Trolltech ASA <copyright@trolltech.com>                      *
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) version 3 or any    *
0007  * later version publicly approved by Trolltech ASA (or its successor, if any) and the  *
0008  * KDE Free Qt Foundation.                                                              *
0009  *                                                                                      *
0010  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0012  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0013  *                                                                                      *
0014  * You should have received a copy of the GNU General Public License along with         *
0015  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0016  *                                                                                      *
0017  * In addition, Trolltech gives you certain additional rights as described in the       *
0018  * Trolltech GPL Exception version 1.2 which can be found at                            *
0019  * http://www.trolltech.com/products/qt/gplexception/                                   *
0020  ****************************************************************************************/
0021 
0022 #ifndef FLOWLAYOUT_H
0023 #define FLOWLAYOUT_H
0024 
0025 
0026 #include "amarok_export.h"
0027 
0028 #include <QLayout>
0029 #include <QRect>
0030 #include <QWidgetItem>
0031 
0032 
0033 
0034  class AMAROK_EXPORT FlowLayout : public QLayout
0035 {
0036     public:
0037         explicit FlowLayout(QWidget *parent, int margin = 0, int spacing = -1);
0038         explicit FlowLayout(int spacing = -1);
0039         ~FlowLayout() override;
0040 
0041         void addItem(QLayoutItem *item) override;
0042         Qt::Orientations expandingDirections() const override;
0043         bool hasHeightForWidth() const override;
0044         int heightForWidth(int) const override;
0045         int count() const override;
0046         QLayoutItem *itemAt(int index) const override;
0047         QSize minimumSize() const override;
0048         void setGeometry(const QRect &rect) override;
0049         QSize sizeHint() const override;
0050         QLayoutItem *takeAt(int index) override;
0051 
0052     private:
0053         int doLayout(const QRect &rect, bool testOnly) const;
0054 
0055         QList<QLayoutItem *> itemList;
0056 };
0057 
0058 #endif