Envision
A visual programming IDE for object-oriented languages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
Visualization::DynamicGridFormElement Class Reference
Inheritance diagram for Visualization::DynamicGridFormElement:
Visualization::SuperLayoutElement< DynamicGridFormElement, LayoutFormElement > Visualization::SuperFormElement< NewFormElement, BaseFormElement >

Classes

struct  ItemData
 

Public Types

using ItemsGetterFunction = std::function< QVector< QVector< Item * > >(Item *item)>
 
using MajorAxisGetterFunction = std::function< GridLayouter::MajorAxis(Item *item)>
 
using NodesGetterFunction = std::function< QVector< QVector< Model::Node * > >(Item *item)>
 
using SpanGetterFunction = std::function< QVector< QVector< QPair< int, int > >>(Item *item)>
 

Public Member Functions

 DynamicGridFormElement ()=default
 
 DynamicGridFormElement (const DynamicGridFormElement &other)
 
virtual ~DynamicGridFormElement () override
 
virtual DynamicGridFormElementclone () const override
 
virtual void computeSize (Item *item, int availableWidth, int availableHeight) override
 
virtual void destroyChildItems (Item *item, QList< const Item *const DeclarativeItemBase::* > handledChildren) override
 
virtual bool elementOrChildHasFocus (Item *item) const override
 
QPoint focusedElementIndex (Item *item) const
 Returns the index of the focused element for the specified item. More...
 
QSize gridSize (const Item *item) const
 
QPoint indexOf (Item *item, Item *child) const
 Returns the index of child or {-1, -1} if this layout does not manage child. More...
 
virtual bool isEmpty (const Item *item) const override
 
DynamicGridFormElementoperator= (const DynamicGridFormElement &)=delete
 
virtual QList< ItemRegionregions (DeclarativeItemBase *item, int parentX, int parentY) override
 
DynamicGridFormElementsetHorizontalAlignment (LayoutStyle::Alignment alignment)
 Sets the horizontal alignment to alignment for all the cells in the grid. More...
 
virtual void setItemPositions (Item *item, int parentX, int parentY) override
 
DynamicGridFormElementsetItemsGetter (ItemsGetterFunction itemGetter)
 
DynamicGridFormElementsetMajorAxis (GridLayouter::MajorAxis majorAxis)
 Sets the major axis of this layout. More...
 
DynamicGridFormElementsetMajorAxisGetter (MajorAxisGetterFunction majorAxisGetter)
 
DynamicGridFormElementsetNodesGetter (NodesGetterFunction nodeGetter)
 
DynamicGridFormElementsetSpacing (int spaceBetweenColumns, int spaceBetweenRows)
 Sets the horizontal and the vertical spacing to spaceBetweenColumns and spaceBetweenRows respectively. More...
 
DynamicGridFormElementsetSpanGetter (SpanGetterFunction spanGetter)
 
DynamicGridFormElementsetVerticalAlignment (LayoutStyle::Alignment alignment)
 Sets the vertical alignment to alignment for all the cells in the grid. More...
 
virtual bool sizeDependsOnParent (const Item *item) const override
 
virtual void synchronizeWithItem (Item *item) override
 
- Public Member Functions inherited from Visualization::SuperLayoutElement< DynamicGridFormElement, LayoutFormElement >
DynamicGridFormElementsetHasCursorWhenEmpty (std::function< bool(Item *item)> hasCursorWhenEmptyGetter)
 Sets a getter (cursorWhenEmptyGetter) for checking if the element should have cursors when empty dynamically while rendering. More...
 
DynamicGridFormElementsetNoBoundaryCursors (std::function< bool(Item *item)> noBoundaryCursorsGetter)
 Sets a getter (noBoundaryCursorsGetter) for checking if the element should not have any boundary cursors dynamically while rendering. More...
 
DynamicGridFormElementsetNoInnerCursors (std::function< bool(Item *item)> noInnerCursorsGetter)
 Sets a getter (noInnerCursorsGetter) for checking if the element should not have any inner cursors dynamically while rendering. More...
 
DynamicGridFormElementsetNotLocationEquivalentCursors (std::function< bool(Item *item)> notLocationEquivalentCursorsGetter)
 Sets a getter (notLocationEquivalentGetter) for checking if the element's cursors are not location equivalent dynamically while rendering. More...
 
- Public Member Functions inherited from Visualization::SuperFormElement< NewFormElement, BaseFormElement >
NewFormElement * setBottomMargin (int bottom)
 Sets the bottom margin of this form element. More...
 
NewFormElement * setLeftMargin (int left)
 Sets the left margin of this form element. More...
 
NewFormElement * setMargins (int left, int top, int right, int bottom)
 Sets the left, top, right and bottom margins to the respective values. More...
 
NewFormElement * setMargins (int margin)
 Sets all the margins of this form element to the value specified as margin. More...
 
NewFormElement * setRightMargin (int right)
 Sets the right margin of this form element. More...
 
NewFormElement * setTopMargin (int top)
 Sets the top margin of this form element. More...
 

Private Member Functions

ItemDatadataForItem (const Item *item) const
 
GridLayouter::MajorAxis majorAxis (Item *item)
 
template<typename Definition , typename CompareFunction , typename CreateFunction , typename SyncFunction >
void synchronizeGrids (ItemData &data, const Definition &def, GridLayouter::MajorAxis majorAxis, CompareFunction compare, CreateFunction create, SyncFunction sync)
 

Private Attributes

LayoutStyle::Alignment horizontalAlignment_ {LayoutStyle::Alignment::Left}
 
QHash< const Item *, ItemData * > itemData_ {}
 
ItemsGetterFunction itemsGetterFunction_ {}
 
GridLayouter::MajorAxis majorAxis_ {}
 
MajorAxisGetterFunction majorAxisGetterFunction_ {}
 
NodesGetterFunction nodesGetterFunction_ {}
 
int spaceBetweenColumns_ {}
 
int spaceBetweenRows_ {}
 
SpanGetterFunction spanGetterFunction_ {}
 
LayoutStyle::Alignment verticalAlignment_ {LayoutStyle::Alignment::Top}
 

Member Typedef Documentation

◆ ItemsGetterFunction

using Visualization::DynamicGridFormElement::ItemsGetterFunction = std::function<QVector<QVector<Item*> >(Item* item)>

◆ MajorAxisGetterFunction

◆ NodesGetterFunction

using Visualization::DynamicGridFormElement::NodesGetterFunction = std::function<QVector<QVector<Model::Node*> >(Item* item)>

◆ SpanGetterFunction

using Visualization::DynamicGridFormElement::SpanGetterFunction = std::function<QVector<QVector<QPair<int, int> >>(Item* item)>

Constructor & Destructor Documentation

◆ DynamicGridFormElement() [1/2]

Visualization::DynamicGridFormElement::DynamicGridFormElement ( )
default

◆ DynamicGridFormElement() [2/2]

Visualization::DynamicGridFormElement::DynamicGridFormElement ( const DynamicGridFormElement other)

◆ ~DynamicGridFormElement()

Visualization::DynamicGridFormElement::~DynamicGridFormElement ( )
overridevirtual

Member Function Documentation

◆ clone()

DynamicGridFormElement * Visualization::DynamicGridFormElement::clone ( ) const
overridevirtual

◆ computeSize()

void Visualization::DynamicGridFormElement::computeSize ( Item item,
int  availableWidth,
int  availableHeight 
)
overridevirtual

◆ dataForItem()

DynamicGridFormElement::ItemData & Visualization::DynamicGridFormElement::dataForItem ( const Item item) const
private

◆ destroyChildItems()

void Visualization::DynamicGridFormElement::destroyChildItems ( Item item,
QList< const Item *const DeclarativeItemBase::* >  handledChildren 
)
overridevirtual

◆ elementOrChildHasFocus()

bool Visualization::DynamicGridFormElement::elementOrChildHasFocus ( Item item) const
overridevirtual

◆ focusedElementIndex()

QPoint Visualization::DynamicGridFormElement::focusedElementIndex ( Item item) const

Returns the index of the focused element for the specified item.

If no element is focused, returns {-1,-1}.

◆ gridSize()

QSize Visualization::DynamicGridFormElement::gridSize ( const Item item) const
inline

◆ indexOf()

QPoint Visualization::DynamicGridFormElement::indexOf ( Item item,
Item child 
) const

Returns the index of child or {-1, -1} if this layout does not manage child.

child could be a direct or an indirect child of the layout.

◆ isEmpty()

bool Visualization::DynamicGridFormElement::isEmpty ( const Item item) const
inlineoverridevirtual

◆ majorAxis()

GridLayouter::MajorAxis Visualization::DynamicGridFormElement::majorAxis ( Item item)
inlineprivate

◆ operator=()

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

◆ regions()

