1/***************************************************************************
2* KBlocks, a falling blocks game for KDE *
3* Copyright (C) 2010 Mauricio Piacentini <mauricio@tabuleiro.com> *
4* Zhongjie Cai <squall.leonhart.cai@gmail.com> *
5* *
6* This program is free software; you can redistribute it and/or modify *
7* it under the terms of the GNU General Public License as published by *
8* the Free Software Foundation; either version 2 of the License, or *
9* (at your option) any later version. *
10***************************************************************************/
11#ifndef KBLOCKSSVGITEM_H
12#define KBLOCKSSVGITEM_H
13
14#include <QGraphicsPixmapItem>
15#include <QGraphicsSvgItem>
16
17#include "KBlocksLayout.h"
18
19enum KBlocks_SvgItem_Type
20{
21 KBlocksSvgItem_None = -1,
22 KBlocksSvgItem_FieldArea = 0,
23 KBlocksSvgItem_PrepareArea,
24 KBlocksSvgItem_Max_Count
25};
26
27class KBlocksSvgItem : public QGraphicsSvgItem
28{
29 Q_OBJECT
30
31 public:
32 KBlocksSvgItem(KBlocksLayout * p, int type, int posX, int posY);
33 ~KBlocksSvgItem();
34
35 void setLayoutPos(int posX, int posY);
36
37 bool updateSelf();
38
39 void startOpAnim();
40 void stopOpAnim();
41
42 void startPosAnim(QPointF target);
43 void execPosAnim(qreal step);
44 void stopPosAnim();
45
46 private:
47 KBlocksLayout* mpGameLayout;
48
49 int mPosX;
50 int mPosY;
51
52 int mType;
53 int mColor;
54
55 QPointF mOriginPos;
56 QPointF mTargetPos;
57};
58
59#endif
60
61