Envision
A visual programming IDE for object-oriented languages
|
The ViewItem class represents the visualization of an entire view within a single item. More...
Classes | |
struct | ArrowToAdd |
Public Types | |
typedef DeclarativeItemBaseStyle | StyleType |
Public Member Functions | |
ViewItem (Item *parent, QString name={}, StyleType *style=itemStyles().get()) | |
void | addArrow (Model::Node *from, Model::Node *to, QString layer, ViewItemNode *fromParent=nullptr, ViewItemNode *toParent=nullptr) |
Adds an arrow from the first to the second node on the given arrow layer. More... | |
virtual QList< Visualization::VisualizationAddOn * > | addOns () override |
void | addSpacing (MajorMinorIndex index, Model::Node *spacingTarget, ViewItemNode *spacingParent) |
Adds a spacing node at the given position, using the given target and parent to determine the spacing. More... | |
QList< Model::Node * > | allNodes () const |
Returns all nodes in the grid in list form. More... | |
QStringList | arrowLayers () const |
Returns the names of all the available arrow layers. More... | |
QList< QPair< Item *, Item * > > | arrowsForLayer (QString layer) |
Returns the items for which an arrow should be drawn in the given arrow layer. More... | |
virtual void | determineChildren () override |
void | fromJson (QJsonDocument json) |
QString | fullLayerName (const QString &localLayer) const |
Returns the full layer name of the local arrow layer, as used in the overlay which exists in the scene itself. More... | |
virtual Visualization::InteractionHandler * | handler () const override |
void | insertMajor (int major) |
Insert an empty major element into the grid of nodes. More... | |
ViewItemNode * | insertNode (Model::Node *node, MajorMinorIndex pos={}, int purpose=-1) |
Insert the given node into the grid at the given position, rendering it with the given purpose. More... | |
GridLayouter::MajorAxis | majorAxis () const |
const QString & | name () const |
Model::Node * | nodeAt (MajorMinorIndex index) const |
Returns the node at the given position. More... | |
MajorMinorIndex | positionOfItem (Item *item) const |
Returns the position of the given item's node in the grid, or (-1, -1) if the item has no node, or the node is not part of the grid. More... | |
MajorMinorIndex | positionOfNode (Model::Node *node) const |
Returns the position of the given node in the grid, or (-1, -1) if it doesn't exist. More... | |
void | removeNode (Model::Node *node) |
Remove the given node from the view (this does not delete the node from the model) More... | |
void | setArrowStyle (QString layer, QString styleName) |
void | setMajorAxis (GridLayouter::MajorAxis majorAxis) |
void | setName (const QString &name) |
Sets the name to the given name. More... | |
virtual void | setStyle (const Visualization::ItemStyle *itemStyle) override |
void | setZoomLabelsEnabled (bool zoomLabelsEnabled) |
const StyleType * | style () const |
QJsonDocument | toJson () const |
virtual void | updateGeometry (int availableWidth, int availableHeight) override |
bool | zoomLabelsEnabled () |
Static Public Member Functions | |
static void | addAddOn (Visualization::VisualizationAddOn *addOn) |
static Visualization::InteractionHandler * | defaultClassHandler () |
static void | initializeForms () |
static bool | isValidName (const QString &name) |
Returns whether this is a valid name for a ViewItem. More... | |
static Visualization::StyleSet< ViewItem > & | itemStyles () |
static int | publicInterfacePurpose () |
The purpose to use when rendering only the public interface of an item. More... | |
static bool | removeAddOn (Visualization::VisualizationAddOn *addOn) |
static void | setDefaultClassHandler (Visualization::InteractionHandler *handler) |
Private Member Functions | |
void | addArrowLayer (QString layer, bool enabled=true) |
void | arrowFromJson (QJsonObject json) |
QJsonObject | arrowToJson (QPair< Item *, Item * > arrow, QString layer) const |
void | cleanupRemovedItem (Item *item) |
Notify the view about an item being removed externally (e.g. More... | |
void | cleanupRemovedNode (Model::Node *node) |
void | ensureMajorExists (int major) |
void | ensurePositionExists (MajorMinorIndex index) |
void | insertViewItemNode (ViewItemNode *node, MajorMinorIndex index) |
QVector< QVector< Model::Node * > > | nodesGetter () |
template<typename NodeType > | |
QList< NodeType * > | referencesOfType () const |
void | removeArrowsForItem (Item *parent) |
Static Private Member Functions | |
static QList< Visualization::VisualizationAddOn * > & | staticAddOns () |
Private Attributes | |
QHash< QString, QList< QPair< Item *, Item * > > > | arrows_ |
QList< ArrowToAdd > | arrowsToAdd_ |
QHash< QString, QString > | arrowStyles_ |
QStringList | disabledArrowLayers_ |
GridLayouter::MajorAxis | majorAxis_ {GridLayouter::ColumnMajor} |
QString | name_ |
QVector< QVector< Model::Node * > > | nodes_ |
bool | zoomLabelsEnabled_ {true} |
Static Private Attributes | |
static Visualization::InteractionHandler * | defaultClassHandler_ = nullptr |
Friends | |
class | ViewItemManager |
Additional Inherited Members | |
Protected Types inherited from Core::Reflect< Base > | |
using | Super = Reflect< Base > |
The ViewItem class represents the visualization of an entire view within a single item.
All items in a view should be added and removed via this ViewItem class. Each Scene object contains a list of ViewItem objects which can be used for that. Using this, it is possible to control what is shown on the screen.
Visualization::ViewItem::ViewItem | ( | Item * | parent, |
QString | name = {} , |
||
StyleType * | style = itemStyles().get() |
||
) |
|
static |
void Visualization::ViewItem::addArrow | ( | Model::Node * | from, |
Model::Node * | to, | ||
QString | layer, | ||
ViewItemNode * | fromParent = nullptr , |
||
ViewItemNode * | toParent = nullptr |
||
) |
Adds an arrow from the first to the second node on the given arrow layer.
If fromParent and toParent are set, only one arrow will be drawn. Otherwise, an arrow will be drawn between any two instances of the given nodes.
|
private |
|
overridevirtual |
void Visualization::ViewItem::addSpacing | ( | MajorMinorIndex | index, |
Model::Node * | spacingTarget, | ||
ViewItemNode * | spacingParent | ||
) |
Adds a spacing node at the given position, using the given target and parent to determine the spacing.
QList< Model::Node * > Visualization::ViewItem::allNodes | ( | ) | const |
Returns all nodes in the grid in list form.
|
private |
QStringList Visualization::ViewItem::arrowLayers | ( | ) | const |
Returns the names of all the available arrow layers.
Returns the items for which an arrow should be drawn in the given arrow layer.
|
private |
|
private |
Notify the view about an item being removed externally (e.g.
by deleting its node).
|
private |
|
inlinestatic |
|
overridevirtual |
|
private |
|
private |
void Visualization::ViewItem::fromJson | ( | QJsonDocument | json | ) |
|
inline |
Returns the full layer name of the local arrow layer, as used in the overlay which exists in the scene itself.
|
overridevirtual |
|
static |
void Visualization::ViewItem::insertMajor | ( | int | major | ) |
Insert an empty major element into the grid of nodes.
ViewItemNode * Visualization::ViewItem::insertNode | ( | Model::Node * | node, |
MajorMinorIndex | pos = {} , |
||
int | purpose = -1 |
||
) |
Insert the given node into the grid at the given position, rendering it with the given purpose.
|
private |
|
static |
Returns whether this is a valid name for a ViewItem.
|
static |
|
inline |
|
inline |
Model::Node * Visualization::ViewItem::nodeAt | ( | MajorMinorIndex | index | ) | const |
Returns the node at the given position.
If the position is invalid, returns nullptr.
|
private |
MajorMinorIndex Visualization::ViewItem::positionOfItem | ( | Item * | item | ) | const |
Returns the position of the given item's node in the grid, or (-1, -1) if the item has no node, or the node is not part of the grid.
MajorMinorIndex Visualization::ViewItem::positionOfNode | ( | Model::Node * | node | ) | const |
Returns the position of the given node in the grid, or (-1, -1) if it doesn't exist.
|
static |
The purpose to use when rendering only the public interface of an item.
|
inlineprivate |
|
static |
|
private |
void Visualization::ViewItem::removeNode | ( | Model::Node * | node | ) |
Remove the given node from the view (this does not delete the node from the model)
void Visualization::ViewItem::setArrowStyle | ( | QString | layer, |
QString | styleName | ||
) |
|
inlinestatic |
void Visualization::ViewItem::setMajorAxis | ( | GridLayouter::MajorAxis | majorAxis | ) |
void Visualization::ViewItem::setName | ( | const QString & | name | ) |
Sets the name to the given name.
Ensure that isValidName(name) holds.
|
overridevirtual |
|
inline |
|
staticprivate |
|
inline |
QJsonDocument Visualization::ViewItem::toJson | ( | ) | const |
|
overridevirtual |
|
inline |
|
friend |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |