2007-09-01 14:34:22 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2007 by Robert Knight <robertknight@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2007-11-23 01:03:27 +01:00
|
|
|
* it under the terms of the GNU Library General Public License
|
|
|
|
* as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
2007-09-01 14:34:22 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __FLOWLAYOUT__
|
|
|
|
#define __FLOWLAYOUT__
|
|
|
|
|
2008-02-29 18:43:31 +01:00
|
|
|
#include <QtGui/QGraphicsLayout>
|
|
|
|
|
2007-09-01 14:34:22 +02:00
|
|
|
#include <plasma/plasma_export.h>
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A layout which lays items out left-to-right , top-to-bottom.
|
|
|
|
*
|
|
|
|
* This is similar to the layout of items in a QListView.
|
|
|
|
*/
|
2008-02-29 18:43:31 +01:00
|
|
|
class PLASMA_EXPORT FlowLayout : public QGraphicsLayout
|
2007-09-01 14:34:22 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Construct a new flow layout with the specified parent. */
|
2008-02-29 18:43:31 +01:00
|
|
|
explicit FlowLayout(QGraphicsLayoutItem* parent);
|
2007-09-01 14:34:22 +02:00
|
|
|
virtual ~FlowLayout();
|
|
|
|
|
|
|
|
// reimplemented
|
|
|
|
virtual int count() const;
|
2008-02-29 18:43:31 +01:00
|
|
|
virtual void addItem(QGraphicsLayoutItem* item);
|
|
|
|
virtual void removeItem(QGraphicsLayoutItem* item);
|
|
|
|
virtual int indexOf(QGraphicsLayoutItem* item) const;
|
|
|
|
virtual QGraphicsLayoutItem* itemAt(int i) const;
|
|
|
|
virtual QGraphicsLayoutItem* takeAt(int i);
|
|
|
|
virtual void removeAt(int i);
|
2007-11-06 03:46:01 +01:00
|
|
|
virtual void setColumnWidth( const qreal width );
|
|
|
|
virtual qreal columnWidth() const;
|
2008-02-29 18:43:31 +01:00
|
|
|
virtual QRectF geometry() const;
|
|
|
|
virtual void setGeometry(const QRectF &geom);
|
|
|
|
qreal spacing() const;
|
|
|
|
void setSpacing(qreal s);
|
2007-09-01 14:34:22 +02:00
|
|
|
|
2007-11-20 00:45:56 +01:00
|
|
|
protected:
|
|
|
|
void relayout();
|
2008-02-29 18:43:31 +01:00
|
|
|
virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
|
2007-11-20 00:45:56 +01:00
|
|
|
|
2007-09-01 14:34:22 +02:00
|
|
|
private:
|
|
|
|
class Private;
|
|
|
|
Private *const d;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __FLOWLAYOUT__
|
|
|
|
|