CRegistryElementShape.h
Go to the documentation of this file.
1 #ifndef icmpstr_CRegistryElementShape_included
2 #define icmpstr_CRegistryElementShape_included
3 
4 
5 // Qt includes
6 #include <QtCore/QDir>
7 #if QT_VERSION >= 0x050000
8 #include <QtWidgets/QGraphicsItem>
9 #else
10 #include <QtGui/QGraphicsItem>
11 #endif
12 
13 // ACF includes
15 
16 // ACF-Solutions includes
19 
20 
21 namespace icmpstr
22 {
23 
24 
25 class CVisualRegistryEditorComp;
26 
27 
31 class CRegistryElementShape: public icmpstr::TObjectShapeBase<QGraphicsRectItem, CVisualRegistryElement>
32 {
33  Q_OBJECT
34 
35 public:
37 
39  CVisualRegistryEditorComp* registryViewPtr,
40  const icmpstr::ISceneProvider* providerPtr = NULL);
41 
42  QRectF GetViewRect() const;
43 
47  void CheckConsistency();
48 
49  // reimplemented (QGraphicsItem)
50  virtual QRectF boundingRect() const;
51  virtual void paint(QPainter* painterPtr, const QStyleOptionGraphicsItem* stylePtr, QWidget* widgetPtr);
52  virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* eventPtr);
53  virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* eventPtr);
54 
55  // reimplemented (imod::IObserver)
56  virtual bool OnAttached(imod::IModel* modelPtr);
57 
58 Q_SIGNALS:
59  void RectChanged(QRectF rect);
60  void SelectionChanged(bool state);
61 
62 protected:
63  enum
64  {
67  };
68 
69  void CalcExportedInteraces(const CVisualRegistryElement& element);
70 
71  // reimplemented (icmpstr::TObjectShapeBase)
72  void UpdateGraphicsItem(const CVisualRegistryElement& element);
73 
74  // reimplemented (TShapeBase)
75  virtual void OnSelectionChanged(bool isSelected);
76 
77 private:
78  CVisualRegistryEditorComp& m_registryView;
79 
80  QStringList m_exportedInterfacesList;
81 
82  QPointF m_lastClickPosition;
83 
84  // shadows
85  QString m_addressString;
86  QIcon m_icon;
87  QIcon m_exportIcon;
88  QIcon m_noteAttachedIcon;
89  QIcon m_autoInitIcon;
90  QColor m_backgroundColor;
91  QColor m_backgroundSelectedColor;
92  bool m_isConsistent;
93  int m_componentType;
94 };
95 
96 
97 } // namespace icmpstr
98 
99 
100 #endif // !icmpstr_CRegistryElementShape_included
101 
102 
void UpdateGraphicsItem(const CVisualRegistryElement &element)
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *eventPtr)
icmpstr::TObjectShapeBase< QGraphicsRectItem, CVisualRegistryElement > BaseClass
void SelectionChanged(bool state)
void RectChanged(QRectF rect)
Interface for GUI objects managing scene.
void CalcExportedInteraces(const CVisualRegistryElement &element)
Visualization of geometrical registry elements.
void CheckConsistency()
Check consistency, if it is changed do update.
virtual QRectF boundingRect() const
CRegistryElementShape(CVisualRegistryEditorComp *registryViewPtr, const icmpstr::ISceneProvider *providerPtr=NULL)
virtual void paint(QPainter *painterPtr, const QStyleOptionGraphicsItem *stylePtr, QWidget *widgetPtr)
virtual bool OnAttached(imod::IModel *modelPtr)
virtual void OnSelectionChanged(bool isSelected)
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *eventPtr)

© 2007-2011 Witold Gantzke and Kirill Lepskiy