Page Contents

Topics

Classes

LObject Class

#include <Layers/lobject.h>

Inherited By: LAttribute, LThemeable, LThemeItem

Public Functions

LObject(LObject* parent = nullptr)
void add_child(LObject* child)
std::vector<LObject*>& children()
void disconnect_destroyed(const LConnectionID& connection)
std::vector<T*> find_children(bool recursive = false)
LString object_name() const
LConnectionID on_destroyed(std::function<void()> callback)
LObject* parent() const
void remove_child(LObject* child)
void set_object_name(const LString& object_name)
void set_parent(LObject* parent)

Detailed Description

The LObject class is used to establish a hierarchy between Layers objects.

Member Function Documentation

LObject(LObject* parent = nullptr)

Constructs a Layers object and sets its parent.

void add_child(LObject* child)

Adds child to this object's list of child objects.

std::vector<LObject*>& children()

Returns a vector containing pointers to the child objects associated with this object.

void disconnect_destroyed(const LConnectionID& connection)

Disconnects the callback associated with connection to stop it from processing when this object gets destroyed.

std::vector<T*> find_children(bool recursive = false)

Returns a vector containing pointers to the child objects, of type T, associated with this object.

If recursive is true, then the returned vector will include children of children.

LString object_name() const

Returns the name of the object.

LConnectionID on_destroyed(std::function<void()> callback)

Stores callback and processes it whenever this object gets destroyed.

Returns a LConnectionID which can be used to disconnect the callback later through disconnect_destroyed().

LObject* parent() const

Returns a pointer to the object's parent.

Returns nullptr if no parent has been set.

void remove_child(LObject* child)

Removes child from this object's list of child objects.

void set_object_name(const LString& object_name)

Sets the object's name to object_name.

void set_parent(LObject* parent)

Sets the object's parent.