1 /****************************************************************************************
2  * Copyright (c) 2004-2008 Trolltech ASA <copyright@trolltech.com>                      *
3  *                                                                                      *
4  * This program is free software; you can redistribute it and/or modify it under        *
5  * the terms of the GNU General Public License as published by the Free Software        *
6  * Foundation; either version 2 of the License, or (at your option) version 3 or any    *
7  * later version publicly approved by Trolltech ASA (or its successor, if any) and the  *
8  * KDE Free Qt Foundation.                                                              *
9  *                                                                                      *
10  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
12  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
13  *                                                                                      *
14  * You should have received a copy of the GNU General Public License along with         *
15  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
16  *                                                                                      *
17  * In addition, Trolltech gives you certain additional rights as described in the       *
18  * Trolltech GPL Exception version 1.2 which can be found at                            *
19  * http://www.trolltech.com/products/qt/gplexception/                                   *
20  ****************************************************************************************/
21 
22 #ifndef FLOWLAYOUT_H
23 #define FLOWLAYOUT_H
24 
25 
26 #include "amarok_export.h"
27 
28 #include <QLayout>
29 #include <QRect>
30 #include <QWidgetItem>
31 
32 
33 
34  class AMAROK_EXPORT FlowLayout : public QLayout
35 {
36     public:
37         explicit FlowLayout(QWidget *parent, int margin = 0, int spacing = -1);
38         explicit FlowLayout(int spacing = -1);
39         ~FlowLayout() override;
40 
41         void addItem(QLayoutItem *item) override;
42         Qt::Orientations expandingDirections() const override;
43         bool hasHeightForWidth() const override;
44         int heightForWidth(int) const override;
45         int count() const override;
46         QLayoutItem *itemAt(int index) const override;
47         QSize minimumSize() const override;
48         void setGeometry(const QRect &rect) override;
49         QSize sizeHint() const override;
50         QLayoutItem *takeAt(int index) override;
51 
52     private:
53         int doLayout(const QRect &rect, bool testOnly) const;
54 
55         QList<QLayoutItem *> itemList;
56 };
57 
58 #endif
59