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

© Witold Gantzke and Kirill Lepskiy