новые иконки в OpenBoard
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OpenBoard/src/tools/UBGraphicsCache.h

86 lines
2.3 KiB

13 years ago
/*
* Copyright (C) 2012 Webdoc SA
13 years ago
*
* This file is part of Open-Sankoré.
*
* Open-Sankoré is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation, version 2,
* with a specific linking exception for the OpenSSL project's
* "OpenSSL" library (or with modified versions of it that use the
* same license as the "OpenSSL" library).
*
* Open-Sankoré is distributed in the hope that it will be useful,
13 years ago
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
13 years ago
*
* You should have received a copy of the GNU Library General Public
* License along with Open-Sankoré; if not, see
* <http://www.gnu.org/licenses/>.
13 years ago
*/
13 years ago
#ifndef UBGRAPHICSCACHE_H
#define UBGRAPHICSCACHE_H
#include <QColor>
#include <QGraphicsSceneMouseEvent>
#include "domain/UBItem.h"
#include "core/UB.h"
13 years ago
typedef enum
{
eMaskShape_Circle,
eMaskShap_Rectangle
}eMaskShape;
class UBGraphicsCache : public QGraphicsRectItem, public UBItem
{
public:
static UBGraphicsCache* instance(UBGraphicsScene *scene);
13 years ago
~UBGraphicsCache();
enum { Type = UBGraphicsItemType::cacheItemType };
virtual int type() const{ return Type;}
13 years ago
virtual UBItem* deepCopy() const;
virtual void copyItemParameters(UBItem *copy) const;
13 years ago
QColor maskColor();
void setMaskColor(QColor color);
eMaskShape maskshape();
void setMaskShape(eMaskShape shape);
int shapeWidth();
void setShapeWidth(int width);
protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
private:
static QMap<UBGraphicsScene*, UBGraphicsCache*> sInstances;
13 years ago
QColor mMaskColor;
eMaskShape mMaskShape;
int mShapeWidth;
bool mDrawMask;
QPointF mShapePos;
int mOldShapeWidth;
QPointF mOldShapePos;
UBGraphicsScene* mScene;
UBGraphicsCache(UBGraphicsScene *scene);
void init();
QRectF updateRect(QPointF currentPoint);
13 years ago
};
#endif // UBGRAPHICSCACHE_H