SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
A badge that lets the user choose from a set of objects. More...
#include <MembershipBadge.h>
Public Types | |
using | DescriptivePhrase = smtk::view::DescriptivePhrase |
using | MemberMap = std::map< std::weak_ptr< smtk::resource::PersistentObject >, int, std::owner_less< std::weak_ptr< smtk::resource::PersistentObject > >> |
Signals | |
void | membershipChange (int val) |
Public Member Functions | |
smtkTypeMacro (smtk::extension::qt::MembershipBadge) | |
smtkSuperclassMacro (smtk::view::Badge) | |
smtkSharedFromThisMacro (smtk::view::Badge) | |
smtkCreateMacro (smtk::view::Badge) | |
MembershipBadge (smtk::view::BadgeSet &, const smtk::view::Configuration::Component &) | |
bool | appliesToPhrase (const DescriptivePhrase *) const override |
Returns true if the badge should appear next to the given phrase: | |
std::string | icon (const DescriptivePhrase *phrase, const std::array< float, 4 > &) const override |
Returns a string for rendering the badge icon. More... | |
bool | action (const smtk::view::DescriptivePhrase *, const smtk::view::BadgeAction &) override |
Take an action when the badge is clicked. More... | |
MemberMap & | getMemberMap () |
Provide external access to which items are selected. | |
bool | singleSelect () const |
Returns true if this badge is set to only allow a single member at a time. | |
MembershipCriteria | membershipCriteria () const |
![]() | |
smtkTypeMacroBase (Badge) | |
Badge (const Badge &)=delete | |
Badge & | operator= (const Badge &)=delete |
virtual std::string | tooltip (const DescriptivePhrase *) const |
Return a tool-tip string for the badge that is relevant to this phrase. 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 Attributes | |
MemberMap | m_members |
From available items, has this object been turned on? | |
bool | m_singleSelect |
If true, only 1 item may be a member; toggling an item resets others. More... | |
std::string | m_iconOn |
SVG for icon showing membership. | |
std::string | m_iconOff |
SVG for icon showing non-membership. | |
const smtk::view::BadgeSet * | m_parent { nullptr } |
MembershipCriteria | m_criteria { MembershipCriteria::All } |
std::string | m_filter |
![]() | |
bool | m_isDefault { false } |
Should this badge be invoked by non-specific user gestures when it is applicable? | |
A badge that lets the user choose from a set of objects.
|
overridevirtual |
Take an action when the badge is clicked.
Return true if the action is supported (and was taken) by the badge for the given phrase; otherwise return false.
Reimplemented from smtk::view::Badge.
|
overridevirtual |
Returns a string for rendering the badge icon.
The string is currently interpreted by qtDescriptivePhraseDelegate::paint() as scalable vector graphics (SVG).
The icon may change depending on (1) the state of the phrase or its parent view, (2) the background color of the phrase.
Implements smtk::view::Badge.
|
protected |
If true, only 1 item may be a member; toggling an item resets others.