rockbox/utils/themeeditor/graphics/rbimage.h
Robert Bieber 10b9e3b024 Theme Editor: Implemented resizing in RBMovable subclasses. Implementation is still somewhat crash-prone, but mostly works at this point
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27729 a1c6a512-1295-4272-9138-f99709370657
2010-08-05 22:31:46 +00:00

68 lines
1.8 KiB
C++

/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2010 Robert Bieber
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef RBIMAGE_H
#define RBIMAGE_H
#include <QPixmap>
#include <QGraphicsItem>
#include "rbmovable.h"
class ParseTreeNode;
class RBImage: public RBMovable
{
public:
RBImage(QString file, int tiles, int x, int y, ParseTreeNode* node,
QGraphicsItem* parent = 0);
RBImage(const RBImage& other, QGraphicsItem* parent);
virtual ~RBImage();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
void setTile(int tile)
{
currentTile = tile;
if(currentTile > tiles - 1)
currentTile = tiles -1;
}
void enableMovement()
{
setFlag(ItemSendsGeometryChanges, true);
}
protected:
void saveGeometry();
private:
QPixmap* image;
int tiles;
int currentTile;
ParseTreeNode* node;
};
#endif // RBIMAGE_H