2
* Copyright (C) 2007 Ivan Cukic <ivan.cukic(at)kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser/Library General Public License version 2,
6
* or (at your option) any later version, as published by the Free
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 Lesser/Library General Public License for more details
14
* You should have received a copy of the GNU Lesser/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 LANCELOT_FULL_BORDER_LAYOUT_H
21
#define LANCELOT_FULL_BORDER_LAYOUT_H
23
#include <QGraphicsLayout>
25
#include <lancelot/lancelot_export.h>
30
* A modified version of Plasma::BorderLayout
32
* A layout which lays one item per border (left, top, bottom, right)
33
* one per corner and one item in center.
38
class LANCELOT_EXPORT FullBorderLayout : public QGraphicsLayout {
44
TopBorder = 1, /** Top border */
45
BottomBorder = 2, /** Bottom border */
46
LeftBorder = 4, /** Left border */
47
RightBorder = 8 /** Right border */
51
* Positions supported by FullBorderLayout
56
Bottom = BottomBorder,
59
TopLeft = TopBorder | LeftBorder,
60
TopRight = TopBorder | RightBorder,
61
BottomLeft = BottomBorder | LeftBorder,
62
BottomRight = BottomBorder | RightBorder
66
* Creates a new Lancelot::FullBorderLayout
67
* @param parent parent layout item
69
explicit FullBorderLayout(QGraphicsLayoutItem * parent = 0);
72
* Destroys this Lancelot::FullBorderLayout
74
virtual ~FullBorderLayout();
77
* Adds item in the center.
78
* Equal to: addItem(item, Center);
79
* @param item item to add
81
void addItem(QGraphicsLayoutItem * item);
84
* Adds item at the specified position
85
* @param item item to add
86
* @param position position to which to add
88
void addItem(QGraphicsLayoutItem * item, Place position);
91
* Deactivates the automatic sizing of a border widget,
92
* and sets it to the specified size.
94
* For left and right widgets, it sets the width; while
95
* for top and bottom ones, it sets the height.
97
* @param size size of the border
98
* @param border border for which the size is being specified
100
void setSize(qreal size, Border border);
103
* Activates the automatic sizing of a border widget,
104
* according to it's sizeHint()
105
* @param border border for which the auto size is being specified
107
void setAutoSize(Border border);
110
* Returns the size of the specified border widget.
112
* If automatic sizing for that border widget is activated,
113
* it will return a value less than zero.
115
* @param border border for which the size is requested
117
qreal size(Border border) const;
119
L_Override void setGeometry(const QRectF & rect);
120
L_Override int count() const;
121
L_Override QGraphicsLayoutItem * itemAt(int i) const;
122
L_Override void removeAt(int index);
123
L_Override QSizeF sizeHint(Qt::SizeHint which,
124
const QSizeF & constraint = QSizeF()) const;
131
} // namespace Lancelot
133
#endif /* LANCELOT_FULL_BORDER_LAYOUT_H */