JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
juce::ComponentBuilder::TypeHandler Class Referenceabstract

The class is a base class for objects that manage the loading of a type of component from a ValueTree. More...

#include "juce_ComponentBuilder.h"

Public Member Functions

 TypeHandler (const Identifier &valueTreeType)
 Creates a TypeHandler.
 
virtual ~TypeHandler ()
 Destructor.
 
ComponentBuildergetBuilder () const noexcept
 Returns the builder that this type is registered with.
 
virtual ComponentaddNewComponentFromState (const ValueTree &state, Component *parent)=0
 This method must create a new component from the given state, add it to the specified parent component (which may be null), and return it.
 
virtual void updateComponentFromState (Component *component, const ValueTree &state)=0
 This method must update an existing component from a new ValueTree state.
 

Public Attributes

const Identifier type
 Returns the type of the ValueTrees that this handler can parse.
 

Friends

class ComponentBuilder
 

Detailed Description

The class is a base class for objects that manage the loading of a type of component from a ValueTree.

To store and re-load a tree of components as a ValueTree, each component type must have a TypeHandler to represent it.

See also
ComponentBuilder::registerTypeHandler(), Drawable::registerDrawableTypeHandlers()

Definition at line 100 of file juce_ComponentBuilder.h.

Constructor & Destructor Documentation

◆ TypeHandler()

juce::ComponentBuilder::TypeHandler::TypeHandler ( const Identifier valueTreeType)
explicit

Creates a TypeHandler.

The valueTreeType must be the type name of the ValueTrees that this handler can parse.

Definition at line 222 of file juce_ComponentBuilder.cpp.

◆ ~TypeHandler()

juce::ComponentBuilder::TypeHandler::~TypeHandler ( )
virtual

Destructor.

Definition at line 227 of file juce_ComponentBuilder.cpp.

Member Function Documentation

◆ addNewComponentFromState()

virtual Component * juce::ComponentBuilder::TypeHandler::addNewComponentFromState ( const ValueTree state,
Component parent 
)
pure virtual

This method must create a new component from the given state, add it to the specified parent component (which may be null), and return it.

The ValueTree will have been pre-checked to make sure that its type matches the type that this handler supports.

There's no need to set the new Component's ID to match that of the state - the builder will take care of that itself.

◆ getBuilder()

ComponentBuilder * juce::ComponentBuilder::TypeHandler::getBuilder ( ) const
noexcept

Returns the builder that this type is registered with.

Definition at line 231 of file juce_ComponentBuilder.cpp.

◆ updateComponentFromState()

virtual void juce::ComponentBuilder::TypeHandler::updateComponentFromState ( Component component,
const ValueTree state 
)
pure virtual

This method must update an existing component from a new ValueTree state.

A component that has been created with addNewComponentFromState() may need to be updated if the ValueTree changes, so this method is used to do that. Your implementation must do whatever's necessary to update the component from the new state provided.

The ValueTree will have been pre-checked to make sure that its type matches the type that this handler supports, and the component will have been created by this type's addNewComponentFromState() method.

Friends And Related Symbol Documentation

◆ ComponentBuilder

friend class ComponentBuilder
friend

Definition at line 144 of file juce_ComponentBuilder.h.

Member Data Documentation

◆ type

const Identifier juce::ComponentBuilder::TypeHandler::type

Returns the type of the ValueTrees that this handler can parse.

Definition at line 113 of file juce_ComponentBuilder.h.


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