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

Describe a list of child phrases to the user. More...

#include <PhraseListContent.h>

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

Public Member Functions

 smtkTypeMacro (PhraseListContent)
 
 smtkSharedPtrCreateMacro (PhraseContent)
 
Ptr setup (DescriptivePhrasePtr parent, smtk::model::BitFlags commonFlags, smtk::model::BitFlags unionFlags, int mutability=0)
 Initialize this list with an iterable container of subphrases. More...
 
bool displayable (ContentType attr) const override
 Should attr be present in the visual display of the phrase?
 
bool editable (ContentType attr) const override
 Is attr editable or fixed (for information/display only)?
 
std::string stringValue (ContentType attr) const override
 Return a string that reflects the given attr value.
 
int flagValue (ContentType attr) const override
 Return an integer bit-flag that reflects the given attr value.
 
bool editStringValue (ContentType attr, const std::string &val) override
 Edit the attr value to become the given string (or returns false if no-change/invalid).
 
bool editFlagValue (ContentType attr, int val) override
 Edit the attr value to become the given flag (or returns false if no-change/invalid).
 
smtk::resource::ComponentArray relatedComponents () const
 A convenience method for obtaining related components for each of the phrases in the list. More...
 
template<typename T >
relatedComponentsAs () const
 A convenience method for obtaining related components in a user-specified container. More...
 
virtual void setModelFlags (smtk::model::BitFlags commonFlags, smtk::model::BitFlags unionFlags)
 Allow subphrase generators to set summary information for model components in the list. More...
 
smtk::model::BitFlags commonModelFlags () const
 Return the bit-vector common to all smtk::model children in this list.
 
smtk::model::BitFlags unionModelFlags () const
 Return the bit-vector holding the union of all smtk::model children in this list.
 
void setMutability (int whatsMutable)
 
void setCustomTitle (const std::string &title)
 This method is for subphrase generators that wish to customize the list title. More...
 
bool operator== (const PhraseContent &other) const override
 
- Public Member Functions inherited from smtk::view::PhraseContent
 smtkTypeMacroBase (PhraseContent)
 
virtual smtk::resource::ResourcePtr relatedResource () const
 Return the resource related to this phrase (or nullptr if not well defined).
 
virtual smtk::resource::ResourcerelatedRawResource () const
 
virtual smtk::resource::ComponentPtr relatedComponent () const
 Return the resource component related to this phrase (or nullptr if not well defined).
 
virtual smtk::resource::ComponentrelatedRawComponent () const
 
virtual smtk::resource::PersistentObjectPtr relatedObject () const
 Return the persistent object related to this phrase (or nullptr if not well defined). More...
 
virtual smtk::operation::OperationPtr relatedOperation () const
 Return an operator related to this phrase (or nullptr if not well defined).
 
bool equalTo (const PhraseContent &other) const
 Test for use in derived-class equality operators.
 
DescriptivePhrasePtr location () const
 Return the location of this content in a DescriptivePhrase hierarchy. More...
 
bool setLocation (DescriptivePhrasePtr locn)
 Set the descriptive phrase that will present this content. More...
 

Static Public Member Functions

static DescriptivePhrasePtr createPhrase (DescriptivePhrasePtr parent, smtk::model::BitFlags commonFlags, smtk::model::BitFlags unionFlags, int mutability=0, const DescriptivePhrases &children=DescriptivePhrases())
 Create a descriptive phrase whose content is a PhraseListContent instance. More...
 

Protected Member Functions

std::string generateTitle (smtk::model::BitFlags &flagCommon, smtk::model::BitFlags &flagUnion) const
 

Protected Attributes

int m_mutability { 0 }
 
smtk::model::BitFlags m_commonFlags { smtk::model::INVALID }
 
smtk::model::BitFlags m_unionFlags { 0 }
 
std::string m_title
 
- Protected Attributes inherited from smtk::view::PhraseContent
WeakDescriptivePhrasePtr m_location
 

Additional Inherited Members

- Public Types inherited from smtk::view::PhraseContent
enum  ContentType {
  TITLE = 0x01, EDITABLE_TITLE = 0x02, SUBTITLE = 0x04, COLOR = 0x08,
  VISIBILITY = 0x10, ICON_LIGHTBG = 0x20, ICON_DARKBG = 0x40, EVERYTHING = 0xff
}
 Accepted types of content. More...
 

Detailed Description

Describe a list of child phrases to the user.

Subphrase generators create instances of this class when a parent phrase has more than one child, or when a list of phrases should be grouped together because they have some commonality.

Instances of this class generate their own titles by default based on the number and type of their children. For example, if a PhraseListContent has 3 children and they are all SMTK model faces, its default title will be "3 faces".

Member Function Documentation

◆ createPhrase()

DescriptivePhrasePtr smtk::view::PhraseListContent::createPhrase ( DescriptivePhrasePtr  parent,
smtk::model::BitFlags  commonFlags,
smtk::model::BitFlags  unionFlags,
int  mutability = 0,
const DescriptivePhrases children = DescriptivePhrases() 
)
static

Create a descriptive phrase whose content is a PhraseListContent instance.

This is for creating a phrase that a subphrase generator knows how to populate by inspecting the commonFlags() and unionFlags() values.

◆ relatedComponents()

smtk::resource::ComponentArray smtk::view::PhraseListContent::relatedComponents ( ) const

A convenience method for obtaining related components for each of the phrases in the list.

The list of entities to be presented.

◆ relatedComponentsAs()

template<typename T >
T smtk::view::PhraseListContent::relatedComponentsAs ( ) const
inline

A convenience method for obtaining related components in a user-specified container.

This method dynamically casts each phrase's relatedComponent() to the given container's type and back-inserts it into a new container of the templated type. Use this method when you know the components of interest in the array are a given subclass of smtk::resource::Component (e.g., smtk::model::Entity) by passing in a container of that type (e.g., relatedComponentsAs<smtk::model::EntityArray>()).

◆ setCustomTitle()

void smtk::view::PhraseListContent::setCustomTitle ( const std::string &  title)
inline

This method is for subphrase generators that wish to customize the list title.

This method is only intended for setup and ignores the mutability of the title, unlike setTitle(). Generally, this method should only be called when the title is not mutable.

◆ setModelFlags()

void smtk::view::PhraseListContent::setModelFlags ( smtk::model::BitFlags  commonFlags,
smtk::model::BitFlags  unionFlags 
)
virtual

Allow subphrase generators to set summary information for model components in the list.

Inform the descriptor what bits in entityFlags() are set across the list.

If an instance of PhraseListContent contains model entities, the SubphraseGenerator subclass (or other code) which populates the list of components should call this method.

The flags are used to generate the title summary in situations where setCustomTitle() is not used.

The commonFlags argument is the logical-AND of all entityFlags() of all entities in the list. The unionFlags argument is the logical-OR of all entityFlags().

These are used by PhraseListContent to choose an appropriate summary description of the entities.

◆ setup()

PhraseListContent::Ptr smtk::view::PhraseListContent::setup ( DescriptivePhrasePtr  parent,
smtk::model::BitFlags  commonFlags,
smtk::model::BitFlags  unionFlags,
int  mutability = 0 
)

Initialize this list with an iterable container of subphrases.

This templated method is provided so that arrays of shared-pointers to subclasses of DescriptivePhrase are also accepted. It is mostly intended for use by SubphraseGenerator and its subclasses.


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