- missing license header

- fix white space issues
- delete the dptr

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=711899
This commit is contained in:
Aaron J. Seigo 2007-09-13 05:40:37 +00:00
parent 926d039802
commit 7d533e3472
2 changed files with 46 additions and 8 deletions

View File

@ -1,7 +1,28 @@
/*
* Copyright 2007 by Robert Knight <robertknight@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <plasma/plasma_export.h>
#include <plasma/widgets/layout.h>
#include "freelayout.h"
using namespace Plasma;
namespace Plasma
{
class FreeLayout::Private
{
@ -11,52 +32,69 @@ public:
};
FreeLayout::FreeLayout(LayoutItem *parent)
: Layout(parent)
, d(new Private)
: Layout(parent),
d(new Private)
{
}
FreeLayout::~FreeLayout()
{
delete d;
}
Qt::Orientations FreeLayout::expandingDirections() const
{
return Qt::Horizontal | Qt::Vertical;
}
void FreeLayout::addItem(LayoutItem *item)
{
d->children << item;
item->setManagingLayout(this);
}
void FreeLayout::removeItem(LayoutItem *item)
{
d->children.removeAll(item);
}
int FreeLayout::indexOf(LayoutItem *item) const
{
return d->children.indexOf(item);
}
LayoutItem * FreeLayout::itemAt(int i) const
{
return d->children[i];
}
int FreeLayout::count() const
{
return d->children.count();
}
LayoutItem * FreeLayout::takeAt(int i)
LayoutItem * FreeLayout::takeAt(int i)
{
return d->children.takeAt(i);
}
void FreeLayout::setGeometry(const QRectF& geometry)
void FreeLayout::setGeometry(const QRectF &geometry)
{
foreach( LayoutItem *child , d->children ) {
child->setGeometry( QRectF(child->geometry().topLeft(),child->sizeHint()) );
foreach (LayoutItem *child , d->children) {
child->setGeometry(QRectF(child->geometry().topLeft(),child->sizeHint()));
}
d->geometry = geometry;
}
QRectF FreeLayout::geometry() const
{
return d->geometry;
}
QSizeF FreeLayout::sizeHint() const
{
return maximumSize();
}
}

View File

@ -38,11 +38,11 @@ namespace Plasma
class PLASMA_EXPORT FreeLayout : public Layout
{
public:
/**
* Creates a new free layout
*/
explicit FreeLayout(LayoutItem *parent = 0);
~FreeLayout();
// reimplemented from Layout
virtual void addItem(LayoutItem *l);