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