GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Public Member Functions | Protected Member Functions | List of all members
gd::BehaviorConfigurationContainer Class Reference

Base class for containers of behavior configuration. They can be attached to objects (Behavior) or layouts (BehaviorsSharedData). It stores the content (i.e: the properties) of a behavior of an object. More...

#include <BehaviorConfigurationContainer.h>

Inherited by gd::Behavior, and gd::BehaviorsSharedData.

Public Member Functions

 BehaviorConfigurationContainer (const gd::String &name_, const gd::String &type_)
 
virtual BehaviorConfigurationContainerClone () const
 
const gd::StringGetName () const
 Return the name identifying the behavior.
 
void SetName (const gd::String &name_)
 Change the name identifying the behavior.
 
const gd::StringGetTypeName () const
 Return the type of the behavior.
 
void SetTypeName (const gd::String &type_)
 Set the type of the behavior.
 
std::map< gd::String, gd::PropertyDescriptorGetProperties () const
 Called when the IDE wants to know about the custom properties of the behavior. More...
 
bool UpdateProperty (const gd::String &name, const gd::String &value)
 Called when the IDE wants to update a custom property of the behavior. More...
 
virtual void InitializeContent ()
 Called to initialize the content with the default properties for the behavior.
 
virtual void SerializeTo (gd::SerializerElement &element) const
 Serialize the behavior content.
 
virtual void UnserializeFrom (const gd::SerializerElement &element)
 Unserialize the behavior content.
 
const gd::SerializerElementGetContent () const
 
gd::SerializerElementGetContent ()
 
void SetFolded (bool fold=true)
 Set if the behavior configuration panel should be folded in the UI.
 
bool IsFolded () const
 True if the behavior configuration panel should be folded in the UI.
 

Protected Member Functions

virtual std::map< gd::String, gd::PropertyDescriptorGetProperties (const gd::SerializerElement &behaviorContent) const
 Called when the IDE wants to know about the custom properties of the behavior. More...
 
virtual bool UpdateProperty (gd::SerializerElement &behaviorContent, const gd::String &name, const gd::String &value)
 Called when the IDE wants to update a custom property of the behavior. More...
 
virtual void InitializeContent (gd::SerializerElement &behaviorContent)
 Called to initialize the content with the default properties for the behavior.
 

Detailed Description

Base class for containers of behavior configuration. They can be attached to objects (Behavior) or layouts (BehaviorsSharedData). It stores the content (i.e: the properties) of a behavior of an object.

See also
gd::Behavior
gd::BehaviorsSharedData

Member Function Documentation

◆ GetProperties() [1/2]

std::map< gd::String, gd::PropertyDescriptor > gd::BehaviorConfigurationContainer::GetProperties ( ) const

Called when the IDE wants to know about the custom properties of the behavior.

Returns
a std::map with properties names as key.
See also
gd::PropertyDescriptor

◆ GetProperties() [2/2]

std::map< gd::String, gd::PropertyDescriptor > gd::BehaviorConfigurationContainer::GetProperties ( const gd::SerializerElement behaviorContent) const
protectedvirtual

Called when the IDE wants to know about the custom properties of the behavior.

Implementation example:

std::map<gd::String, gd::PropertyDescriptor> properties;
properties[_("Initial speed")].SetValue(gd::String::From(initialSpeed));
return properties;
static String From(T value)
Method to create a gd::String from a number (float, double, int, ...)
Definition: String.h:219
Returns
a std::map with properties names as key.
See also
gd::PropertyDescriptor

Reimplemented in gd::CustomBehaviorsSharedData, and gd::CustomBehavior.

◆ UpdateProperty() [1/2]

bool gd::BehaviorConfigurationContainer::UpdateProperty ( const gd::String name,
const gd::String value 
)
inline

Called when the IDE wants to update a custom property of the behavior.

Returns
false if the new value cannot be set
See also
gd::InitialInstance

◆ UpdateProperty() [2/2]

virtual bool gd::BehaviorConfigurationContainer::UpdateProperty ( gd::SerializerElement behaviorContent,
const gd::String name,
const gd::String value 
)
inlineprotectedvirtual

Called when the IDE wants to update a custom property of the behavior.

Returns
false if the new value cannot be set
See also
gd::InitialInstance

Reimplemented in gd::CustomBehaviorsSharedData, and gd::CustomBehavior.


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