GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
GroupEvent.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 #if defined(GD_IDE_ONLY)
8 #ifndef GDCORE_GROUPEVENT_H
9 #define GDCORE_GROUPEVENT_H
10 #include "GDCore/Events/Event.h"
11 #include "GDCore/Events/EventsList.h"
12 #include "GDCore/Events/Instruction.h"
13 namespace gd {
14 class Instruction;
15 class Project;
16 class EventVisitor;
17 }
18 class EventsCodeGenerationContext;
19 
20 namespace gd {
21 
26 class GD_CORE_API GroupEvent : public gd::BaseEvent {
27  public:
28  GroupEvent();
29  virtual ~GroupEvent(){};
30  virtual gd::GroupEvent* Clone() const { return new GroupEvent(*this); }
31 
32  virtual bool IsExecutable() const { return true; }
33 
37  const gd::String& GetName() const { return name; }
38 
42  void SetName(const gd::String& name_) { name = name_; }
43 
49  const gd::String& GetSource() const { return source; }
50 
54  void SetSource(const gd::String& source_) { source = source_; }
55 
64  std::vector<gd::String>& GetCreationParameters() { return parameters; }
65  const std::vector<gd::String>& GetCreationParameters() const {
66  return parameters;
67  }
68 
73  unsigned int GetCreationTimestamp() const { return creationTime; }
74 
80  void SetCreationTimestamp(unsigned int creationTime_) {
81  creationTime = creationTime_;
82  }
83 
87  void SetBackgroundColor(unsigned int colorR,
88  unsigned int colorG,
89  unsigned int colorB);
90 
94  unsigned int GetBackgroundColorR() const { return colorR; };
95 
99  unsigned int GetBackgroundColorG() const { return colorG; };
100 
104  unsigned int GetBackgroundColorB() const { return colorB; };
105 
106  virtual bool CanHaveSubEvents() const { return true; }
107  virtual const gd::EventsList& GetSubEvents() const { return events; };
108  virtual gd::EventsList& GetSubEvents() { return events; };
109 
110  virtual std::vector<gd::String> GetAllSearchableStrings() const;
111  virtual bool ReplaceAllSearchableStrings(
112  std::vector<gd::String> newSearchableString);
113 
114  virtual void SerializeTo(SerializerElement& element) const;
115  virtual void UnserializeFrom(gd::Project& project,
116  const SerializerElement& element);
117 
118  private:
119  EventsList events;
120 
121  gd::String name;
122  gd::String source;
124  unsigned int creationTime;
126  std::vector<gd::String>
127  parameters;
129  unsigned int colorR;
130  unsigned int colorG;
131  unsigned int colorB;
132 };
133 
134 } // namespace gd
135 
136 #endif // GDCORE_GROUPEVENT_H
137 #endif
Base class defining an event.
Definition: Event.h:44
A list of events.
Definition: EventsList.h:33
A group event, containing only sub events and some (visual only) properties.
Definition: GroupEvent.h:26
std::vector< gd::String > & GetCreationParameters()
Get the vector containing the parameters that have been used to create the group and its sub events.
Definition: GroupEvent.h:64
virtual gd::EventsList & GetSubEvents()
Definition: GroupEvent.h:108
void SetCreationTimestamp(unsigned int creationTime_)
Set timestamp of the creation of the group.
Definition: GroupEvent.h:80
virtual gd::GroupEvent * Clone() const
Definition: GroupEvent.h:30
virtual bool IsExecutable() const
Definition: GroupEvent.h:32
unsigned int GetBackgroundColorG() const
Get background color green component.
Definition: GroupEvent.h:99
unsigned int GetBackgroundColorR() const
Get background color red component.
Definition: GroupEvent.h:94
const gd::String & GetSource() const
Get the source of the group.
Definition: GroupEvent.h:49
unsigned int GetBackgroundColorB() const
Get background color blue component.
Definition: GroupEvent.h:104
const gd::String & GetName() const
Get the name of the group.
Definition: GroupEvent.h:37
virtual bool CanHaveSubEvents() const
Definition: GroupEvent.h:106
virtual const gd::EventsList & GetSubEvents() const
Definition: GroupEvent.h:107
unsigned int GetCreationTimestamp() const
Return the creation timestamp.
Definition: GroupEvent.h:73
void SetSource(const gd::String &source_)
Set the source of the group.
Definition: GroupEvent.h:54
void SetName(const gd::String &name_)
Change the name of the group.
Definition: GroupEvent.h:42
Base class representing a project (game), including all resources, scenes, objects,...
Definition: Project.h:50
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