SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
An abstract base class for obtaining descriptive phrase information. More...
#include <PhraseContent.h>
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::Resource * | relatedRawResource () const |
virtual smtk::resource::ComponentPtr | relatedComponent () const |
Return the resource component related to this phrase (or nullptr if not well defined). | |
virtual smtk::resource::Component * | relatedRawComponent () 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 |
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.
Accepted types of content.
|
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).
|
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.
|
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.