Initial maemo platform support
[maemo-rb.git] / utils / themeeditor / graphics / rbimage.h
blob6caddae399147bc0dfd5ad0803bce6a2fb9045f3
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 Robert Bieber
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef RBIMAGE_H
23 #define RBIMAGE_H
25 #include <QPixmap>
26 #include <QGraphicsItem>
28 #include "rbmovable.h"
30 class ParseTreeNode;
32 class RBImage: public RBMovable
34 public:
35 RBImage(QString file, int tiles, int x, int y, ParseTreeNode* node,
36 QGraphicsItem* parent = 0);
37 RBImage(const RBImage& other, QGraphicsItem* parent);
38 virtual ~RBImage();
40 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
41 QWidget *widget);
43 void setTile(int tile)
45 currentTile = tile;
46 if(currentTile > tiles - 1)
47 currentTile = tiles -1;
50 int numTiles()
52 return tiles;
55 void enableMovement()
57 setFlag(ItemSendsGeometryChanges, true);
61 protected:
62 void saveGeometry();
64 private:
65 QPixmap* image;
66 int tiles;
67 int currentTile;
69 ParseTreeNode* node;
73 #endif // RBIMAGE_H