2 * Copyright (C) 2007 Ivan Cukic <ivan.cukic+kde@gmail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library/Lesser General Public License
6 * version 2, or (at your option) any later version, as published by the
7 * Free Software Foundation
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/Lesser 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 PLASMA_BORDER_LAYOUT
21 #define PLASMA_BORDER_LAYOUT
23 #include <QtCore/QMap>
25 #include <QtGui/QGraphicsLayout>
27 #include <plasma/plasma_export.h>
28 #include <plasma/plasma.h>
33 * A layout which lays one item per border (left, top, bottom, right)
34 * and one item in center.
36 * Similar to java.awt.BorderLayout from the Java's standard library
38 class PLASMA_EXPORT BorderLayout
: public QGraphicsLayout
{
41 explicit BorderLayout(QGraphicsLayoutItem
* parent
= 0);
42 virtual ~BorderLayout();
45 * Adds item in the center. Equal to:
46 * addItem(item, Plasma::CenterPositioned);
48 void addItem(QGraphicsLayoutItem
* item
);
51 * Adds item at the specified position
53 void addItem(QGraphicsLayoutItem
* item
, Position position
);
55 void removeItem(QGraphicsLayoutItem
* item
);
57 virtual int count() const;
58 virtual int indexOf(QGraphicsLayoutItem
* item
) const;
59 virtual QGraphicsLayoutItem
* itemAt(int i
) const;
60 virtual QGraphicsLayoutItem
* takeAt(int i
);
63 * Deactivates the automatic sizing of a border widget,
64 * and sets it to the specified size.
66 * For left and right widgets, it sets the width; while
67 * for top and bottom ones, it sets the height.
69 void setSize(qreal size
, Position border
);
72 * Activates the automatic sizing of a border widget,
73 * according to it's sizeHint()
75 void setAutoSize(Position border
);
78 * Returns the size of the specified border widget. If
79 * automatic sizing for that border widget is activated,
80 * it will return a value less than zero.
82 qreal
size(Position border
);
84 qreal
spacing() const;
85 void setSpacing(qreal s
);
89 QSizeF
sizeHint(Qt::SizeHint which
, const QSizeF
&constraint
= QSizeF()) const;
98 #endif /* PLASMA_BORDER_LAYOUT */