Envision
A visual programming IDE for object-oriented languages
List of all members | Public Types | Public Member Functions | Static Protected Member Functions
Visualization::DeclarativeItem< VisualizationType > Class Template Reference

The DeclarativeItem class is the base class for all items that use the declarative API for visualizations. More...

Inheritance diagram for Visualization::DeclarativeItem< VisualizationType >:
Visualization::DeclarativeItemBase Core::Reflect< Base >

Public Types

using I = VisualizationType
 
- Public Types inherited from Visualization::DeclarativeItemBase
typedef DeclarativeItemBaseStyle StyleType
 

Public Member Functions

 DeclarativeItem (Item *parent, const StyleType *style=itemStyles().get())
 
virtual ~DeclarativeItem ()
 
virtual QList< FormElement * > & forms () const override
 Returns the list of forms available for this declarative item type. More...
 
virtual QList< QList< FormElement * > > & shapeElements () const override
 Returns the a list of shape elements per form for this declarative item type. More...
 
- Public Member Functions inherited from Visualization::DeclarativeItemBase
 DeclarativeItemBase (Item *parent, const StyleType *style=itemStyles().get())
 
virtual ~DeclarativeItemBase ()
 
virtual QList< Visualization::VisualizationAddOn * > addOns () override
 
FormElementcurrentForm () const
 Returns the form at the index from the cached result of determineForm. More...
 
int currentFormIndex () const
 Returns the index of the current form. More...
 
QList< FormElement * > currentShapeElements () const
 Returns the list of shape elements belonging to the current form (the same index as returned by determineForm). More...
 
virtual void determineChildren () override
 
virtual int determineForm ()
 Returns the index of the form to use for the current state of the declarative item. More...
 
virtual Visualization::InteractionHandlerhandler () const override
 
virtual bool isEmpty () const override
 
virtual QList< ItemRegionregions () override
 
virtual void setStyle (const Visualization::ItemStyle *itemStyle) override
 
virtual bool sizeDependsOnParent () const override
 
const StyleTypestyle () const
 
virtual void updateGeometry (int availableWidth, int availableHeight) override
 

Static Protected Member Functions

template<typename ElementType >
static ElementType * addForm (ElementType *element)
 Add element to the list of forms. More...
 
static QList< FormElement * > & formsStatic ()
 Static vertion of the method forms, returning the list of forms for this declarative item type. More...
 
template<typename ChildItemVisualizationType >
static VisualizationItemWrapperFormElement< VisualizationType, ChildItemVisualizationType, true > * item (ChildItemVisualizationType *VisualizationType::*itemStorage)
 A factory method to get an item wrapper element with a visualization only, it takes a pointer to member, where the visualization itemStorage should be stored, and a method to get the style (styleGetter) with which the itemStorage should be created. More...
 
template<typename ChildItemVisualizationType , typename ParentStyleType , typename ParentNodeType , typename ParentNodeSubType >
static NodeWithVisualizationItemWrapperFormElement< VisualizationType, ChildItemVisualizationType > * item (ChildItemVisualizationType *VisualizationType::*itemStorage, ParentNodeSubType *(ParentNodeType::*nodePointer)(), Style::Property< typename ChildItemVisualizationType::StyleType > ParentStyleType::*stylePointer)
 
template<typename ChildItemVisualizationType >
static VisualizationItemWrapperFormElement< VisualizationType, ChildItemVisualizationType, false > * item (ChildItemVisualizationType *VisualizationType::*itemStorage, std::function< const typename ChildItemVisualizationType::StyleType *(VisualizationType *v)> styleGetter)
 
template<typename ChildItemVisualizationType >
static NodeWithVisualizationItemWrapperFormElement< VisualizationType, ChildItemVisualizationType > * item (ChildItemVisualizationType *VisualizationType::*itemStorage, std::function< typename ChildItemVisualizationType::NodeType *(VisualizationType *v)> nodeGetter, std::function< const typename ChildItemVisualizationType::StyleType *(VisualizationType *v)> styleGetter)
 A factory method to get an item wrapper element with a node and a visualization, it takes a pointer to member, where the visualization itemStorage should be stored, a method to get the style (styleGetter), and a method to get the node (nodeGetter). More...
 
