libs/flake

KoShapeContainer.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002  * Copyright (C) 2006-2009 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 KOSHAPECONTAINER_H
00021 #define KOSHAPECONTAINER_H
00022 
00023 #include "KoShape.h"
00024 #include "KoViewConverter.h"
00025 
00026 #include <QList>
00027 
00028 #include "flake_export.h"
00029 
00030 class QPainter;
00031 class KoShapeContainerModel;
00032 class KoShapeContainerPrivate;
00033 
00069 class FLAKE_EXPORT KoShapeContainer : public KoShape
00070 {
00071 public:
00072 
00076     KoShapeContainer();
00077 
00085     explicit KoShapeContainer(KoShapeContainerModel *model);
00086 
00091     virtual ~KoShapeContainer();
00092 
00097     void addChild(KoShape *shape);
00098 
00103     void removeChild(KoShape *shape);
00104 
00109     int childCount() const;
00110 
00116     void setClipping(const KoShape *child, bool clipping);
00117 
00123     bool childClipped(const KoShape *child) const;
00124 
00130     bool isChildLocked(const KoShape *child) const;
00131 
00133     virtual void paint(QPainter &painter, const KoViewConverter &converter);
00134 
00144     virtual void paintComponent(QPainter &painter, const KoViewConverter &converter) = 0;
00145 
00146     using KoShape::update;
00148     virtual void update() const;
00149 
00154     QList<KoShape*> childShapes() const;
00155 
00159     KoShapeContainerModel *model() const;
00160 
00161 protected:
00168     virtual void childCountChanged() { }
00169 
00171     KoShapeContainer(KoShapeContainerPrivate &);
00172 
00173 private:
00174     void shapeChanged(ChangeType type, KoShape *shape = 0);
00175 
00176     Q_DECLARE_PRIVATE(KoShapeContainer)
00177 };
00178 
00179 #endif