GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
ExternalLayout.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-2016 Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 
7 #ifndef GDCORE_EXTERNALLAYOUT_H
8 #define GDCORE_EXTERNALLAYOUT_H
9 #include <memory>
10 
11 #include "GDCore/Project/InitialInstancesContainer.h"
12 #include "GDCore/String.h"
13 namespace gd {
14 class SerializerElement;
15 }
16 #include "GDCore/IDE/Dialogs/LayoutEditorCanvas/EditorSettings.h"
17 
18 namespace gd {
19 
24 class GD_CORE_API ExternalLayout {
25  public:
26  ExternalLayout(){};
27  virtual ~ExternalLayout(){};
28 
32  ExternalLayout* Clone() const { return new ExternalLayout(*this); };
33 
37  const gd::String& GetName() const { return name; }
38 
42  void SetName(const gd::String& name_) { name = name_; }
43 
48  return instances;
49  }
50 
55 
60  return editorSettings;
61  }
62 
66  gd::EditorSettings& GetAssociatedEditorSettings() { return editorSettings; }
67 
71  const gd::String& GetAssociatedLayout() { return associatedLayout; }
72 
76  void SetAssociatedLayout(const gd::String& name) { associatedLayout = name; }
77 
81 
84  void SerializeTo(SerializerElement& element) const;
85 
89  void UnserializeFrom(const SerializerElement& element);
91 
92  private:
93  gd::String name;
95  gd::EditorSettings editorSettings;
96  gd::String associatedLayout;
97 };
98 
103  : public std::binary_function<std::unique_ptr<gd::ExternalLayout>,
104  gd::String,
105  bool> {
106  bool operator()(const std::unique_ptr<gd::ExternalLayout>& externalLayout,
107  gd::String name) const {
108  return externalLayout->GetName() == name;
109  }
110 };
111 
112 } // namespace gd
113 
114 #endif // GDCORE_EXTERNALLAYOUT_H
Container for arbitrary serialized data to be used by the editor to store settings.
Definition: EditorSettings.h:19
An external layout allows to create layouts of objects that can be then inserted on a layout.
Definition: ExternalLayout.h:24
gd::InitialInstancesContainer & GetInitialInstances()
Return the container storing initial instances.
Definition: ExternalLayout.h:54
void SetName(const gd::String &name_)
Change the name of the external layout.
Definition: ExternalLayout.h:42
const gd::String & GetAssociatedLayout()
Get the name of the layout last used to edit the external layout.
Definition: ExternalLayout.h:71
const gd::EditorSettings & GetAssociatedEditorSettings() const
Get the user settings for the IDE.
Definition: ExternalLayout.h:59
ExternalLayout * Clone() const
Return a pointer to a new ExternalLayout constructed from this one.
Definition: ExternalLayout.h:32
gd::EditorSettings & GetAssociatedEditorSettings()
Get the user settings for the IDE.
Definition: ExternalLayout.h:66
const gd::String & GetName() const
Return the name of the external layout.
Definition: ExternalLayout.h:37
void SetAssociatedLayout(const gd::String &name)
Set the name of the layout used to edit the external layout.
Definition: ExternalLayout.h:76
const gd::InitialInstancesContainer & GetInitialInstances() const
Return the container storing initial instances.
Definition: ExternalLayout.h:47
Defines a container of gd::InitialInstances.
Definition: InitialInstancesContainer.h:38
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
String represents an UTF8 encoded string.
Definition: String.h:31
Definition: CommonTools.h:24
Functor testing ExternalLayout' name.
Definition: ExternalLayout.h:105