Files
GDevelop/Core/GDCore/Project/ExternalLayout.h
D8H deb802cfec Allow to override behavior properties on object instances (#8171)
* For now, this is limited to instances inside custom objects. This will be made available in the future for all instances in scenes if this works well.
2026-02-09 16:21:24 +01:00

101 lines
2.5 KiB
C++

/*
* GDevelop Core
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
* reserved. This project is released under the MIT License.
*/
#pragma once
#include <memory>
#include "GDCore/Project/InitialInstancesContainer.h"
#include "GDCore/String.h"
namespace gd {
class SerializerElement;
}
#include "GDCore/IDE/Dialogs/LayoutEditorCanvas/EditorSettings.h"
namespace gd {
/**
* \brief An external layout allows to create layouts of objects that can be
* then inserted on a layout.
*/
class GD_CORE_API ExternalLayout {
public:
ExternalLayout(){};
virtual ~ExternalLayout(){};
/**
* \brief Return a pointer to a new ExternalLayout constructed from this one.
*/
ExternalLayout* Clone() const { return new ExternalLayout(*this); };
/**
* \brief Return the name of the external layout.
*/
const gd::String& GetName() const { return name; }
/**
* \brief Change the name of the external layout.
*/
void SetName(const gd::String& name_) { name = name_; }
/**
* \brief Return the container storing initial instances.
*/
const gd::InitialInstancesContainer& GetInitialInstances() const {
return instances;
}
/**
* \brief Return the container storing initial instances.
*/
gd::InitialInstancesContainer& GetInitialInstances() { return instances; }
/**
* \brief Get the user settings for the IDE.
*/
const gd::EditorSettings& GetAssociatedEditorSettings() const {
return editorSettings;
}
/**
* \brief Get the user settings for the IDE.
*/
gd::EditorSettings& GetAssociatedEditorSettings() { return editorSettings; }
/**
* \brief Get the name of the layout last used to edit the external layout.
*/
const gd::String& GetAssociatedLayout() { return associatedLayout; }
/**
* \brief Set the name of the layout used to edit the external layout.
*/
void SetAssociatedLayout(const gd::String& name) { associatedLayout = name; }
/** \name Serialization
*/
///@{
/**
* \brief Serialize external layout.
*/
void SerializeTo(SerializerElement& element) const;
/**
* \brief Unserialize the external layout.
*/
void UnserializeFrom(gd::Project &project, const SerializerElement& element);
///@}
private:
gd::String name;
gd::InitialInstancesContainer instances;
gd::EditorSettings editorSettings;
gd::String associatedLayout;
};
} // namespace gd