Envision
A visual programming IDE for object-oriented languages
|
The sequential layout element can display a list of items either horizontally or vertically. More...
Classes | |
struct | ItemData |
Public Types | |
using | IntGetterFunction = std::function< int(Item *item)> |
using | ListNodeGetterFunction = std::function< Model::List *(Item *item)> |
using | ListOfItemsGetterFunction = std::function< QList< Item * >(Item *item)> |
using | ListOfNodesGetterFunction = std::function< QList< Model::Node * >(Item *item)> |
using | StretchableWhenEmptyGetterFunction = std::function< bool(const Item *item)> |
Public Member Functions | |
SequentialLayoutFormElement ()=default | |
SequentialLayoutFormElement (const SequentialLayoutFormElement &other) | |
virtual | ~SequentialLayoutFormElement () |
virtual SequentialLayoutFormElement * | clone () const override |
virtual void | computeSize (Item *item, int availableWidth, int availableHeight) override |
virtual void | destroyChildItems (Item *item, QList< const Item *const DeclarativeItemBase::* > handledChildren) override |
bool | elementOrChildHasFocus (Item *item) const override |
int | focusedElementIndex (const Item *item) const |
Returns the index of the focused element for the specified item. More... | |
bool | isEmpty (const Item *item) const override |
template<typename T > | |
T * | itemAt (const Item *item, int itemIndex) const |
Returns the item at itemIndex for this item. More... | |
int | length (const Item *item) const |
Returns the length of the displayed list of items for this item. More... | |
SequentialLayoutFormElement & | operator= (const SequentialLayoutFormElement &)=delete |
virtual QList< ItemRegion > | regions (DeclarativeItemBase *item, int parentX, int parentY) override |
SequentialLayoutFormElement * | setAlignment (LayoutStyle::Alignment alignment) |
Sets the alignment. More... | |
SequentialLayoutFormElement * | setForward (bool forward) |
Defines if this layout should be displayed forwards (true) or backwards (false). More... | |
SequentialLayoutFormElement * | setHorizontal () |
Sets this sequential layout to be horizontal, also sets the alignment to the default (bottom) More... | |
virtual void | setItemPositions (Item *item, int parentX, int parentY) override |
SequentialLayoutFormElement * | setListNode (ListNodeGetterFunction listNodeGetter) |
Sets the getter (listNodeGetter) for getting a node of type List, from which the list of items to render in the sequential layout can be computed. More... | |
SequentialLayoutFormElement * | setListOfItems (ListOfItemsGetterFunction itemListGetter) |
Sets the getter (itemListGetter) for getting a list of items to render in the sequential layout. More... | |
SequentialLayoutFormElement * | setListOfNodes (ListOfNodesGetterFunction nodeListGetter) |
Sets the getter (nodeListGetter) for getting a list of nodes, from which the list of items to render in the sequential layout can be computed. More... | |
SequentialLayoutFormElement * | setMinHeightGetter (IntGetterFunction minHeightGetter) |
Sets the minimum height to minHeight. More... | |
SequentialLayoutFormElement * | setMinWidthGetter (IntGetterFunction minWidthGetter) |
Sets the minimum width to minWidth. More... | |
SequentialLayoutFormElement * | setOrientation (Qt::Orientation orientation) |
Sets the orientation of this sequential layout. More... | |
SequentialLayoutFormElement * | setSpaceBetweenElements (int space) |
Sets what the space between two elements in the sequential layout should be. More... | |
SequentialLayoutFormElement * | setSpaceBetweenElements (std::function< int(Item *item)> spaceBetweenElementsGetter) |
Sets a getter (spaceBetweenElementsGetter) for getting the appropriate space between two elements dynamically while rendering. More... | |
SequentialLayoutFormElement * | setStretchableWhenEmpty (StretchableWhenEmptyGetterFunction stretchableWhenEmpty) |
Sets whether this form should be stretchable if it has no elements. More... | |
SequentialLayoutFormElement * | setVertical () |
Sets this sequential layout to be vertical, also sets the alignment to the default (left) More... | |
virtual bool | sizeDependsOnParent (const Item *item) const override |
virtual void | synchronizeWithItem (Item *item) override |
Public Member Functions inherited from Visualization::SuperLayoutElement< SequentialLayoutFormElement, LayoutFormElement > | |
SequentialLayoutFormElement * | setHasCursorWhenEmpty (std::function< bool(Item *item)> hasCursorWhenEmptyGetter) |
Sets a getter (cursorWhenEmptyGetter) for checking if the element should have cursors when empty dynamically while rendering. More... | |
SequentialLayoutFormElement * | setNoBoundaryCursors (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... | |
SequentialLayoutFormElement * | setNoInnerCursors (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... | |
SequentialLayoutFormElement * | setNotLocationEquivalentCursors (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 | |
ItemData & | dataForItem (const Item *item) const |
Returns the cached item list for this item. More... | |
int | spaceBetweenElements (Item *item) |
Computes the space between elements from the getter and the previously set space. More... | |
void | synchronizeWithItems (Item *item, const QList< Item * > &items) |
Synchronizes the old list of items for this item with the new list of items. More... | |
void | synchronizeWithNodes (Item *item, const QList< Model::Node * > &nodes) |
Synchronizes the old list of items for this item with the new list of nodes. More... | |
Private Attributes | |
LayoutStyle::Alignment | alignment_ {LayoutStyle::Alignment::Bottom} |
int | defaultSpaceBetweenElements_ {0} |
bool | forward_ {true} |
QHash< const Item *, ItemData * > | itemData_ {} |
ListOfItemsGetterFunction | itemListGetter_ {} |
ListNodeGetterFunction | listNodeGetter_ {} |
IntGetterFunction | minHeightGetter_ {} |
IntGetterFunction | minWidthGetter_ {} |
ListOfNodesGetterFunction | nodeListGetter_ {} |
Qt::Orientation | orientation_ {Qt::Horizontal} |
std::function< int(Item *item)> | spaceBetweenElementsGetter_ {} |
StretchableWhenEmptyGetterFunction | stretchableWhenEmpty_ {} |
The sequential layout element can display a list of items either horizontally or vertically.
It can directly be given a getter for a list of items, or alternatively a list of nodes or a node of type Model::List, out of which the list of items then can be constructed by rendering each node with its default visualization.
using Visualization::SequentialLayoutFormElement::IntGetterFunction = std::function<int (Item* item)> |
using Visualization::SequentialLayoutFormElement::ListNodeGetterFunction = std::function<Model::List*(Item* item)> |
using Visualization::SequentialLayoutFormElement::ListOfItemsGetterFunction = std::function<QList<Item*>(Item* item)> |
using Visualization::SequentialLayoutFormElement::ListOfNodesGetterFunction = std::function<QList<Model::Node*>(Item* item)> |
using Visualization::SequentialLayoutFormElement::StretchableWhenEmptyGetterFunction = std::function<bool (const Item* item)> |
|
default |
Visualization::SequentialLayoutFormElement::SequentialLayoutFormElement | ( | const SequentialLayoutFormElement & | other | ) |
|
virtual |
|
overridevirtual |
|
overridevirtual |
|
private |
Returns the cached item list for this item.
|
overridevirtual |
|
override |
int Visualization::SequentialLayoutFormElement::focusedElementIndex | ( | const Item * | item | ) | const |
Returns the index of the focused element for the specified item.
If no element is focused, returns -1. This method is very similar to the focsedElementIndex of SequentialLayout (layouts folder).
|
override |
T * Visualization::SequentialLayoutFormElement::itemAt | ( | const Item * | item, |
int | itemIndex | ||
) | const |
Returns the item at itemIndex for this item.
int Visualization::SequentialLayoutFormElement::length | ( | const Item * | item | ) | const |
Returns the length of the displayed list of items for this item.
|
delete |
|
overridevirtual |
|
inline |
Sets the alignment.
If it is not compatible with the layout's orientation, it will fall back to the default.
|
inline |
Defines if this layout should be displayed forwards (true) or backwards (false).
Example: forwards (default): |0|1|2|3| backwards: |3|2|1|0|
|
inline |
Sets this sequential layout to be horizontal, also sets the alignment to the default (bottom)
|
overridevirtual |
|
inline |
Sets the getter (listNodeGetter) for getting a node of type List, from which the list of items to render in the sequential layout can be computed.
The items will be rendered with their default style.
|
inline |
Sets the getter (itemListGetter) for getting a list of items to render in the sequential layout.
|
inline |
Sets the getter (nodeListGetter) for getting a list of nodes, from which the list of items to render in the sequential layout can be computed.
The items will be rendered with their default style.
|
inline |
Sets the minimum height to minHeight.
|
inline |
Sets the minimum width to minWidth.
|
inline |
Sets the orientation of this sequential layout.
Also sets the alignment to the default (bottom for horizontal, left for vertical).
|
inline |
Sets what the space between two elements in the sequential layout should be.
|
inline |
Sets a getter (spaceBetweenElementsGetter) for getting the appropriate space between two elements dynamically while rendering.
If this getter is set, anything set with the setSpaceBetweenElements(int) will be ignored.
|
inline |
Sets whether this form should be stretchable if it has no elements.
|
inline |
Sets this sequential layout to be vertical, also sets the alignment to the default (left)
|
overridevirtual |
|
private |
Computes the space between elements from the getter and the previously set space.
|
overridevirtual |
|
private |
Synchronizes the old list of items for this item with the new list of items.
|
private |
Synchronizes the old list of items for this item with the new list of nodes.
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |