Game Develop Core: ForEachEvent.h Source File

| Game Develop Core Core library for developing platforms and tools compatible with Game Develop.

- Main Page
- Modules
- Classes

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Macros Groups Pages
ForEachEvent.h
Go to the documentation of this file.
1
6 #ifndef FOREACHEVENT_H
7 #define FOREACHEVENT_H
8 #include "GDCore/Events/Event.h"
9 class RuntimeScene;
10 namespace gd { class Instruction; }
11 namespace gd { class Project; }
12 namespace gd { class MainFrameWrapper; }
13 class TiXmlElement;
14 namespace gd { class EventsEditorItemsAreas; }
15 namespace gd { class EventsEditorSelection; }
16 namespace gd { class Layout; }
17 class wxWindow;
18
19 namespace gd
20 {
21
27 class GD_CORE_API ForEachEvent : public gd::BaseEvent
28 {
29 public:
30 ForEachEvent();
31 ForEachEvent(const ForEachEvent & event);
32 virtual ~ForEachEvent() {};
33
34 ForEachEvent& operator=(const ForEachEvent & event);
35 virtual gd::BaseEventSPtr Clone() const { return boost::shared_ptr<gd::BaseEvent>(new ForEachEvent(*this));}
36
37 virtual bool IsExecutable() const {return true;}
38
39 virtual bool CanHaveSubEvents() const {return true;}
40 virtual const std::vector < gd::BaseEventSPtr > & GetSubEvents() const {return events;};
41 virtual std::vector < gd::BaseEventSPtr > & GetSubEvents() {return events;};
42 void SetSubEvents(std::vector < gd::BaseEventSPtr > & subEvents_) {events = subEvents_;};
43
44 const std::vector < gd::Instruction > & GetConditions() const { return conditions; };
45 std::vector < gd::Instruction > & GetConditions() { return conditions; };
46 void SetConditions(std::vector < gd::Instruction > & conditions_) { conditions = conditions_; };
47
48 const std::vector < gd::Instruction > & GetActions() const { return actions; };
49 std::vector < gd::Instruction > & GetActions() { return actions; };
50 void SetActions(std::vector < gd::Instruction > & actions_) { actions = actions_; };
51
52 std::string GetObjectToPick() const { return objectsToPick.GetPlainString(); };
53 std::string GetObjectToPick() { return objectsToPick.GetPlainString(); };
54 void SetObjectToPick(std::string objectsToPick_) { objectsToPick = gd::Expression(objectsToPick_); };
55
56 virtual std::vector < std::vector<gd::Instruction>* > GetAllConditionsVectors();
57 virtual std::vector < std::vector<gd::Instruction>* > GetAllActionsVectors();
58 virtual std::vector < gd::Expression* > GetAllExpressions();
59
60 virtual void SaveToXml(TiXmlElement * eventElem) const;
61 virtual void LoadFromXml(gd::Project & project, const TiXmlElement * eventElem);
62
66 virtual void Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform);
67
71 virtual unsigned int GetRenderedHeight(unsigned int width, const gd::Platform & platform) const;
72
76 virtual EditEventReturnType EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_);
77
78 private:
79 void Init(const ForEachEvent & event);
80
81 gd::Expression objectsToPick;
82 std::vector < gd::Instruction > conditions;
83 std::vector < gd::Instruction > actions;
84 std::vector < gd::BaseEventSPtr > events;
85
86 bool objectsToPickSelected;
87 };
88
89 }
90
91 #endif // FOREACHEVENT_H