Documentation
[yamf.git] / yamf / drawing / photogram.h
blobb1661595f6fd7bf02cf7179f1782c8393193f834
1 /***************************************************************************
2 * Copyright (C) 2006 by David Cuadrado *
3 * krawek@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef YAMF_DRAWINGPHOTOGRAM_H
22 #define YAMF_DRAWINGPHOTOGRAM_H
24 #include <QGraphicsScene>
26 #include <yamf/common/yamf_exports.h>
28 class QMouseEvent;
30 namespace YAMF {
32 namespace Model {
33 class Scene;
34 class Layer;
35 class Frame;
36 class Object;
39 namespace Drawing {
41 class Model::Frame;
42 class Model::Object;
43 class Model::Scene;
45 class AbstractTool;
46 class BrushManager;
47 class PaintArea;
49 /**
50 * @ingroup drawing
51 * @brief Esta clase presenta un fotograma, un fotograma es agrupaciĆ³n de capas en el mismo marco.
52 * @author David Cuadrado \<krawek@gmail.com\>
54 class YAMF_EXPORT Photogram : public QGraphicsScene
56 Q_OBJECT;
58 friend class PaintArea;
59 public:
60 Photogram(PaintArea *parent = 0);
61 ~Photogram();
63 void setCurrent(int pos);
65 void setCurrentScene(Model::Scene *scene);
67 void drawItems(QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[], QWidget *widget);
69 void drawPhotogram(int photogram);
70 void addFrame(Model::Frame *frame, double opacity = 1.0);
71 void addGraphicObject(Model::Object *object, double opacity = 1.0);
73 void clean();
75 void setNextOnionSkinCount(int n);
76 void setPreviousOnionSkinCount(int n);
78 void setLayerVisible(int layerIndex, bool visible);
80 Model::Scene *scene() const;
82 void setTool(AbstractTool *tool);
83 AbstractTool *currentTool() const;
85 bool isDrawing() const;
87 Model::Object *recorded() const;
88 void recordObject(Model::Object *record);
90 BrushManager *brushManager() const;
91 virtual void aboutToMousePress();
93 public slots:
94 void drawCurrentPhotogram();
96 protected:
97 void mouseMoved(QGraphicsSceneMouseEvent *event);
98 void mouseReleased(QGraphicsSceneMouseEvent *event);
100 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
101 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
102 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouseEvent);
103 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
104 virtual void keyPressEvent(QKeyEvent *keyEvent);
106 virtual void dragLeaveEvent( QGraphicsSceneDragDropEvent * event );
107 virtual void dragEnterEvent( QGraphicsSceneDragDropEvent * event );
108 virtual void dragMoveEvent( QGraphicsSceneDragDropEvent * event );
109 virtual void dropEvent( QGraphicsSceneDragDropEvent * event );
111 virtual bool event(QEvent *e);
114 private:
115 struct Private;
116 Private *const d;
122 #endif