2007-05-22 18:48:34 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 by Matias Valdenegro T. <mvaldenegro@informatica.utem.cl>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __LAYOUT_ITEM__
|
|
|
|
#define __LAYOUT_ITEM__
|
|
|
|
|
|
|
|
#include <QtCore/QRectF>
|
|
|
|
#include <QtCore/QSizeF>
|
|
|
|
|
2007-05-29 10:02:01 +02:00
|
|
|
#include <plasma_export.h>
|
2007-05-22 18:48:34 +02:00
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2007-05-28 07:46:24 +02:00
|
|
|
class Layout;
|
|
|
|
|
2007-05-25 03:27:27 +02:00
|
|
|
/**
|
|
|
|
* Base class for Plasma layout-managed items
|
|
|
|
*/
|
2007-05-29 10:02:01 +02:00
|
|
|
class PLASMA_EXPORT LayoutItem
|
2007-05-22 18:48:34 +02:00
|
|
|
{
|
2007-05-28 07:46:24 +02:00
|
|
|
public:
|
|
|
|
LayoutItem();
|
|
|
|
virtual ~LayoutItem();
|
|
|
|
|
|
|
|
virtual Qt::Orientations expandingDirections() const = 0;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-05-28 07:46:24 +02:00
|
|
|
virtual QSizeF minimumSize() const = 0;
|
|
|
|
virtual QSizeF maximumSize() const = 0;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-05-28 07:46:24 +02:00
|
|
|
virtual bool hasHeightForWidth() const;
|
|
|
|
virtual qreal heightForWidth(qreal w) const;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-05-28 07:46:24 +02:00
|
|
|
virtual bool hasWidthForHeight() const;
|
|
|
|
virtual qreal widthForHeight(qreal h) const;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-05-28 07:46:24 +02:00
|
|
|
virtual QRectF geometry() const = 0;
|
|
|
|
virtual void setGeometry(const QRectF& geometry) = 0;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-05-28 07:46:24 +02:00
|
|
|
virtual QSizeF sizeHint() const = 0;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-05-28 07:52:05 +02:00
|
|
|
/**
|
|
|
|
* Resets the layout to 0 and doesn't notify the previous layout.
|
|
|
|
* Should only be used by the current layout when relinquishing the item,
|
|
|
|
* e.g. during layout destruction.
|
|
|
|
*/
|
|
|
|
void resetLayout();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the layout so that the LayoutItem may inform the layout of its
|
|
|
|
* deletion. Should only be used by the layout it is added to.
|
|
|
|
*
|
|
|
|
* If the layout item is currently associated with another layout, it will
|
|
|
|
* first remove itself from that layout.
|
|
|
|
*
|
|
|
|
* @param layout The Layout that this LayoutItem will be managed by.
|
|
|
|
*/
|
2007-05-28 07:46:24 +02:00
|
|
|
void setLayout(Layout* layout);
|
2007-05-28 07:52:05 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the layout this item is currently associated with
|
|
|
|
*/
|
2007-05-28 07:46:24 +02:00
|
|
|
Layout* layout();
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-05-28 07:46:24 +02:00
|
|
|
private:
|
|
|
|
class Private;
|
|
|
|
Private *const d;
|
2007-05-22 18:48:34 +02:00
|
|
|
};
|
|
|
|
|
2007-05-22 21:23:22 +02:00
|
|
|
}
|
2007-05-22 18:48:34 +02:00
|
|
|
|
|
|
|
#endif /* __LAYOUT_ITEM__ */
|