2007-05-22 18:48:34 +02:00
|
|
|
/*
|
2007-08-06 13:20:02 +02:00
|
|
|
* Copyright 2007 by Matias Valdenegro T. <mvaldenegro@informatica.utem.cl>
|
2007-05-22 18:48:34 +02:00
|
|
|
*
|
|
|
|
* 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__
|
|
|
|
#define __LAYOUT__
|
|
|
|
|
|
|
|
#include <QtCore/QRectF>
|
|
|
|
#include <QtCore/QSizeF>
|
|
|
|
|
2007-06-02 19:29:39 +02:00
|
|
|
#include <plasma/widgets/layoutitem.h>
|
|
|
|
#include <plasma/plasma_export.h>
|
2007-05-22 18:48:34 +02:00
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2007-05-25 03:27:27 +02:00
|
|
|
/**
|
|
|
|
* Base class for Plasma Layout managers
|
2007-07-23 00:16:40 +02:00
|
|
|
*
|
|
|
|
* @author Matias Valdenegro T. <mvaldenegro@informatica.utem.cl>
|
|
|
|
*
|
|
|
|
* All layout managers must implement this class. Normal users should use the specific layouts,
|
|
|
|
* like Plasma::VBoxLayout, Plasma::HBoxLayout and Plasma::GridLayout.
|
2007-05-25 03:27:27 +02:00
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-05-29 10:02:01 +02:00
|
|
|
class PLASMA_EXPORT Layout : public LayoutItem
|
2007-05-22 18:48:34 +02:00
|
|
|
{
|
|
|
|
public:
|
2007-07-23 00:16:40 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*/
|
2007-07-26 00:20:15 +02:00
|
|
|
explicit Layout(LayoutItem *parent);
|
2007-07-23 00:16:40 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Virtual Destructor.
|
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
virtual ~Layout();
|
|
|
|
|
2007-07-23 00:16:40 +02:00
|
|
|
/**
|
|
|
|
* Returns the margin of this Layout.
|
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
qreal margin() const;
|
2007-07-23 00:16:40 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the margin of this Layout.
|
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
void setMargin(qreal m);
|
|
|
|
|
2007-07-23 00:16:40 +02:00
|
|
|
/**
|
|
|
|
* Returns the spacing between Layout elements of this Layout.
|
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
qreal spacing() const;
|
2007-07-23 00:16:40 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the spacing of this Layout.
|
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
void setSpacing(qreal s);
|
|
|
|
|
2007-07-23 00:16:40 +02:00
|
|
|
/**
|
|
|
|
* Returns the parent of this Layout.
|
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
LayoutItem *parent() const;
|
|
|
|
|
2007-07-23 00:16:40 +02:00
|
|
|
/**
|
|
|
|
* Returns the number of elements of this Layout.
|
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
virtual int count() const = 0;
|
2007-07-23 00:16:40 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this Layout contains no elements, false otherwise.
|
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
virtual bool isEmpty() const = 0;
|
|
|
|
|
2007-07-23 00:16:40 +02:00
|
|
|
/**
|
|
|
|
* Adds a Item to this Layout.
|
|
|
|
* @param l Pointer to the Item to be added.
|
|
|
|
*/
|
|
|
|
virtual void addItem(LayoutItem *l) = 0;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-23 00:16:40 +02:00
|
|
|
/**
|
|
|
|
* Removes a Item from this Layout.
|
|
|
|
* @param l Pointer to the Item to be removed.
|
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
virtual void removeItem(LayoutItem *l) = 0;
|
|
|
|
|
2007-07-23 00:16:40 +02:00
|
|
|
/**
|
|
|
|
* Returns the index of a Item in this Layout.
|
|
|
|
* @param l Pointer to an Item to be queryed.
|
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
virtual int indexOf(LayoutItem *l) const = 0;
|
2007-07-23 00:16:40 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a Pointer to an Item in this Layout.
|
|
|
|
* @param i Index of the desired Item.
|
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
virtual LayoutItem *itemAt(int i) const = 0;
|
2007-07-23 00:16:40 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Takes the Pointer of an Item in this Layout.
|
|
|
|
* @param i Index of the desired Item.
|
|
|
|
*/
|
2007-05-22 18:48:34 +02:00
|
|
|
virtual LayoutItem *takeAt(int i) = 0;
|
|
|
|
|
|
|
|
private:
|
|
|
|
class Private;
|
|
|
|
Private *const d;
|
|
|
|
};
|
|
|
|
|
2007-05-22 21:23:22 +02:00
|
|
|
}
|
2007-05-22 18:48:34 +02:00
|
|
|
|
|
|
|
#endif /* __LAYOUT__ */
|