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

An abstract base class for obtaining descriptive phrase information. More...

#include <PhraseContent.h>

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

Public Types

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...
 

Public Member Functions

 smtkTypeMacroBase (PhraseContent)
 
virtual bool displayable (ContentType) const
 Should attr be present in the visual display of the phrase?
 
virtual bool editable (ContentType) const
 Is attr editable or fixed (for information/display only)?
 
virtual std::string stringValue (ContentType) const
 Return a string that reflects the given attr value.
 
virtual int flagValue (ContentType) const
 Return an integer bit-flag that reflects the given attr value.
 
virtual bool editStringValue (ContentType, const std::string &)
 Edit the attr value to become the given string (or returns false if no-change/invalid).
 
virtual bool editFlagValue (ContentType, int)
 Edit the attr value to become the given flag (or returns false if no-change/invalid).
 
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...
 
virtual bool operator== (const PhraseContent &other) const
 

Protected Attributes

WeakDescriptivePhrasePtr m_location
 

Detailed Description

An abstract base class for obtaining descriptive phrase information.

Subclasses implement methods which indicate whether particular information (title, subtitle, color, visibility, icon) is displayable and potentially editable. If they are, then methods to obtain or set values must also be implemented.

Each instance may hold a shared pointer to another instance, which it decorates. This can be used to change how some attributes are displayed or edited.

Member Enumeration Documentation

◆ ContentType

Accepted types of content.

Enumerator
TITLE 

The phrase's title.

EDITABLE_TITLE 

The text used to edit the content's title.

SUBTITLE 

The phrase's subtitle.

COLOR 

A control for displaying/editing the color of the phrase's subject.

VISIBILITY 

A control for displaying/editing the visibility of the phrase's subject.

ICON_LIGHTBG 

The icon of the phrase's subject for light backgrounds.

ICON_DARKBG 

The icon of the phrase's subject for dark backgrounds.

EVERYTHING 

Every aspect of the phrase content.

Member Function Documentation

◆ location()

DescriptivePhrasePtr smtk::view::PhraseContent::location ( ) const
inline

Return the location of this content in a DescriptivePhrase hierarchy.

The DescriptivePhrase instance which owns this content must be accessible from here so that when content is edited, the proper observers can be triggered in response (to keep a user interface up to date).

Note that you could, in theory, obtain a pointer to this instance by calling location()->content() and calling popDecorator() repeatedly (but this will obviously remove the instance from use).

◆ relatedObject()

virtual smtk::resource::PersistentObjectPtr smtk::view::PhraseContent::relatedObject ( ) const
inlinevirtual

Return the persistent object related to this phrase (or nullptr if not well defined).

This method simply calls relatedComponent() and relatedResource() under the hood, but that may change in the future.

Reimplemented in smtk::view::ObjectGroupPhraseContent, smtk::view::ResourcePhraseContent, and smtk::view::ComponentPhraseContent.

◆ setLocation()

bool smtk::view::PhraseContent::setLocation ( DescriptivePhrasePtr  locn)
inline

Set the descriptive phrase that will present this content.

Note that this should only be called by appendDecorator() or by subphrase generators as they create the initial content for a phrase.


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