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 <yamf/common/inthash.h>
30 #include <yamf/common/abstractserializable.h>
31 #include <yamf/common/yamf_exports.h>
33 #include <yamf/model/location.h>
45 typedef Common::IntHash
<Object
*> GraphicObjects
;
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
56 Frame(Layer
*parent
, const QString
& name
= tr("Frame"));
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;
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;
107 virtual void fromXml(const QString
&xml
);
108 virtual QDomElement
toXml(QDomDocument
&doc
) const;