SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
10 #ifndef smtk_view_DescriptivePhrase_h
11 #define smtk_view_DescriptivePhrase_h
16 #include "smtk/view/PhraseContent.h"
18 #include "smtk/common/UUID.h"
31 class DescriptivePhrase;
32 class SubphraseGenerator;
91 using Badges = std::vector<Badge*>;
109 Badges badges()
const;
159 return m_content ? m_content->relatedRawResource() :
nullptr;
168 return m_content ? m_content->relatedRawComponent() :
nullptr;
176 return std::string();
194 bool hasChildren()
const;
197 virtual void markDirty(
bool dirty =
true) { m_subphrasesBuilt = !dirty; }
229 int indexInParent()
const;
248 void index(std::vector<int>& idx)
const;
252 std::vector<int> idx;
280 unsigned int phraseId()
const {
return m_phraseId; }
285 virtual bool isPropertyValueType()
const;
301 virtual void visitChildren(Visitor fn);
343 void buildSubphrases();
369 int visitChildrenInternal(Visitor fn, std::vector<int>& indices);
375 unsigned int m_phraseId;
377 mutable bool m_subphrasesBuilt{
false };
380 static unsigned int s_nextPhraseId;
virtual bool isSubtitleMutable() const
Indicate whether users should be allowed to edit the subtitle text.
Definition: DescriptivePhrase.h:137
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
@ COMPONENT_LIST
This phrase summarizes multiple components.
virtual bool areSubphrasesBuilt() const
Indicate whether the list of subphrases is built by a subphrase generator and is up to date.
Definition: DescriptivePhrase.h:199
virtual std::string relatedPropertyName() const
If this phrase describes a property attached to a component, return the property name.
Definition: DescriptivePhrase.h:174
@ SUBTITLE
The phrase's subtitle.
Definition: PhraseContent.h:49
@ RESOURCE_LIST
This phrase summarizes multiple resources.
Generate subphrases to display for a given descriptive phrase.
Definition: SubphraseGenerator.h:48
@ STRING_PROPERTY_VALUE
Show string values for a named property.
@ COMPONENT_SUMMARY
Summarize a component by displaying its name.
virtual smtk::resource::ComponentPtr relatedComponent() const
Return the resource component related to this phrase (or nullptr if not well defined).
Definition: DescriptivePhrase.h:162
smtk::weak_ptr< smtk::view::DescriptivePhrase > WeakDescriptivePhrasePtr
Definition: PublicPointerDefs.h:629
smtk::shared_ptr< smtk::view::PhraseContent > PhraseContentPtr
Definition: PublicPointerDefs.h:653
@ FLOAT_PROPERTY_VALUE
Show floating-point values for a named property.
virtual smtk::resource::ResourcePtr relatedResource() const
Return the resource related to this phrase (or nullptr if not well defined).
Definition: DescriptivePhrase.h:153
std::vector< smtk::view::DescriptivePhrasePtr > DescriptivePhrases
Definition: PublicPointerDefs.h:631
DescriptivePhraseType
Possible types of relationships that the iterator will report.
Definition: DescriptivePhrase.h:37
virtual smtk::resource::Resource * relatedRawResource() const
Convenience functions to fetch and modify content.
Definition: DescriptivePhrase.h:157
virtual std::string title() const
Convenience functions to fetch and modify content.
Definition: DescriptivePhrase.h:116
@ PROPERTY_LIST
Summarize a list of properties (usually of a single component).
std::vector< int > index() const
A convenience method that returns the index for the phrase.
Definition: DescriptivePhrase.h:250
#define smtkCreateMacro(...)
Add static create() methods to a class.
Definition: SharedFromThis.h:173
#define smtkEnableSharedPtr(...)
An abbreviation for enabling shared pointers.
Definition: SharedFromThis.h:214
@ INVALID_PROPERTY
Property has no storage.
Definition: PropertyType.h:36
@ RESOURCE_SUMMARY
Summarize a resource by name, filename, and perhaps timestamp.
@ INTEGER_PROPERTY_VALUE
Show integer values for a named property.
virtual bool setTitle(const std::string &newTitle)
A method called by user interface code to change the title text, returning true on success.
Definition: DescriptivePhrase.h:126
smtk::shared_ptr< smtk::view::PhraseModel > PhraseModelPtr
Definition: PublicPointerDefs.h:637
@ LIST
A list of descriptive phrases with no constraint on their type.
unsigned int phraseId() const
Return a unique integer ID of this phrase.
Definition: DescriptivePhrase.h:280
virtual bool setSubtitle(const std::string &newSubtitle)
A method called by user interfaces to change the subtitle text, returning true on success.
Definition: DescriptivePhrase.h:142
Hold and maintain a descriptive phrase hierarchy.
Definition: PhraseModel.h:101
virtual bool isTitleMutable() const
Indicate whether users should be allowed to edit the title text.
Definition: DescriptivePhrase.h:121
virtual void markDirty(bool dirty=true)
Indicate that this phrases children need to be rebuilt (or not if dirty is false).
Definition: DescriptivePhrase.h:197
virtual std::string subtitle()
Return supplementary text that should be displayed with less emphasis than the title.
Definition: DescriptivePhrase.h:132
@ INVALID_DESCRIPTION
This is used to indicate an invalid or empty descriptive phrase.
smtk::shared_ptr< smtk::view::SubphraseGenerator > SubphraseGeneratorPtr
Definition: PublicPointerDefs.h:645
virtual smtk::resource::Component * relatedRawComponent() const
Convenience functions to fetch and modify content.
Definition: DescriptivePhrase.h:166
A base class for phrases describing an SMTK model.
Definition: DescriptivePhrase.h:76
@ TITLE
The phrase's title.
Definition: PhraseContent.h:47
An abstract base class for SMTK resources.
Definition: Resource.h:72
std::function< int(DescriptivePhrasePtr, std::vector< int > &)> Visitor
The signature of a function used to visit all or part of a phrase hierarchy.
Definition: DescriptivePhrase.h:90
PropertyType
Primitive storage types for model properties.
Definition: PropertyType.h:31
smtk::shared_ptr< smtk::view::DescriptivePhrase > DescriptivePhrasePtr
Definition: PublicPointerDefs.h:627
virtual smtk::resource::PersistentObjectPtr relatedObject() const
Return the persistent object related to this phrase (or nullptr if not well defined).
Definition: DescriptivePhrase.h:148
Component is the base class for records stored in an smtk::resource::Resource.
Definition: Component.h:43
smtk::shared_ptr< smtk::resource::PersistentObject > PersistentObjectPtr
Definition: PublicPointerDefs.h:292
virtual smtk::resource::PropertyType relatedPropertyType() const
If this phrase describes a property attached to a component, return the property's type.
Definition: DescriptivePhrase.h:179
Macros for dealing with shared-pointer classes.
#define smtkTypeMacroBase(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:131
virtual DescriptivePhraseType phraseType() const
Return the role that the phrase plays in the description.
Definition: DescriptivePhrase.h:187
smtk::shared_ptr< smtk::resource::Component > ComponentPtr
Definition: PublicPointerDefs.h:304
virtual DescriptivePhrasePtr parent() const
Return the parent phrase of this phrase (or null).
Definition: DescriptivePhrase.h:190
smtk::shared_ptr< smtk::resource::Resource > ResourcePtr
Definition: PublicPointerDefs.h:302