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

The ViewItemNode class is used in the ViewItem class and simply wraps a top level node to give another level of indirection. More...

Inheritance diagram for Visualization::ViewItemNode:
Core::Reflect< Base >

Public Member Functions

int purpose () const
 
Model::Nodereference () const
 
void setPosition (MajorMinorIndex pos)
 Use setPosition to set the position of this node in the ViewItem's grid before calling toJson. More...
 
void setPurpose (int purpose)
 
void setReference (Model::Node *reference)
 
void setSpacingParent (ViewItemNode *spacingParent)
 
void setSpacingParentPosition (MajorMinorIndex pos)
 If a spacing parent exists, use this to set the position of its spacing parent's position in the ViewItem's grid before calling toJson. More...
 
void setSpacingTarget (Model::Node *spacingTarget)
 
ViewItemNodespacingParent () const
 
Model::NodespacingTarget () const
 
virtual QJsonValue toJson () const override
 

Static Public Member Functions

static ViewItemNodefromJson (QJsonObject json, const ViewItem *view)
 Creates a new ViewItemNode using the given Json object for initialization. More...
 
static ViewItemNodewithReference (Model::Node *reference, int purpose)
 Creates a new ViewItemNode which is used to render the given reference's visualization. More...
 
static ViewItemNodewithSpacingTarget (Model::Node *spacingTarget, ViewItemNode *spacingParent)
 Creates a new ViewItemNode which is used to render an empty spacing item. More...
 

Private Attributes

MajorMinorIndex position_
 
int purpose_ {-1}
 
Model::Nodereference_ {}
 
ViewItemNodespacingParent_ {}
 
MajorMinorIndex spacingParentPosition_
 
Model::NodespacingTarget_ {}
 

Additional Inherited Members

- Protected Types inherited from Core::Reflect< Base >
using Super = Reflect< Base >
 

Detailed Description

The ViewItemNode class is used in the ViewItem class and simply wraps a top level node to give another level of indirection.

This helps with distinguishing different items when the same node is added to a ViewItem multiple times, as is possible.

A ViewItemNode can either hold a reference to another node - in which case its visualization renders that node. It can also hold a spacing target and spacing parent - in which case it will render as white space, aligning its bottom end with the top end of that given spacing target.

Member Function Documentation

◆ fromJson()

ViewItemNode * Visualization::ViewItemNode::fromJson ( QJsonObject  json,
const ViewItem view 
)
static

Creates a new ViewItemNode using the given Json object for initialization.

This can then be either a ViewItemNode with a reference or a spacing target.

◆ purpose()

int Visualization::ViewItemNode::purpose ( ) const
inline

◆ reference()

Model::Node * Visualization::ViewItemNode::reference ( ) const
inline

◆ setPosition()

void Visualization::ViewItemNode::setPosition ( MajorMinorIndex  pos)
inline

Use setPosition to set the position of this node in the ViewItem's grid before calling toJson.

◆ setPurpose()

void Visualization::ViewItemNode::setPurpose ( int  purpose)
inline

◆ setReference()

void Visualization::ViewItemNode::setReference ( Model::Node reference)
inline

◆ setSpacingParent()

void Visualization::ViewItemNode::setSpacingParent ( ViewItemNode spacingParent)
inline

◆ setSpacingParentPosition()

void Visualization::ViewItemNode::setSpacingParentPosition ( MajorMinorIndex  pos)
inline

If a spacing parent exists, use this to set the position of its spacing parent's position in the ViewItem's grid before calling toJson.

◆ setSpacingTarget()

void Visualization::ViewItemNode::setSpacingTarget ( Model::Node spacingTarget)
inline

◆ spacingParent()

ViewItemNode * Visualization::ViewItemNode::spacingParent ( ) const
inline

◆ spacingTarget()

Model::Node * Visualization::ViewItemNode::spacingTarget ( ) const
inline

◆ toJson()

QJsonValue Visualization::ViewItemNode::toJson ( ) const
overridevirtual

◆ withReference()

ViewItemNode * Visualization::ViewItemNode::withReference ( Model::Node reference,
int  purpose 
)
static

Creates a new ViewItemNode which is used to render the given reference's visualization.

◆ withSpacingTarget()

ViewItemNode * Visualization::ViewItemNode::withSpacingTarget ( Model::Node spacingTarget,
ViewItemNode spacingParent 
)
static

Creates a new ViewItemNode which is used to render an empty spacing item.

Member Data Documentation

◆ position_

MajorMinorIndex Visualization::ViewItemNode::position_
private

◆ purpose_

int Visualization::ViewItemNode::purpose_ {-1}
private

◆ reference_

Model::Node* Visualization::ViewItemNode::reference_ {}
private

◆ spacingParent_

ViewItemNode* Visualization::ViewItemNode::spacingParent_ {}
private

◆ spacingParentPosition_

MajorMinorIndex Visualization::ViewItemNode::spacingParentPosition_
private

◆ spacingTarget_

Model::Node* Visualization::ViewItemNode::spacingTarget_ {}
private