1
/***************************************************************************
2
* Project TUPI: Magia 2D *
3
* Project Contact: info@maefloresta.com *
4
* Project Website: http://www.maefloresta.com *
5
* Project Leader: Gustav Gonzalez <info@maefloresta.com> *
9
* Gustavo Gonzalez / xtingray *
20
* Copyright (C) 2010 Gustav Gonzalez - http://www.maefloresta.com *
22
* This program is free software; you can redistribute it and/or modify *
23
* it under the terms of the GNU General Public License as published by *
24
* the Free Software Foundation; either version 3 of the License, or *
25
* (at your option) any later version. *
27
* This program is distributed in the hope that it will be useful, *
28
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
29
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30
* GNU General Public License for more details. *
32
* You should have received a copy of the GNU General Public License *
33
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
34
***************************************************************************/
39
#include "ktabstractserializable.h"
40
#include "ktinthash.h"
41
#include "ktsvgitem.h"
42
#include "ktbackground.h"
43
#include "ktglobal_store.h"
45
#include <QGraphicsScene>
46
#include <QDomDocument>
47
#include <QDomElement>
52
class KTGraphicObject;
57
typedef KTIntHash<KTGraphicObject *> GraphicObjects;
58
typedef KTIntHash<KTSvgItem *> SvgObjects;
61
* @brief Esta clase representa un marco o frame de la animacion
62
* @author David Cuadrado
65
class STORE_EXPORT KTFrame : public QObject, public KTAbstractSerializable
69
* Constructor por defecto
71
KTFrame(KTLayer *parent);
72
KTFrame(KTBackground *bg);
80
* Pone el nombre del frame
82
void setFrameName(const QString &name);
87
void setLocked(bool isLocked);
90
* Retorna el nombre del frame
92
QString frameName() const;
95
* Returna verdadero cuando el frame esta bloqueado
97
bool isLocked() const;
99
void setVisible(bool isVisible);
100
bool isVisible() const;
102
void addItem(QGraphicsItem *item);
103
void addItem(const QString &key, QGraphicsItem *item);
104
void removeItemFromFrame(const QString &key);
105
void updateIdFromFrame(const QString &oldId, const QString &newId);
107
void addSvgItem(const QString &key, KTSvgItem *item);
108
void removeSvgItemFromFrame(const QString &key);
109
void updateSvgIdFromFrame(const QString &oldId, const QString &newId);
111
void insertItem(int position, QGraphicsItem *item);
112
void insertSvgItem(int position, KTSvgItem *item);
114
void replaceItem(int position, QGraphicsItem *item);
115
bool moveItem(int currentPosition, int newPosition);
117
bool removeGraphicAt(int position);
118
bool removeSvgAt(int position);
120
QGraphicsItem *createItem(int position, QPointF coords, const QString &xml, bool loaded = false);
121
KTSvgItem *createSvgItem(int position, QPointF coords, const QString &xml, bool loaded = false);
123
void setGraphics(GraphicObjects objects);
124
void setSvgObjects(SvgObjects objects);
125
GraphicObjects graphics() const;
126
SvgObjects svgItems() const;
128
KTGraphicObject *graphic(int position) const;
129
KTSvgItem *svg(int position) const;
130
QGraphicsItem *item(int position) const;
132
QGraphicsItemGroup *createItemGroupAt(int position, QList<qreal> group);
133
QList<QGraphicsItem *> destroyItemGroup(int position);
135
KTLayer *layer() const;
136
KTScene *scene() const;
137
KTProject *project() const;
139
int indexOf(KTGraphicObject *object) const;
140
int indexOf(QGraphicsItem *item) const;
141
int indexOf(KTSvgItem *item) const;
145
void setRepeat(int repeat);
149
int graphicItemsCount();
153
QList<int> itemIndexes();
154
QList<int> svgIndexes();
159
virtual void fromXml(const QString &xml);
160
virtual QDomElement toXml(QDomDocument &doc) const;