Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / libs / plasma / layouts / flowlayout.h
blob88ff1f9f57150bb2e24e8d2e3c018573e03d6cbe
1 /*
2 * Copyright 2007 by Robert Knight <robertknight@gmail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License
6 * as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __FLOWLAYOUT__
21 #define __FLOWLAYOUT__
23 #include <QtGui/QGraphicsLayout>
25 #include <plasma/plasma_export.h>
27 namespace Plasma
30 /**
31 * A layout which lays items out left-to-right , top-to-bottom.
33 * This is similar to the layout of items in a QListView.
35 class PLASMA_EXPORT FlowLayout : public QGraphicsLayout
37 public:
38 /** Construct a new flow layout with the specified parent. */
39 explicit FlowLayout(QGraphicsLayoutItem* parent);
40 virtual ~FlowLayout();
42 // reimplemented
43 virtual int count() const;
44 virtual void addItem(QGraphicsLayoutItem* item);
45 virtual void removeItem(QGraphicsLayoutItem* item);
46 virtual int indexOf(QGraphicsLayoutItem* item) const;
47 virtual QGraphicsLayoutItem* itemAt(int i) const;
48 virtual QGraphicsLayoutItem* takeAt(int i);
49 virtual void removeAt(int i);
50 virtual void setColumnWidth( const qreal width );
51 virtual qreal columnWidth() const;
52 virtual QRectF geometry() const;
53 virtual void setGeometry(const QRectF &geom);
54 qreal spacing() const;
55 void setSpacing(qreal s);
57 protected:
58 void relayout();
59 virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
61 private:
62 class Private;
63 Private *const d;
68 #endif // __FLOWLAYOUT__