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
#include <plasma/plasma_export.h>
22
#include <plasma/widgets/layout.h>
24
#include "freelayout.h"
29
class FreeLayout::Private
32
QList<LayoutItem*> children;
36
FreeLayout::FreeLayout(LayoutItem *parent)
42
FreeLayout::~FreeLayout()
47
Qt::Orientations FreeLayout::expandingDirections() const
49
return Qt::Horizontal | Qt::Vertical;
52
void FreeLayout::addItem(LayoutItem *item)
55
item->setManagingLayout(this);
58
void FreeLayout::removeItem(LayoutItem *item)
60
d->children.removeAll(item);
63
int FreeLayout::indexOf(LayoutItem *item) const
65
return d->children.indexOf(item);
68
LayoutItem * FreeLayout::itemAt(int i) const
70
return d->children[i];
73
int FreeLayout::count() const
75
return d->children.count();
78
LayoutItem * FreeLayout::takeAt(int i)
80
return d->children.takeAt(i);
83
void FreeLayout::setGeometry(const QRectF &geometry)
85
foreach (LayoutItem *child , d->children) {
86
if (child->geometry().size() != child->sizeHint()) {
87
child->setGeometry(QRectF(child->geometry().topLeft(),child->sizeHint()));
90
d->geometry = geometry;
93
QRectF FreeLayout::geometry() const
98
QSizeF FreeLayout::sizeHint() const
100
return maximumSize();