- Improved tweening support
[yamf.git] / yamf / model / frame.h
bloba6a08c367f9ca21dd16d72e6db601c0805e649b4
1 /***************************************************************************
2 * Copyright (C) 2005 by David Cuadrado *
3 * krawek@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef YAMFMODELFRAME_H
22 #define YAMFMODELFRAME_H
24 #include <QGraphicsScene>
26 #include <QDomDocument>
27 #include <QDomElement>
29 #include <yamf/common/inthash.h>
30 #include <yamf/common/abstractserializable.h>
31 #include <yamf/common/yamf_exports.h>
33 #include <yamf/model/location.h>
36 namespace YAMF {
37 namespace Model {
39 class Frame;
40 class Layer;
41 class Object;
42 class Project;
43 class Scene;
45 typedef Common::IntHash<Object *> GraphicObjects;
47 /**
48 * @ingroup model
49 * @~spanish
50 * @brief Esta clase representa un marco o frame de la animaciĆ³n.
51 * @author David Cuadrado \<krawek@gmail.com\>
53 class YAMF_EXPORT Frame : public QObject, public YAMF::Common::AbstractSerializable
55 public:
56 Frame(Layer *parent, const QString& name = tr("Frame"));
57 ~Frame();
58 void clean();
60 void setFrameName(const QString &name);
61 QString frameName() const;
63 void setLocked(bool isLocked);
64 bool isLocked() const;
66 void setVisible(bool isVisible);
67 bool isVisible() const;
69 void addObject(Object *object);
70 Object *addItem(QGraphicsItem *item);
72 void removeObject(Object *object);
73 void removeObjects(const QList<Object *> &objects);
74 void removeItem(QGraphicsItem *item);
75 void removeItems(const QList<QGraphicsItem *> &items);
76 void removeObjectAt(int logicalIndex);
78 void detach(Model::Object *object);
79 void attach(Model::Object *object);
81 void replaceItem(int logicalIndex, QGraphicsItem *item);
82 bool moveItem(int currentPosition, int newPosition);
84 GraphicObjects graphics() const;
85 Object *graphic(int visualIndex) const;
86 Object *graphic(QGraphicsItem *item) const;
87 Object *findGraphic(QGraphicsItem *item) const;
89 QGraphicsItem *item(int visualIndex) const;
91 Layer *layer() const;
92 Scene *scene() const;
93 Project *project() const;
95 int visualIndexOf(Object *object) const;
96 int logicalIndexOf(Object *object) const;
98 int visualIndexOf(QGraphicsItem *item) const;
99 int logicalIndexOf(QGraphicsItem *item) const;
101 int visualIndex() const;
102 int logicalIndex() const;
104 Location location() const;
106 public:
107 virtual void fromXml(const QString &xml );
108 virtual QDomElement toXml(QDomDocument &doc) const;
110 private:
111 struct Private;
112 Private *const d;
118 #endif