2007-09-10 22:38:59 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2007 by Robert Knight <robertknight@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2007-09-14 22:17:11 +02:00
|
|
|
* it under the terms of the GNU Library General Public License as
|
2007-09-14 21:06:18 +02:00
|
|
|
* published by the Free Software Foundation; either version 2, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
2007-09-10 22:38:59 +02:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2007-09-26 12:37:08 +02:00
|
|
|
#ifndef PLASMA_FREE_LAYOUT_H
|
|
|
|
#define PLASMA_FREE_LAYOUT_H
|
2007-09-10 22:38:59 +02:00
|
|
|
|
|
|
|
#include <QtCore/QList>
|
|
|
|
|
|
|
|
#include <plasma/plasma_export.h>
|
2008-02-29 18:50:57 +01:00
|
|
|
#include <plasma/layouts/layout.h>
|
2007-09-10 22:38:59 +02:00
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The FreeLayout class is a layout for use in desktop-like workspaces where
|
2007-09-26 12:37:08 +02:00
|
|
|
* items can be moved around freely and applets and widgets are allowed
|
2007-09-10 22:38:59 +02:00
|
|
|
* to determine their own size.
|
|
|
|
*
|
|
|
|
* Whenever this layout is updated, all child items are resized to
|
2008-03-26 09:35:08 +01:00
|
|
|
* their sizeHint() and left in their existing positions relative
|
|
|
|
* to the layout borders.
|
2007-09-10 22:38:59 +02:00
|
|
|
*/
|
2008-02-29 18:50:57 +01:00
|
|
|
class PLASMA_EXPORT FreeLayout : public Layout
|
2007-09-10 22:38:59 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Creates a new free layout
|
|
|
|
*/
|
2008-02-29 18:50:57 +01:00
|
|
|
explicit FreeLayout(LayoutItem *parent = 0);
|
2007-09-13 07:40:37 +02:00
|
|
|
~FreeLayout();
|
2007-09-10 22:38:59 +02:00
|
|
|
|
|
|
|
// reimplemented from Layout
|
2008-02-29 18:50:57 +01:00
|
|
|
virtual void addItem(LayoutItem *l);
|
|
|
|
virtual void removeItem(LayoutItem *l);
|
|
|
|
virtual int indexOf(LayoutItem *l) const;
|
|
|
|
virtual LayoutItem *itemAt(int i) const;
|
|
|
|
virtual LayoutItem *takeAt(int i);
|
|
|
|
virtual Qt::Orientations expandingDirections() const;
|
2007-09-10 22:38:59 +02:00
|
|
|
virtual QRectF geometry() const;
|
|
|
|
virtual int count() const;
|
|
|
|
|
2008-02-29 18:50:57 +01:00
|
|
|
virtual QSizeF sizeHint() const;
|
2007-09-10 22:38:59 +02:00
|
|
|
|
2007-11-20 00:45:56 +01:00
|
|
|
protected:
|
|
|
|
void relayout();
|
2008-02-29 18:50:57 +01:00
|
|
|
void releaseManagedItems();
|
2007-11-20 00:45:56 +01:00
|
|
|
|
2007-09-10 22:38:59 +02:00
|
|
|
private:
|
|
|
|
class Private;
|
|
|
|
Private *const d;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-09-26 12:37:08 +02:00
|
|
|
#endif /* PLASMA_FREE_LAYOUT_H */
|