Implemented unit tests for:
[yamf.git] / src / model / frame.h
blob76d977233ce0a925a39f5334fa670be78ee8302f
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 <common/inthash.h>
30 #include <common/abstractserializable.h>
31 #include <common/yamf_exports.h>
34 namespace YAMF {
35 namespace Model {
37 class Frame;
38 class Layer;
39 class Object;
40 class Project;
41 class Scene;
43 typedef Common::IntHash<Object *> GraphicObjects;
45 /**
46 * @brief Esta clase representa un marco o frame de la animacion
47 * @author David Cuadrado \<krawek@gmail.com\>
49 class YAMF_EXPORT Frame : public QObject, public YAMF::Common::AbstractSerializable
51 public:
52 /**
53 * Constructor por defecto
55 Frame(Layer *parent);
57 /**
58 * Destructor
60 ~Frame();
62 /**
63 * Pone el nombre del frame
65 void setFrameName(const QString &name);
67 /**
68 * Bloquea el frame
70 void setLocked(bool isLocked);
72 /**
73 * Retorna el nombre del frame
75 QString frameName() const;
77 /**
78 * Returna verdadero cuando el frame esta bloqueado
80 bool isLocked() const;
83 void setVisible(bool isVisible);
84 bool isVisible() const;
86 void addObject(Object *object);
87 void removeObject(Object *object);
88 void removeObjects(const QList<Object *> &objects);
90 void removeItem(QGraphicsItem *item);
91 void removeItems(const QList<QGraphicsItem *> &items);
93 void removeObjectAt(int logicalIndex);
95 Object * addItem(QGraphicsItem *item);
97 void replaceItem(int logicalIndex, QGraphicsItem *item);
98 bool moveItem(int currentPosition, int newPosition);
100 GraphicObjects graphics() const;
102 Object *graphic(int logicalIndex) const;
103 QGraphicsItem *item(int logicalIndex) const;
105 Layer *layer() const;
106 Scene *scene() const;
107 Project *project() const;
109 int visualIndexOf(Object *object) const;
110 int logicalIndexOf(Object *object) const;
111 int visualIndexOf(QGraphicsItem *item) const;
112 int logicalIndexOf(QGraphicsItem *item) const;
114 int visualIndex() const;
115 int logicalIndex() const;
117 void setRepeat(int repeat);
118 int repeat() const;
120 void clean();
122 public:
123 virtual void fromXml(const QString &xml );
124 virtual QDomElement toXml(QDomDocument &doc) const;
126 private:
127 struct Private;
128 Private *const d;
134 #endif