1 /***************************************************************************
2 * Copyright (C) 2005 by David Cuadrado *
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. *
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. *
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>
43 typedef Common::IntHash
<Object
*> GraphicObjects
;
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
53 * Constructor por defecto
63 * Pone el nombre del frame
65 void setFrameName(const QString
&name
);
70 void setLocked(bool isLocked
);
73 * Retorna el nombre del frame
75 QString
frameName() const;
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
);
123 virtual void fromXml(const QString
&xml
);
124 virtual QDomElement
toXml(QDomDocument
&doc
) const;