F:/KPlato/koffice/libs/flake/KoShapeContainer.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002  * Copyright (C) 2006 Thomas Zander <zander@kde.org>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; see the file COPYING.LIB.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef KOGRAPHICBASECONTAINER_H
00021 #define KOGRAPHICBASECONTAINER_H
00022 
00023 #include "KoShape.h"
00024 #include "KoViewConverter.h"
00025 
00026 #include <QList>
00027 
00028 #include <koffice_export.h>
00029 
00030 class QPainter;
00031 class QPointF;
00032 
00040 class FLAKE_EXPORT KoShapeContainerModel {
00041 public:
00043     KoShapeContainerModel() {} ;
00044 
00046     virtual ~KoShapeContainerModel() {} ;
00047 
00052     virtual void add(KoShape *child) = 0;
00053 
00058     virtual void remove(KoShape *child) = 0;
00059 
00066     virtual void setClipping(const KoShape *child, bool clipping) = 0;
00067 
00074     virtual bool childClipped(const KoShape *child) const = 0;
00075 
00080     virtual int count() const = 0;
00081 
00086     virtual QList<KoShape*> iterator() const = 0;
00087 
00095     virtual void containerChanged(KoShapeContainer *container) = 0;
00096 };
00097 
00132 class FLAKE_EXPORT KoShapeContainer : public KoShape {
00133 
00134 public:
00135 
00139     KoShapeContainer();
00140 
00145     KoShapeContainer(KoShapeContainerModel *model);
00146 
00148     virtual ~KoShapeContainer();
00149 
00154     void addChild(KoShape *object);
00155 
00160     void removeChild(KoShape *object);
00161 
00166     int childCount() const;
00167 
00173     void setClipping(const KoShape *child, bool clipping);
00174 
00180     bool childClipped(const KoShape *child) const;
00181 
00182     void paint(QPainter &painter, const KoViewConverter &converter);
00183 
00193     virtual void paintComponent(QPainter &painter, const KoViewConverter &converter) = 0;
00194 
00195     void repaint() const;
00196 
00201     QList<KoShape*> iterator() const;
00202 
00203 protected:
00210     virtual void childCountChanged() { }
00211 
00212 private:
00215     class ChildrenData : public KoShapeContainerModel {
00216         public:
00217             ChildrenData();
00218             ~ChildrenData();
00219             void add(KoShape *child);
00220             void setClipping(const KoShape *child, bool clipping);
00221             bool childClipped(const KoShape *child) const;
00222             void remove(KoShape *child);
00223             int count() const;
00224             QList<KoShape*> iterator() const;
00225             void containerChanged(KoShapeContainer *container);
00226 
00227         private:
00231             class Relation {
00232                 public:
00233                     Relation(KoShape *child);
00234                     KoShape* child() { return m_child; }
00235                     bool m_inside; 
00236                 private:
00237                     KoShape *m_child;
00238             };
00239 
00240             Relation* findRelation(const KoShape *child) const;
00241 
00242         private: // members
00243             QList <Relation *> m_relations;
00244     };
00245     void shapeChanged(ChangeType type);
00246 
00247 private: // members
00248     KoShapeContainerModel *m_children;
00249 };
00250 
00251 #endif

Généré le Wed Nov 22 23:40:59 2006 pour KPlato par  doxygen 1.5.1-p1