template<typename ChildItemVisualizationType , typename ParentStyleType >
static NodeWithVisualizationItemWrapperFormElement< VisualizationType, ChildItemVisualizationType > * item (ChildItemVisualizationType *VisualizationType::*itemStorage, std::function< typename ChildItemVisualizationType::NodeType *(VisualizationType *v)> nodeGetter, Style::Property< typename ChildItemVisualizationType::StyleType > ParentStyleType::*stylePointer)
 
template<typename ChildItemVisualizationType , typename ParentStyleType >
static VisualizationItemWrapperFormElement< VisualizationType, ChildItemVisualizationType, false > * item (ChildItemVisualizationType *VisualizationType::*itemStorage, Style::Property< typename ChildItemVisualizationType::StyleType > ParentStyleType::*stylePointer)
 
static NodeItemWrapperFormElement< VisualizationType > * item (Item *VisualizationType::*itemStorage, std::function< Model::Node *(VisualizationType *v)> nodeGetter)
 A factory method to get an item wrapper element with a node only, it takes a pointer to member, where the visualization itemStorage should be stored, and a method to get the node (nodeGetter) with which the itemStorage should be associated. More...
 
static QList< QList< FormElement * > > & shapeElementsStatic ()
 Static version of the method shapeElements, returning the list of shape element lists for each form. More...
 
- Static Protected Member Functions inherited from Visualization::DeclarativeItemBase
static GridLayoutFormElementgrid (QList< QList< Merge >> elements)
 Creates a grid layout. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Visualization::DeclarativeItemBase
static void addAddOn (Visualization::VisualizationAddOn *addOn)
 
static Visualization::InteractionHandlerdefaultClassHandler ()
 
static Visualization::StyleSet< DeclarativeItemBase > & itemStyles ()
 
static bool removeAddOn (Visualization::VisualizationAddOn *addOn)
 
static void setDefaultClassHandler (Visualization::InteractionHandler *handler)
 
- Protected Types inherited from Core::Reflect< Base >
using Super = Reflect< Base >
 

Detailed Description

template<typename VisualizationType>
class Visualization::DeclarativeItem< VisualizationType >

The DeclarativeItem class is the base class for all items that use the declarative API for visualizations.

It is a template class, such that every descendant visualization type has its own static list of available forms.

To use the declarative API, one needs to inherit from DeclarativeItem, and implement a static method initializeForms in which the list of forms and their properties is set up.

Member Typedef Documentation

◆ I

template<typename VisualizationType >
using Visualization::DeclarativeItem< VisualizationType >::I = VisualizationType

Constructor & Destructor Documentation

◆ DeclarativeItem()

template<typename VisualizationType >
Visualization::DeclarativeItem< VisualizationType >::DeclarativeItem ( Item parent,
const StyleType style = itemStyles().get() 
)

◆ ~DeclarativeItem()

template<typename VisualizationType >
virtual Visualization::DeclarativeItem< VisualizationType >::~DeclarativeItem ( )
virtual

Member Function Documentation

◆ addForm()

template<typename VisualizationType >
template<typename ElementType >
static ElementType* Visualization::DeclarativeItem< VisualizationType >::addForm ( ElementType *  element)
staticprotected

Add element to the list of forms.

All the forms should be added via this method inside the static method initializeForms.

If element is already a form root element or has a parent, then it is cloned and its clone is added to the list.

Returns a pointer to the added element.

◆ forms()

template<typename VisualizationType >
virtual QList<FormElement*>& Visualization::DeclarativeItem< VisualizationType >::forms ( ) const
overridevirtual

Returns the list of forms available for this declarative item type.

Implements Visualization::DeclarativeItemBase.

◆ formsStatic()

template<typename VisualizationType >
static QList<FormElement*>& Visualization::DeclarativeItem< VisualizationType >::formsStatic ( )
staticprotected

Static vertion of the method forms, returning the list of forms for this declarative item type.

◆ item() [1/7]

template<typename VisualizationType >
template<typename ChildItemVisualizationType >
static VisualizationItemWrapperFormElement<VisualizationType, ChildItemVisualizationType, true>* Visualization::DeclarativeItem< VisualizationType >::item ( ChildItemVisualizationType *VisualizationType::*  itemStorage)
staticprotected

A factory method to get an item wrapper element with a visualization only, it takes a pointer to member, where the visualization itemStorage should be stored, and a method to get the style (styleGetter) with which the itemStorage should be created.

To call it, one has to supply the visualization type and the parent type (which is always 'I') as the template arguments.

