Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / libs / plasma / layouts / freelayout.h
blob162f47e780d1e47560024a9329703ffa2d258698
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 as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef PLASMA_FREE_LAYOUT_H
22 #define PLASMA_FREE_LAYOUT_H
24 #include <QtCore/QList>
26 #include <QtGui/QGraphicsLayout>
28 #include <plasma/plasma_export.h>
30 namespace Plasma
33 /**
34 * The FreeLayout class is a layout for use in desktop-like workspaces where
35 * items can be moved around freely and applets and widgets are allowed
36 * to determine their own size.
38 * Whenever this layout is updated, all child items are resized to
39 * their sizeHint() and left in their existing positions.
41 class PLASMA_EXPORT FreeLayout : public QGraphicsLayout
43 public:
44 /**
45 * Creates a new free layout
47 explicit FreeLayout(QGraphicsLayoutItem *parent = 0);
48 ~FreeLayout();
50 // reimplemented from Layout
51 virtual void addItem(QGraphicsLayoutItem *l);
52 virtual void removeItem(QGraphicsLayoutItem *l);
53 virtual int indexOf(QGraphicsLayoutItem *l) const;
54 virtual QGraphicsLayoutItem *itemAt(int i) const;
55 virtual QGraphicsLayoutItem *takeAt(int i);
56 virtual void removeAt(int i);
57 virtual QRectF geometry() const;
58 virtual void setGeometry(const QRectF &geom);
59 virtual int count() const;
61 virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
63 protected:
64 void relayout();
66 private:
67 class Private;
68 Private *const d;
73 #endif /* PLASMA_FREE_LAYOUT_H */