Envision
A visual programming IDE for object-oriented languages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
Visualization::AnchorLayoutAnchor Class Reference

An anchor is a constraint on how two elements are positioned relative to each other along one axis. More...

Public Types

enum class  Orientation : int { Auto , Horizontal , Vertical }
 

Public Member Functions

 AnchorLayoutAnchor (const AnchorLayoutAnchor &)=default
 
 AnchorLayoutAnchor (float relativePlaceEdgePosition, FormElement *placeElement, int offset, float relativeFixedEdgePosition, FormElement *fixedElement)
 
virtual ~AnchorLayoutAnchor ()
 
virtual AnchorLayoutAnchorclone () const
 
bool dependsOn (AnchorLayoutAnchor *other, QList< AnchorLayoutAnchor * > &allConstraints)
 Returns whether this anchor depends on other, given the list of all anchors (allConstraints). More...
 
int execute (Item *item, Orientation orientation)
 Returns the position on the orientation axis of the element to be placed, assuming its size for item was already calculated, and the position on the orientation axis of the fixed element is already fixed for item. More...
 
FormElementfixedElement () const
 Returns the fixed element. More...
 
int offset () const
 Returns the offset. More...
 
AnchorLayoutAnchoroperator= (const AnchorLayoutAnchor &)=delete
 
FormElementplaceElement () const
 Returns the place element. More...
 
float relativeFixedEdgePosition () const
 Returns the relative fixed edge position. More...
 
float relativePlaceEdgePosition () const
 Returns the relative place edge position. More...
 

Private Member Functions

void setFixedElement (FormElement *el)
 
void setPlaceElement (FormElement *el)
 

Private Attributes

FormElementfixedElement_ {}
 
int offset_ {}
 
FormElementplaceElement_ {}
 
float relativeFixedEdgePosition_ {}
 
float relativePlaceEdgePosition_ {}
 

Friends

class AnchorLayoutFormElement
 

Detailed Description

An anchor is a constraint on how two elements are positioned relative to each other along one axis.

This class holds information about one such constraint. Also, if there are no circular dependencies on the axis to compute, and the fixed element of this class is really already fixed, the method execute can be used to calculate the position of the place element.

Member Enumeration Documentation

◆ Orientation

Enumerator
Auto 
Horizontal 
Vertical 

Constructor & Destructor Documentation

◆ AnchorLayoutAnchor() [1/2]

Visualization::AnchorLayoutAnchor::AnchorLayoutAnchor ( float  relativePlaceEdgePosition,
FormElement placeElement,
int  offset,
float  relativeFixedEdgePosition,
FormElement fixedElement 
)

◆ AnchorLayoutAnchor() [2/2]

Visualization::AnchorLayoutAnchor::AnchorLayoutAnchor ( const AnchorLayoutAnchor )
default

◆ ~AnchorLayoutAnchor()

Visualization::AnchorLayoutAnchor::~AnchorLayoutAnchor ( )
virtual

Member Function Documentation

◆ clone()

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

◆ dependsOn()

bool Visualization::AnchorLayoutAnchor::dependsOn ( AnchorLayoutAnchor other,
QList< AnchorLayoutAnchor * > &  allConstraints 
)

Returns whether this anchor depends on other, given the list of all anchors (allConstraints).

◆ execute()

int Visualization::AnchorLayoutAnchor::execute ( Item item,
Orientation  orientation 
)

Returns the position on the orientation axis of the element to be placed, assuming its size for item was already calculated, and the position on the orientation axis of the fixed element is already fixed for item.

◆ fixedElement()

FormElement * Visualization::AnchorLayoutAnchor::fixedElement ( ) const
inline

Returns the fixed element.

◆ offset()

int Visualization::AnchorLayoutAnchor::offset ( ) const
inline

Returns the offset.

◆ operator=()

AnchorLayoutAnchor& Visualization::AnchorLayoutAnchor::operator= ( const AnchorLayoutAnchor )
delete

◆ placeElement()

FormElement * Visualization::AnchorLayoutAnchor::placeElement ( ) const
inline

Returns the place element.

◆ relativeFixedEdgePosition()

float Visualization::AnchorLayoutAnchor::relativeFixedEdgePosition ( ) const
inline

Returns the relative fixed edge position.

◆ relativePlaceEdgePosition()

float Visualization::AnchorLayoutAnchor::relativePlaceEdgePosition ( ) const
inline

Returns the relative place edge position.

◆ setFixedElement()

void Visualization::AnchorLayoutAnchor::setFixedElement ( FormElement el)
inlineprivate

◆ setPlaceElement()

void Visualization::AnchorLayoutAnchor::setPlaceElement ( FormElement el)
inlineprivate

Friends And Related Function Documentation

◆ AnchorLayoutFormElement

friend class AnchorLayoutFormElement
friend

Member Data Documentation

◆ fixedElement_

FormElement* Visualization::AnchorLayoutAnchor::fixedElement_ {}
private

◆ offset_

int Visualization::AnchorLayoutAnchor::offset_ {}
private

◆ placeElement_

FormElement* Visualization::AnchorLayoutAnchor::placeElement_ {}
private

◆ relativeFixedEdgePosition_

float Visualization::AnchorLayoutAnchor::relativeFixedEdgePosition_ {}
private

◆ relativePlaceEdgePosition_

float Visualization::AnchorLayoutAnchor::relativePlaceEdgePosition_ {}
private