6#ifndef iview_CViewBase_included
7#define iview_CViewBase_included
27class IViewEventObserver;
28class ISelectableLayer;
29class IInteractiveShape;
204 virtual void DrawLayers(QPainter& drawContext,
int firstLayer,
int lastLayer);
321 bool m_isBackgroundBufferValid;
329 bool m_isMultiselectable;
330 bool m_isViewDraggable;
333 QVector<iview::IViewEventObserver*> m_viewListeners;
336 int m_backgroundLayerIndex;
337 int m_activeLayerIndex;
338 int m_inactiveLayerIndex;
345 int m_lastBackgroundLayerIndex;
353 bool m_isLastMouseButtonDown;
354 mutable int m_keysState;
356 mutable bool m_isSelectEventActive;
359 bool m_isBoundingBoxValid;
362 mutable bool m_isMouseShapeValid;
364 mutable bool m_blockBBoxEvent;
384 m_isViewDraggable = state;
390 m_isMultiselectable = state;
396 m_isDraggable = state;
402 if (!m_isMouseShapeValid){
404 m_isMouseShapeValid =
true;
407 return m_mouseShapePtr;
415 return m_isViewDraggable;
421 return m_isMultiselectable;
427 return int(m_layers.size());
438 Q_ASSERT((index >= 0) && (index <
int(m_layers.size())));
441 Q_ASSERT(layerPtr !=
nullptr);
465 return m_boundingBox;
487 return m_isDraggable;
495 return m_lastBackgroundLayerIndex;
501 m_lastBackgroundLayerIndex = index;
507 return m_backgroundLayerIndex;
513 return m_inactiveLayerIndex;
519 return m_activeLayerIndex;
525 return m_isBackgroundBufferValid;
531 if (state != m_isBackgroundBufferValid){
535 m_isBackgroundBufferValid = state;
542 return m_invalidatedBox;
548 m_invalidatedBox.
Union(rect);
554 m_invalidatedBox.
Reset();
This class defines an affine 2D-transformation.
Simple rectangle with integer bounds.
void Union(const CRect &rect)
Calculate union of this and second rectangle and stores result in this object.
void Reset()
Set all members to 0.
Definition of rectangle area orthogonal to axis of coordination system.
Definition of position or mathematical vector on 2D plane.
Index implementation for addressing elements in 2D-space.
Set of change flags (its IDs).
virtual void SetEditMode(int mode)
Set edit mode.
virtual void OnAreaInvalidated(const i2d::CRect &prevArea, const i2d::CRect &newArea)
Invalidate display area.
virtual QString GetShapeDescriptionAt(istd::CIndex2d position) const
Get description to shape at specified position.
virtual int GetSelectedShapesCount() const
Get count of selected shapes.
virtual MousePointerMode CalcMousePointer(istd::CIndex2d position) const
virtual const IColorSchema & GetDefaultColorSchema() const =0
void InvalidateBox(const i2d::CRect &rect)
Invalidate rectangle screen area.
virtual IViewLayer & GetLayer(int index) const
Get layer with the given index.
virtual void InvalidateBoundingBox()
Invalidate bounding box.
virtual bool OnMouseButton(istd::CIndex2d position, Qt::MouseButton buttonType, bool downFlag)
It is called, when mouse button is pushed down or up on this object.
virtual void SetMousePointer(MousePointerMode mode)=0
Set mouse pointer.
virtual int GetLayersCount() const
Get count of layer in this view.
virtual void OnShapeSelected(IInteractiveShape &shape, bool state=true)
It is called after change shape selection state.
virtual void OnLayerShapeFocused(IInteractiveShape *shapePtr, ISelectableLayer *layerPtr)
Called when shape in layer get focus.
IInteractiveShape * GetMouseShapePtr() const
Get shape under mouse pointer.
virtual TouchState IsTouched(istd::CIndex2d position) const
Check, if any shape is touched.
virtual bool IsBackgroundBufferValid() const
Check if background buffer is valid.
virtual IDisplay * GetParentDisplayPtr() const
Get parent object of this display.
virtual i2d::CRect CalcBoundingBox() const
Calculate bounding box of all shapes.
virtual bool CanBeMoved() const
This method is internal used to check, if drag mode is allowed.
virtual int GetKeysState() const
Get state of system keys.
virtual void SetBackgroundBufferValid(bool state=true)
Set validate flag of background buffer.
virtual void SetScreenPosition(const i2d::CVector2d &client, istd::CIndex2d screen)
It sets position to become transformation of client point to specified screen position.
virtual void SetDragPosition(const istd::CIndex2d &position)
Set new drag position.
virtual ISelectableLayer * GetFocusedLayerPtr() const
Get focused layer.
virtual void OnChangeShape(IShape *shapePtr)
Invalidate a shape.
virtual void BeginDrag(const istd::CIndex2d &reference)
Called before dragging is begin.
virtual int InsertLayer(IViewLayer *layerPtr, int index=-1, int layerType=IViewLayer::LT_NONE)
Insert layer to view.
virtual void RemoveViewEventObserver(iview::IViewEventObserver *listenerPtr)
Removes handler to catch view events.
const i2d::CRect & GetInvalidatedBox() const
Get bounding box of all invalidated rectangles.
virtual void UpdateMousePointer()
Update mouse pointer.
virtual void DeselectAllShapes()
Set all shapes to be deselected.
int GetBackgroundLayerIndex() const
Get index of default background layer.
void DisconnectAllShapes()
Disconnect all shapes from this view.
virtual i2d::CRect GetBoundingBox() const
Get bounding box of all object in this display.
virtual bool IsMultiselectable() const
Check, if it is possible to select more than one shape.
virtual void OnBoundingBoxChanged()
Called when bounding box has been changed.
virtual bool IsViewDraggable() const
Check if is draggable mode.
virtual void OnShapeFocused(IInteractiveShape *)
Called when shape get focus.
virtual void SetTransform(const i2d::CAffine2d &transform)
Set a screen transformation.
int GetActiveLayerIndex() const
Get index of default active layer.
virtual int CalcShapeLayerIndex(const IShape &shape) const
Calculate optimal layer index for some shape.
virtual void SetViewDraggable(bool state=true)
Turn on/off possibility to move whole view transform.
virtual bool DisconnectShape(IShape *shapePtr)
Disconnect shape object from view.
virtual void InvalidateBackground()
Invalidate whole background buffer.
virtual int GetLayerIndex(const IViewLayer &layer) const
Get index of layer.
virtual void UpdateAllShapes(const istd::IChangeable::ChangeSet &changeSet)
Inform all shapes about changes.
virtual void CalcMouseShape() const
Calc shape under mouse pointer.
virtual void OnShapeDefocused(IInteractiveShape *)
Called when shape loose focus.
virtual void InvalidateMouseShape()
Invalidate stored shape under mouse pointer.
virtual int GetEditMode() const
Get actual edit mode.
virtual const i2d::CRectangle & GetFitArea() const
Get area will be used to automatic fit the zoom to view size.
int GetLastBackgroundLayerIndex()
Get last background layer index.
virtual void InsertDefaultLayers()
Insert default layers, when there is no one user layer.
const Layers & GetLayers() const
virtual const iview::CScreenTransform & GetTransform() const
Return a screen transformation.
virtual void InsertSelectedShapes(SelectedShapes &result) const
Get set of selected shapes.
virtual const IColorSchema & GetColorSchema() const
Get color schema.
virtual void SetZoom(ZoomMode zoom)
Set zoom.
void SetLastBackgroundLayerIndex(int index)
IInteractiveShape * GetFirstActiveShape() const
QVector< IViewLayer * > Layers
virtual bool OnMouseMove(istd::CIndex2d position)
It is called, when mouse is moved.
virtual void OnLayerShapeDefocused(IInteractiveShape *shapePtr, ISelectableLayer *layerPtr)
Called when shape in layer loose focus.
virtual void UpdateRectArea(const i2d::CRect &rect)=0
Start updating specified rectangle area.
virtual void SetFitArea(const i2d::CRectangle &area)
Set area will be used to fit in some zoom modes.
virtual void OnLayerInvalidated(const IViewLayer &layer, const i2d::CRect &prevArea, const i2d::CRect &newArea)
Inform that layer was invalidated.
virtual int GetLayerIndex(int layerType) const
Get index of layer by type.
virtual void RemoveLayer(int index)
Remove layer from view.
virtual bool ConnectShape(IShape *shapePtr)
Connect shape object to view.
void ResetInvalidatedBox()
Reset invalidated box.
int GetInactiveLayerIndex() const
Get index of default inactive layer.
virtual bool IsDraggable() const
Check if drag is enabled.
virtual void Update()
Updates all invalidates shapes.
virtual void SetDraggable(bool state=true)
Turn on/off possibility to move more selected shapes, when one is moved.
virtual void EndDrag()
Called after dragging.
virtual void SetMultiselectable(bool state=true)
Turn on/off possibility to select more shapes using control keys.
bool EnsureBoundingBoxValid()
Calculate bounding box if it was invalid.
void SetKeysState(int state)
Set state of keys.
virtual void AddViewEventObserver(iview::IViewEventObserver *listenerPtr)
Adds handler to catch view events.
virtual void DrawLayers(QPainter &drawContext, int firstLayer, int lastLayer)
Draw Background layer.
Standard implementation of view layer.
Defines set of standard pens, brushes and simple management of unions.
virtual i2d::CRect GetClientRect() const =0
Get bounding box of client area.
Common interface for all, you can drag.
Common interface for all display console shapes which can interacts with user.
Common interface for all shapes which are mouse events receiver.
MousePointerMode
Defines possible states of mouse pointer.
QSet< IInteractiveShape * > SelectedShapes
Common interface for all display console shapes.
Common interface for a general shape view implementations.
TouchState
Enumeration for possible shape touch states.
Interface for external view event observer.
Interface for a logical layer in the console view.
@ LT_NONE
Layer type is not set.
In this library is defined 2D view concept and standard visualisation objects.