Add credits for Marek
[trojita.git] / src / Gui / FlowLayout.h
blobe58f179df510abeaaf56414ba6039fff972cc214
1 /* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
2 All rights reserved.
3 Contact: Nokia Corporation (qt-info@nokia.com)
5 This file is part of the Trojita Qt IMAP e-mail client,
6 http://trojita.flaska.net/
8 It was taken from the examples of the Qt Toolkit.
10 $QT_BEGIN_LICENSE:LGPL$
11 Commercial Usage
12 Licensees holding valid Qt Commercial licenses may use this file in
13 accordance with the Qt Commercial License Agreement provided with the
14 Software or, alternatively, in accordance with the terms contained in
15 a written agreement between you and Nokia.
17 GNU Lesser General Public License Usage
18 Alternatively, this file may be used under the terms of the GNU Lesser
19 General Public License version 2.1 as published by the Free Software
20 Foundation and appearing in the file LICENSE.LGPL included in the
21 packaging of this file. Please review the following information to
22 ensure the GNU Lesser General Public License version 2.1 requirements
23 will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 In addition, as a special exception, Nokia gives you certain additional
26 rights. These rights are described in the Nokia Qt LGPL Exception
27 version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 GNU General Public License Usage
30 Alternatively, this file may be used under the terms of the GNU
31 General Public License version 3.0 as published by the Free Software
32 Foundation and appearing in the file LICENSE.GPL included in the
33 packaging of this file. Please review the following information to
34 ensure the GNU General Public License version 3.0 requirements will be
35 met: http://www.gnu.org/copyleft/gpl.html.
37 If you have questions regarding the use of this file, please contact
38 Nokia at qt-info@nokia.com.
39 $QT_END_LICENSE$
42 #ifndef GUI_FLOWLAYOUT_H
43 #define GUI_FLOWLAYOUT_H
45 #include <QLayout>
46 #include <QRect>
47 #include <QStyle>
48 #include <QWidgetItem>
50 namespace Gui
53 class FlowLayout : public QLayout
55 public:
56 explicit FlowLayout(QWidget *parent, int margin = -1, int hSpacing = -1, int vSpacing = -1);
57 explicit FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1);
58 ~FlowLayout();
60 void addItem(QLayoutItem *item);
61 int horizontalSpacing() const;
62 int verticalSpacing() const;
63 Qt::Orientations expandingDirections() const;
64 bool hasHeightForWidth() const;
65 int heightForWidth(int) const;
66 int count() const;
67 QLayoutItem *itemAt(int index) const;
68 QSize minimumSize() const;
69 void setGeometry(const QRect &rect);
70 QSize sizeHint() const;
71 QLayoutItem *takeAt(int index);
73 private:
74 int doLayout(const QRect &rect, bool testOnly) const;
75 int smartSpacing(QStyle::PixelMetric pm) const;
77 QList<QLayoutItem *> itemList;
78 int m_hSpace;
79 int m_vSpace;
82 } // namespace Gui
84 #endif // GUI_FLOWLAYOUT_H