2007-03-01 20:58:19 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 by Alexander Wiedenbruch <mail@wiedenbruch.de>
|
2007-05-22 18:48:34 +02:00
|
|
|
* and Matias Valdenegro <mvaldenegro@informatica.utem.cl>
|
2007-03-01 20:58:19 +01: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 WIDGET_H_
|
|
|
|
#define WIDGET_H_
|
|
|
|
|
2007-04-22 11:35:04 +02:00
|
|
|
#include <QtGui/QGraphicsItem>
|
2007-03-01 20:58:19 +01:00
|
|
|
|
2007-05-22 18:48:34 +02:00
|
|
|
#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-03-02 15:34:41 +01:00
|
|
|
|
2007-03-02 06:27:33 +01:00
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2007-05-22 18:48:34 +02:00
|
|
|
class Layout;
|
|
|
|
|
2007-05-20 18:25:07 +02:00
|
|
|
/**
|
|
|
|
* Class that emulates a QWidget inside plasma
|
|
|
|
*/
|
2007-05-29 10:02:01 +02:00
|
|
|
class PLASMA_EXPORT Widget : public QGraphicsItem, public LayoutItem
|
2007-03-01 20:58:19 +01:00
|
|
|
{
|
2007-07-12 19:54:58 +02:00
|
|
|
public:
|
2007-07-12 20:11:50 +02:00
|
|
|
explicit Widget(QGraphicsItem *parent = 0);
|
2007-07-12 19:54:58 +02:00
|
|
|
virtual ~Widget();
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
virtual Qt::Orientations expandingDirections() const;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
virtual QSizeF minimumSize() const;
|
|
|
|
virtual QSizeF maximumSize() const;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
virtual bool hasHeightForWidth() const;
|
|
|
|
virtual qreal heightForWidth(qreal w) const;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
virtual bool hasWidthForHeight() const;
|
|
|
|
virtual qreal widthForHeight(qreal h) const;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
QRectF geometry() const;
|
2007-07-12 20:11:50 +02:00
|
|
|
void setGeometry(const QRectF &geometry);
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
void updateGeometry();
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
virtual void invalidate();
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
virtual QSizeF sizeHint() const;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
QSizeF size() const;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
virtual QRectF boundingRect() const;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 20:11:50 +02:00
|
|
|
void resize(const QSizeF &size);
|
2007-07-12 19:54:58 +02:00
|
|
|
void resize(qreal w, qreal h);
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
void setLayout(Layout *l);
|
|
|
|
Layout *layout() const;
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
Widget *parent() const;
|
|
|
|
void reparent(Widget *w);
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
void addChild(Widget *w);
|
2007-07-12 20:11:50 +02:00
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
2007-05-22 18:48:34 +02:00
|
|
|
|
2007-07-12 19:54:58 +02:00
|
|
|
private:
|
|
|
|
class Private;
|
|
|
|
Private *const d;
|
2007-03-01 20:58:19 +01:00
|
|
|
};
|
|
|
|
|
2007-03-02 06:27:33 +01:00
|
|
|
} // Plasma namespace
|
|
|
|
|
2007-03-01 20:58:19 +01:00
|
|
|
#endif
|