summaryrefslogtreecommitdiffstats
path: root/pacman-c++/pixmapitem.h
blob: 35a64405bef1c01c49e30602cd4b4aff9b0b5f6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef __PIXMAPITEM__H__
#define __PIXMAPITEM__H__

#include <QtGui/QGraphicsObject>
#include <QtGui/QGraphicsScene>

class PixmapItem
  : public QGraphicsObject
{
public:
  PixmapItem(QGraphicsItem *parent = 0);
  PixmapItem(const QString &fileName, QGraphicsItem *parent = 0);
  PixmapItem(const QString &fileName, QGraphicsScene *scene);
  PixmapItem(const QPixmap &pix, QGraphicsItem *parent = 0);
  PixmapItem(const QPixmap &pix, QGraphicsScene *scene);
  virtual ~PixmapItem() {};
  void setPixmap(const QPixmap &pix);
  void setSprite(int x, int y, int width, int height);
  QSizeF size() const;
  QRectF boundingRect() const;
  void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);

private:
  QPixmap m_pix;
  int m_x, m_y;
  int m_width, m_height;
};

#endif