CInteractiveViewLayer.h
Go to the documentation of this file.
1 #ifndef iview_CInteractiveViewLayer_included
2 #define iview_CInteractiveViewLayer_included
3 
4 
6 #include <iview/IShapeView.h>
7 #include <iview/CViewLayer.h>
8 
9 
10 namespace iview
11 {
12 
13 
15  public CViewLayer,
16  virtual public ISelectableLayer
17 {
18 public:
20 
22  virtual ~CInteractiveViewLayer();
23 
25 
26  // reimplemented (iview::CViewLayer)
29 
30  // reimplemented (iview::ISelectableLayer)
31  virtual bool ConnectInteractiveShape(IInteractiveShape* shapePtr);
32  virtual int GetUnselectedShapesCount() const;
33  virtual void DrawFocusedShape(QPainter& drawContext);
34  virtual bool OnMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag);
35  virtual bool OnFocusedMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag);
36  virtual bool OnFocusedMouseMove(istd::CIndex2d position);
37  virtual TouchState IsTouched(istd::CIndex2d position, IInteractiveShape** shapePtrPtr = NULL) const;
38 
39  // reimplemented (iview::ISelectable)
40  virtual int GetSelectedShapesCount() const;
41  virtual void InsertSelectedShapes(SelectedShapes& result) const;
42  virtual void DeselectAllShapes();
43  virtual int GetKeysState() const;
44  virtual int GetEditMode() const;
45  virtual void OnShapeFocused(IInteractiveShape* shapePtr);
46  virtual void OnShapeDefocused(IInteractiveShape* shapePtr);
47  virtual void OnShapeSelected(IInteractiveShape& shape, bool state = true);
48 
49  // reimplemented (iview::IViewLayer)
50  virtual bool IsShapeConnected(IShape* shapePtr);
51  virtual bool ConnectShape(IShape* shapePtr);
52  virtual int GetShapesCount() const;
53  virtual void DisconnectAllShapes();
54  virtual void DrawShapes(QPainter& drawContext);
55 
56  // reimplemented (iview::IShapeObserver)
57  virtual void OnChangeShape(IShape* shapePtr);
58  virtual bool DisconnectShape(IShape* shapePtr);
59 
60  // reimplemented (iview::ITouchable)
61  virtual TouchState IsTouched(istd::CIndex2d position) const;
62  virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const;
63 
64  // reimplemented (iview::IDraggable)
65  virtual void BeginDrag(const istd::CIndex2d& reference);
66  virtual void SetDragPosition(const istd::CIndex2d& position);
67  virtual void EndDrag();
68  virtual bool IsDraggable() const;
69 
70 protected:
72 
73 private:
74  IInteractiveShape* m_focusedShapePtr;
75 };
76 
77 
78 // inline methods
79 
80 // reimplemented (iview::ISelectable)
81 
83 {
84  const IShapeView* viewPtr = GetViewPtr();
85  Q_ASSERT(viewPtr != NULL);
86 
87  return viewPtr->GetKeysState();
88 }
89 
90 
92 {
93  const IShapeView* viewPtr = GetViewPtr();
94  Q_ASSERT(viewPtr != NULL);
95 
96  return viewPtr->GetEditMode();
97 }
98 
99 
100 } // namespace iview
101 
102 
103 #endif // !iview_CInteractiveViewLayer_included
104 
105 
106 
i2d::CRect CalcBoundingBox() const
Calculate bounding box for all shapes.
virtual bool OnFocusedMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag)
Called, when this layer has focus, and mouse button was pushed down or up on this object...
virtual int GetSelectedShapesCount() const
Get count of selected shapes.
virtual void OnShapeSelected(IInteractiveShape &shape, bool state=true)
It is called after change shape selection state.
QMap< IShape *, i2d::CRect > ShapeMap
Definition: CViewLayer.h:61
virtual void DeselectAllShapes()
Set all shapes to be deselected.
virtual int GetKeysState() const =0
Get state of system keys.
virtual void OnShapeDefocused(IInteractiveShape *shapePtr)
Called when shape loose focus.
virtual void SetDragPosition(const istd::CIndex2d &position)
Set new drag position.
Simple rectangle with integer bounds.
Definition: CRect.h:21
Index implementation for addressing elements in 2D-space.
Definition: CIndex2d.h:20
Common interface for a general shape view implementations.
Definition: IShapeView.h:24
virtual bool OnFocusedMouseMove(istd::CIndex2d position)
Called, when this layer has focus, and mouse was moved.
IInteractiveShape * GetFirstActiveShape() const
virtual int GetKeysState() const
Get state of system keys.
Common interface for all display console shapes which can interacts with user.
virtual bool ConnectShape(IShape *shapePtr)
Connect shape object to view.
virtual void OnShapeFocused(IInteractiveShape *shapePtr)
Called when shape get focus.
virtual bool IsShapeConnected(IShape *shapePtr)
Check, if the shape is connected to the layer.
virtual void DrawFocusedShape(QPainter &drawContext)
Draw only focused shape.
virtual TouchState IsTouched(istd::CIndex2d position, IInteractiveShape **shapePtrPtr=NULL) const
Check, if any shape is touched.
virtual int GetEditMode() const
Get actual edit mode.
virtual void DisconnectAllShapes()
Disconnect all shapes from this layer.
virtual int GetEditMode() const =0
Get actual edit mode.
QSet< IInteractiveShape * > SelectedShapes
Definition: ISelectable.h:24
Common interface for all display console shapes.
Definition: IShape.h:27
virtual int GetShapesCount() const
Get count of all shapes on this layer.
virtual bool ConnectInteractiveShape(IInteractiveShape *shapePtr)
Connect active shape object.
virtual void EndDrag()
Called after dragging.
virtual i2d::CRect RecalcAllShapes(const istd::IChangeable::ChangeSet &changeSet)
Recalculate all shapes after view changes.
#define NULL
Definition: istd.h:64
virtual bool DisconnectShape(IShape *shapePtr)
Disconnect shape object from view.
TouchState
Enumeration for possible shape touch states.
Definition: ITouchable.h:24
virtual bool OnMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag)
Called, when mouse button was pushed down or up.
virtual void InsertSelectedShapes(SelectedShapes &result) const
Get set of selected shapes.
Set of change flags (its IDs).
Definition: IChangeable.h:30
virtual void OnChangeShape(IShape *shapePtr)
Invalidate a shape.
virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const
Get description to shape at specified position.
virtual void DrawShapes(QPainter &drawContext)
Draw all shapes using specified draw context.
virtual void BeginDrag(const istd::CIndex2d &reference)
Called before dragging is begin.
Standard implementation of view layer.
Definition: CViewLayer.h:21
virtual bool IsDraggable() const
Check if drag is enabled.
virtual int GetUnselectedShapesCount() const
Get number of unselected shapes.
virtual IShapeView * GetViewPtr() const
Get parent view of this layer.

© 2007-2017 Witold Gantzke and Kirill Lepskiy