MT Showcase SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Showcase::UIComponentInstance Class Reference

This is a base instance class for components that provide UI functionality. More...

#include <UIComponent.hpp>

Inheritance diagram for Showcase::UIComponentInstance:
Showcase::ComponentInstance Showcase::OperatorInstance Showcase::RootInstance Showcase::ScheduleInstance Showcase::WidgetInstance

Public Member Functions

 UIComponentInstance (std::shared_ptr< Component > component)
 Create a new instance from the given component. More...
 
virtual void setContent (const QByteArray &slotName, std::shared_ptr< ContentNode > content)
 Set a new content set for this instance. More...
 
virtual void removeContent (const QByteArray &slotName, std::shared_ptr< ContentNode > content)
 Remove content set from this instance. More...
 
virtual void contentNodeFound (std::shared_ptr< ContentNode > node, std::shared_ptr< ContentNode > parent=nullptr)
 Called when a new content node is found in a content graph. More...
 
virtual void contentNodeLost (std::shared_ptr< ContentNode > node, std::shared_ptr< ContentNode > parent=nullptr)
 Called when a content node is lost. More...
 
virtual void contentNodeLostProperty (std::shared_ptr< ContentNode > contentNode, const Property &prop)
 Called when a content node has lost a property. More...
 
virtual void contentNodeReceivedProperty (std::shared_ptr< ContentNode > contentNode, const Property &prop)
 Called when a content node has found a property. More...
 
virtual void componentAddedToSlot (const QByteArray &slotName, std::shared_ptr< Component > comp)
 Called when another component is added to a slot of this component. More...
 
virtual void componentRemovedFromSlot (const QByteArray &slotName, std::shared_ptr< Component > comp)
 Called when another component is removed from a slot of this component. More...
 
- Public Member Functions inherited from Showcase::ComponentInstance
 ComponentInstance (std::shared_ptr< Component > component)
 Create a new instance from the given component. More...
 
virtual ~ComponentInstance ()
 Each subclass needs to do needed clean up in their own destructors (should be enough to call removeInstance) More...
 
virtual MultiWidgets::WidgetPtr widgetInstance ()
 After first call of this, user of the component is required to keep track of the widget. More...
 
virtual MultiWidgets::OperatorPtr operatorInstance (MultiWidgets::Widget &host, bool immediate=false)
 Assigns the operator to the given widget. More...
 
std::shared_ptr< Componentcreator () const
 An instance is always tied to a component and can't exist without the component that created it. More...
 
virtual void propertyReceived (const PropertyKey &key, const PropertyValue &value)
 Called for each property found for the creator component This function may be called same time from multiple threads. More...
 
virtual void propertyLost (const PropertyKey &key, const PropertyValue &value)
 Called when a property is unset for the component This function may be called same time from multiple threads. More...
 

Protected Member Functions

virtual void removeInstance () override
 Allows removing component instance when the component is removed. More...
 
- Protected Member Functions inherited from Showcase::ComponentInstance
void onDelete ()
 This needs to be set up so that when the actual instance (not this proxy object) is removed this is called (f.ex. More...
 

Detailed Description

This is a base instance class for components that provide UI functionality.

Constructor & Destructor Documentation

Showcase::UIComponentInstance::UIComponentInstance ( std::shared_ptr< Component component)

Create a new instance from the given component.

Parameters
componentthe creator component

Member Function Documentation

void Showcase::UIComponentInstance::componentAddedToSlot ( const QByteArray &  slotName,
std::shared_ptr< Component comp 
)
virtual

Called when another component is added to a slot of this component.

This is meant for overriding, default implementation does nothing

Parameters
slotNamename of the slot
compthe added component

Reimplemented in Showcase::WidgetInstance, and Showcase::RootInstance.

void Showcase::UIComponentInstance::componentRemovedFromSlot ( const QByteArray &  slotName,
std::shared_ptr< Component comp 
)
virtual

Called when another component is removed from a slot of this component.

This is meant for overriding, default implementation does nothing

Parameters
slotNamename of the slot
compthe removed component

Reimplemented in Showcase::WidgetInstance.

void Showcase::UIComponentInstance::contentNodeFound ( std::shared_ptr< ContentNode node,
std::shared_ptr< ContentNode parent = nullptr 
)
virtual

Called when a new content node is found in a content graph.

This is meant for overriding, default implementation does nothing

Parameters
nodecontent node that was found
parentparent node of the found content node. Can be null
Examples:
ContentExampleWidget.cpp.
void Showcase::UIComponentInstance::contentNodeLost ( std::shared_ptr< ContentNode node,
std::shared_ptr< ContentNode parent = nullptr 
)
virtual

Called when a content node is lost.

This is meant for overriding, default implementation does nothing

Parameters
nodecontent node that was lost
parentparent node of the lost content node. Can be null
Examples:
ContentExampleWidget.cpp.
void Showcase::UIComponentInstance::contentNodeLostProperty ( std::shared_ptr< ContentNode contentNode,
const Property &  prop 
)
virtual

Called when a content node has lost a property.

This is meant for overriding, default implementation does nothing

Parameters
contentNodethe affected content node
propthe lost property
void Showcase::UIComponentInstance::contentNodeReceivedProperty ( std::shared_ptr< ContentNode contentNode,
const Property &  prop 
)
virtual

Called when a content node has found a property.

This is meant for overriding, default implementation does nothing

Parameters
contentNodethe affected content node
propthe found property
void Showcase::UIComponentInstance::removeContent ( const QByteArray &  slotName,
std::shared_ptr< ContentNode content 
)
virtual

Remove content set from this instance.

This is called automatically by UIComponent when it loses a content set in the given slot. By default calls contentNodeLost with the root content node

Parameters
slotNamename of the content slot
contentroot node of the new content set
virtual void Showcase::UIComponentInstance::removeInstance ( )
inlineoverrideprotectedvirtual

Allows removing component instance when the component is removed.

Implementations must not call instanceDestroyed of the associated component

Implements Showcase::ComponentInstance.

Reimplemented in Showcase::WidgetInstance, Showcase::RootInstance, Showcase::OperatorInstance, and Showcase::ScheduleInstance.

void Showcase::UIComponentInstance::setContent ( const QByteArray &  slotName,
std::shared_ptr< ContentNode content 
)
virtual

Set a new content set for this instance.

This is called automatically by UIComponent when it receives a new content set in the given slot. By default calls contentNodeFound with the root content node

Parameters
slotNamename of the content slot
contentroot node of the new content set