SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
smtk::view::AssociationBadge Class Reference

A badge that appears when an object is missing a mandatory association. More...

#include <AssociationBadge.h>

Inheritance diagram for smtk::view::AssociationBadge:
[legend]
Collaboration diagram for smtk::view::AssociationBadge:
[legend]

Public Member Functions

 smtkTypeMacro (smtk::view::AssociationBadge)
 
 AssociationBadge (BadgeSet &, const Configuration::Component &)
 
bool appliesToPhrase (const DescriptivePhrase *phrase) const override
 This badge only applies to phrases with a persistent object that has an icon.
 
std::string tooltip (const DescriptivePhrase *phrase) const override
 The tool-tip string is the object's type.
 
std::string icon (const DescriptivePhrase *phrase, const std::array< float, 4 > &background) const override
 Returns an SVG string for rendering the badge icon. More...
 
- Public Member Functions inherited from smtk::view::Badge
 smtkTypeMacroBase (Badge)
 
 Badge (const Badge &)=delete
 
Badgeoperator= (const Badge &)=delete
 
virtual bool action (const DescriptivePhrase *, const BadgeAction &)
 Take an action when the badge is clicked. More...
 
bool isDefault () const
 Return whether this badge be invoked by non-specific user gestures. More...
 
void setIsDefault (bool isDefault)
 Set this badge as a default.
 

Protected Member Functions

bool appliesToObject (const smtk::resource::PersistentObjectPtr &obj) const
 
std::set< std::string > unmetRequirements (const smtk::resource::PersistentObjectPtr &obj) const
 

Protected Attributes

const BadgeSetm_parent { nullptr }
 
std::string m_applyToResource
 
std::string m_applyToComponent
 
std::set< std::string > m_requiredDefinitions
 
- Protected Attributes inherited from smtk::view::Badge
bool m_isDefault { false }
 Should this badge be invoked by non-specific user gestures when it is applicable?
 

Detailed Description

A badge that appears when an object is missing a mandatory association.

This badge must be configured with a set of required definitions. To do this, the badge's Configuration::Component must have one or more children of type Requires whose Definition attribute is the name of a definition.

The badge may also discriminate on the type of object to which associations are required. To do this, the badge's Configuration::Component must have exactly one child of type AppliesTo that has an attribute Resource that specifies the type-name of a resource. If the badge should appear next to resources of this type, that is all that is required. However, if the badge should instead appear next to components owned by resources of that type, the AppliesTo component must also have a Component attribute that specifies matching components with a query string. If an AppliesTo component is not provided, then all persistent objects will be checked for the required associations.

The badge will appear next to matching objects when:

When the badge appears, its tooltip will include the list of definitions that are not satisfied.

Member Function Documentation

◆ icon()

std::string smtk::view::AssociationBadge::icon ( const DescriptivePhrase phrase,
const std::array< float, 4 > &  background 
) const
overridevirtual

Returns an SVG string for rendering the badge icon.

The badge is an exclamation mark subtracted from a red circle.

Implements smtk::view::Badge.


The documentation for this class was generated from the following files: