Envision
A visual programming IDE for object-oriented languages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
Visualization::Cursor Class Reference
Inheritance diagram for Visualization::Cursor:
Visualization::LayoutCursor Visualization::TextCursor

Public Types

enum  CursorType { VerticalCursor , HorizontalCursor , BoxCursor }
 

Public Member Functions

 Cursor (const Cursor &other)
 
 Cursor (Item *owner, CursorType type, Item *visualization=nullptr)
 
virtual ~Cursor ()
 
virtual Cursorclone () const
 
virtual bool isAtBoundary () const
 
virtual bool isLocationEquivalent (bool otherNotLocationEquivalent, CursorType otherType, bool otherIsAtBoundary, Item *otherOwner)
 
virtual bool isLocationEquivalent (Cursor *c)
 Returns true if this cursor is equivalent with respect to its location to the cursor c. More...
 
virtual bool isSame (Cursor *other)
 Returns true if this cursor is the same as the cursor other. More...
 
bool notLocationEquivalent () const
 
Cursoroperator= (const Cursor &other)=delete
 
virtual Itemowner () const
 
const QPoint & position ()
 Returns the position of this cursor in corrdinates local to owner() More...
 
const QRect & region ()
 Returns the region of this cursor in corrdinates local to owner() More...
 
QRect sceneRegion ()
 Returns the region of this cursor in scene coordinates. More...
 
void setNotLocationEquivalent (bool notEquivalent)
 
void setPosition (const QPoint &pos)
 
void setRegion (const QRect &region)
 
CursorType type () const
 
virtual void update ()
 Called on every scene update to update the cursor. More...
 
Itemvisualization ()
 

Protected Member Functions

void setVisualization (Item *visualization)
 

Private Member Functions

bool allowEquivalentCursorsAcrossBoundaries (Item *parent, Item *child)
 

Private Attributes

bool notLocationEquivalent_
 
Itemowner_ {}
 
QPoint position_
 
QRect region_
 
CursorType type_
 
Itemvisualization_ {}
 

Member Enumeration Documentation

◆ CursorType

Enumerator
VerticalCursor 
HorizontalCursor 
BoxCursor 

Constructor & Destructor Documentation

◆ Cursor() [1/2]

Visualization::Cursor::Cursor ( Item owner,
CursorType  type,
Item visualization = nullptr 
)

◆ Cursor() [2/2]

Visualization::Cursor::Cursor ( const Cursor other)

◆ ~Cursor()

Visualization::Cursor::~Cursor ( )
virtual

Member Function Documentation

◆ allowEquivalentCursorsAcrossBoundaries()

bool Visualization::Cursor::allowEquivalentCursorsAcrossBoundaries ( Item parent,
Item child 
)
private

◆ clone()

Cursor * Visualization::Cursor::clone ( ) const
virtual

◆ isAtBoundary()

bool Visualization::Cursor::isAtBoundary ( ) const
virtual

◆ isLocationEquivalent() [1/2]

bool Visualization::Cursor::isLocationEquivalent ( bool  otherNotLocationEquivalent,
CursorType  otherType,
bool  otherIsAtBoundary,
Item otherOwner 
)
virtual

◆ isLocationEquivalent() [2/2]

bool Visualization::Cursor::isLocationEquivalent ( Cursor c)
virtual

Returns true if this cursor is equivalent with respect to its location to the cursor c.

Here are the conditions for two cursors to be location equivalent:

  • None of the cursors is set to be not location equivalent.
  • The type of both cursors is the same. Furthermore the type can not be BoxCursor.
  • The owners of the two cursors are in a child-parent relationship. Two cursors from peer entities are not location equivalent. Two cursors from the same owner can not be location equivalent
  • At least one of the cursors is a boundary cursor.
  • The inner item's style allows for cursors equivalent through a boundary.

◆ isSame()

bool Visualization::Cursor::isSame ( Cursor other)
virtual

Returns true if this cursor is the same as the cursor other.

Two cursors are the same if they have the same owner and if they represent the same location within that owner.

Reimplemented in Visualization::TextCursor, and Visualization::LayoutCursor.

◆ notLocationEquivalent()

bool Visualization::Cursor::notLocationEquivalent ( ) const
inline

◆ operator=()

Cursor& Visualization::Cursor::operator= ( const Cursor other)
delete

◆ owner()

Item * Visualization::Cursor::owner ( ) const
virtual

Reimplemented in Visualization::TextCursor.

◆ position()

const QPoint & Visualization::Cursor::position ( )
inline

Returns the position of this cursor in corrdinates local to owner()

◆ region()

const QRect & Visualization::Cursor::region ( )
inline

Returns the region of this cursor in corrdinates local to owner()

◆ sceneRegion()

QRect Visualization::Cursor::sceneRegion ( )

Returns the region of this cursor in scene coordinates.

◆ setNotLocationEquivalent()

void Visualization::Cursor::setNotLocationEquivalent ( bool  notEquivalent)
inline

◆ setPosition()

void Visualization::Cursor::setPosition ( const QPoint &  pos)
inline

◆ setRegion()

void Visualization::Cursor::setRegion ( const QRect &  region)
inline

◆ setVisualization()

void Visualization::Cursor::setVisualization ( Item visualization)
protected

◆ type()

Cursor::CursorType Visualization::Cursor::type ( ) const
inline

◆ update()

void Visualization::Cursor::update ( )
virtual

Called on every scene update to update the cursor.

The default implementation checks if this is a BoxCursor and if so it assumes it is a whole item cursor to update its position and size. Otherwise it does nothing.

Reimplement this in derived classes to update the cursor's position and size appropriately.

Reimplemented in Visualization::TextCursor, and Visualization::LayoutCursor.

◆ visualization()

Item * Visualization::Cursor::visualization ( )
inline

Member Data Documentation

◆ notLocationEquivalent_

bool Visualization::Cursor::notLocationEquivalent_
private

◆ owner_

Item* Visualization::Cursor::owner_ {}
private

◆ position_

QPoint Visualization::Cursor::position_
private

◆ region_

QRect Visualization::Cursor::region_
private

◆ type_

CursorType Visualization::Cursor::type_
private

◆ visualization_

Item* Visualization::Cursor::visualization_ {}
private