graphicsinvocationitem.h
1 /*
2  name: tools/editor/graphicsinvocationitem.h
3 
4  This file is part of ARCS - Augmented Reality Component System
5  (version 2-current), written by Jean-Yves Didier
6  for IBISC Laboratory (http://www.ibisc.univ-evry.fr)
7 
8  Copyright (C) 2013 Université d'Evry-Val d'Essonne
9 
10  This program is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 2 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
23 
24  Please send bugreports with examples or suggestions to
25  jean-yves.didier__at__ibisc.univ-evry.fr
26 */
27 
28 
29 #ifndef __GRAPHICSINVOCATIONITEM_H__
30 #define __GRAPHICSINVOCATIONITEM_H__
31 
32 #include <arcs/arcsinit.h>
33 
34 #include <QGraphicsPathItem>
35 #include <QPen>
36 #include <QGraphicsSceneMoveEvent>
37 
38 class QGraphicsRectItem;
39 class QGraphicsSimpleTextItem;
40 
41 class GraphicsInvocationItem : public QGraphicsPathItem
42 {
43 public:
46  Pre,
47  Post,
48  Cleanup
49  };
50 
51 
52  GraphicsInvocationItem(QGraphicsItem* parent,InvocationType itype,ARCSInit& i);
53  virtual ~GraphicsInvocationItem();
54 
55  enum {
56  Type = UserType + 4
57  };
58 
59  int type() const
60  {
61  return Type;
62  }
63 
64  bool isMarkedForDeletion() { return markedForDeletion ;}
65  void markForDeletion() { markedForDeletion = true; }
66  ARCSInit& getInvocation() { return init; }
67  InvocationType getInvocationType() { return invocationType; }
68 
69 protected:
70  virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
71  virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *);
72  virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *);
73 
74 private:
75  void drawPath();
76 
77  bool markedForDeletion;
78 
79  InvocationType invocationType;
80  QPen defaultPen;
81  ARCSInit& init;
82  QGraphicsRectItem* rectInvocation;
83  QGraphicsSimpleTextItem* textInvocation;
84  QGraphicsSimpleTextItem* textNumber;
85 };
86 
87 
88 
89 
90 #endif // __GRAPHICSINVOCATIONITEM_H__
Desribes an initialization over a component.
Definition: arcsinit.h:46