◆ item() [2/7]

template<typename VisualizationType >
template<typename ChildItemVisualizationType , typename ParentStyleType , typename ParentNodeType , typename ParentNodeSubType >
static NodeWithVisualizationItemWrapperFormElement<VisualizationType, ChildItemVisualizationType>* Visualization::DeclarativeItem< VisualizationType >::item ( ChildItemVisualizationType *VisualizationType::*  itemStorage,
ParentNodeSubType *(ParentNodeType::*)()  nodePointer,
Style::Property< typename ChildItemVisualizationType::StyleType > ParentStyleType::*  stylePointer 
)
staticprotected

◆ item() [3/7]

template<typename VisualizationType >
template<typename ChildItemVisualizationType >
static VisualizationItemWrapperFormElement<VisualizationType, ChildItemVisualizationType, false>* Visualization::DeclarativeItem< VisualizationType >::item ( ChildItemVisualizationType *VisualizationType::*  itemStorage,
std::function< const typename ChildItemVisualizationType::StyleType *(VisualizationType *v)>  styleGetter 
)
staticprotected

◆ item() [4/7]

template<typename VisualizationType >
template<typename ChildItemVisualizationType >
static NodeWithVisualizationItemWrapperFormElement<VisualizationType, ChildItemVisualizationType>* Visualization::DeclarativeItem< VisualizationType >::item ( ChildItemVisualizationType *VisualizationType::*  itemStorage,
std::function< typename ChildItemVisualizationType::NodeType *(VisualizationType *v)>  nodeGetter,
std::function< const typename ChildItemVisualizationType::StyleType *(VisualizationType *v)>  styleGetter 
)
staticprotected

A factory method to get an item wrapper element with a node and a visualization, it takes a pointer to member, where the visualization itemStorage should be stored, a method to get the style (styleGetter), and a method to get the node (nodeGetter).

The node then gets visualized using the given visualization and style. To call it, one has to supply the visualization type and the parent type (which is always 'I') as template arguments.

◆ item() [5/7]

template<typename VisualizationType >
template<typename ChildItemVisualizationType , typename ParentStyleType >
static NodeWithVisualizationItemWrapperFormElement<VisualizationType, ChildItemVisualizationType>* Visualization::DeclarativeItem< VisualizationType >::item ( ChildItemVisualizationType *VisualizationType::*  itemStorage,
std::function< typename ChildItemVisualizationType::NodeType *(VisualizationType *v)>  nodeGetter,
Style::Property< typename ChildItemVisualizationType::StyleType > ParentStyleType::*  stylePointer 
)
staticprotected

◆ item() [6/7]

template<typename VisualizationType >
template<typename ChildItemVisualizationType , typename ParentStyleType >
static VisualizationItemWrapperFormElement<VisualizationType, ChildItemVisualizationType, false>* Visualization::DeclarativeItem< VisualizationType >::item ( ChildItemVisualizationType *VisualizationType::*  itemStorage,
Style::Property< typename ChildItemVisualizationType::StyleType > ParentStyleType::*  stylePointer 
)
staticprotected

◆ item() [7/7]

template<typename VisualizationType >
static NodeItemWrapperFormElement<VisualizationType>* Visualization::DeclarativeItem< VisualizationType >::item ( Item *VisualizationType::*  itemStorage,
std::function< Model::Node *(VisualizationType *v)>  nodeGetter 
)
staticprotected

A factory method to get an item wrapper element with a node only, it takes a pointer to member, where the visualization itemStorage should be stored, and a method to get the node (nodeGetter) with which the itemStorage should be associated.

The node gets visualized with its default style.

NOTE: Introducing the ChildItemVisualizationType template argument will require ChildItemVisualizationType::NodeType, which Item does not have, and thus Item cannot be the default!

◆ shapeElements()

template<typename VisualizationType >
virtual QList<QList<FormElement*> >& Visualization::DeclarativeItem< VisualizationType >::shapeElements ( ) const
overridevirtual

Returns the a list of shape elements per form for this declarative item type.

Those lists are determined from the list of forms.

Implements Visualization::DeclarativeItemBase.

◆ shapeElementsStatic()

template<typename VisualizationType >
static QList<QList<FormElement*> >& Visualization::DeclarativeItem< VisualizationType >::shapeElementsStatic ( )
staticprotected

Static version of the method shapeElements, returning the list of shape element lists for each form.