QList< ItemRegion > Visualization::DynamicGridFormElement::regions ( DeclarativeItemBase item,
int  parentX,
int  parentY 
)
overridevirtual

◆ setHorizontalAlignment()

DynamicGridFormElement * Visualization::DynamicGridFormElement::setHorizontalAlignment ( LayoutStyle::Alignment  alignment)
inline

Sets the horizontal alignment to alignment for all the cells in the grid.

Returns a pointer to this DynamicGridFormElement.

◆ setItemPositions()

void Visualization::DynamicGridFormElement::setItemPositions ( Item item,
int  parentX,
int  parentY 
)
overridevirtual

◆ setItemsGetter()

DynamicGridFormElement * Visualization::DynamicGridFormElement::setItemsGetter ( ItemsGetterFunction  itemGetter)
inline

◆ setMajorAxis()

DynamicGridFormElement * Visualization::DynamicGridFormElement::setMajorAxis ( GridLayouter::MajorAxis  majorAxis)
inline

Sets the major axis of this layout.

Returns a pointer to this DynamicGridFormElement.

If a major axis is set, the input grid is assumed to be a vector of [MajorAxis][MinorAxis].

◆ setMajorAxisGetter()

DynamicGridFormElement * Visualization::DynamicGridFormElement::setMajorAxisGetter ( MajorAxisGetterFunction  majorAxisGetter)
inline

◆ setNodesGetter()

DynamicGridFormElement * Visualization::DynamicGridFormElement::setNodesGetter ( NodesGetterFunction  nodeGetter)
inline

◆ setSpacing()

DynamicGridFormElement * Visualization::DynamicGridFormElement::setSpacing ( int  spaceBetweenColumns,
int  spaceBetweenRows 
)
inline

Sets the horizontal and the vertical spacing to spaceBetweenColumns and spaceBetweenRows respectively.

Returns a pointer to this DynamicGridFormElement.

◆ setSpanGetter()

DynamicGridFormElement * Visualization::DynamicGridFormElement::setSpanGetter ( SpanGetterFunction  spanGetter)
inline

◆ setVerticalAlignment()

DynamicGridFormElement * Visualization::DynamicGridFormElement::setVerticalAlignment ( LayoutStyle::Alignment  alignment)
inline

Sets the vertical alignment to alignment for all the cells in the grid.

Returns a pointer to this DynamicGridFormElement.

◆ sizeDependsOnParent()

bool Visualization::DynamicGridFormElement::sizeDependsOnParent ( const Item item) const
overridevirtual

◆ synchronizeGrids()

template<typename Definition , typename CompareFunction , typename CreateFunction , typename SyncFunction >
void Visualization::DynamicGridFormElement::synchronizeGrids ( ItemData data,
const Definition &  def,
GridLayouter::MajorAxis  majorAxis,
CompareFunction  compare,
CreateFunction  create,
SyncFunction  sync 
)
private

◆ synchronizeWithItem()

void Visualization::DynamicGridFormElement::synchronizeWithItem ( Item item)
overridevirtual

Member Data Documentation

◆ horizontalAlignment_

LayoutStyle::Alignment Visualization::DynamicGridFormElement::horizontalAlignment_ {LayoutStyle::Alignment::Left}
private

◆ itemData_

QHash<const Item*, ItemData*> Visualization::DynamicGridFormElement::itemData_ {}
mutableprivate

◆ itemsGetterFunction_

ItemsGetterFunction Visualization::DynamicGridFormElement::itemsGetterFunction_ {}
private

◆ majorAxis_

GridLayouter::MajorAxis Visualization::DynamicGridFormElement::majorAxis_ {}
private

◆ majorAxisGetterFunction_

MajorAxisGetterFunction Visualization::DynamicGridFormElement::majorAxisGetterFunction_ {}
private

◆ nodesGetterFunction_

NodesGetterFunction Visualization::DynamicGridFormElement::nodesGetterFunction_ {}
private

◆ spaceBetweenColumns_

int Visualization::DynamicGridFormElement::spaceBetweenColumns_ {}
private

◆ spaceBetweenRows_

int Visualization::DynamicGridFormElement::spaceBetweenRows_ {}
private

◆ spanGetterFunction_

SpanGetterFunction Visualization::DynamicGridFormElement::spanGetterFunction_ {}
private

◆ verticalAlignment_

LayoutStyle::Alignment Visualization::DynamicGridFormElement::verticalAlignment_ {LayoutStyle::Alignment::Top}
private