Game Develop C++ Platform: CppCodeEvent.h Source File

| Game Develop C++ Platform Platform for developing native games based on OpenGL and SFML with Game Develop

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
CppCodeEvent.h
Go to the documentation of this file.
1
6 #if defined(GD_IDE_ONLY)
7
8 #ifndef CPPCODEEVENT_H
9 #define CPPCODEEVENT_H
10 #include "GDCore/Events/Event.h"
11 class RuntimeScene;
12 namespace gd { class Instruction; }
13 namespace gd { class MainFrameWrapper; }
14 namespace gd { class Project; }
15 class TiXmlElement;
16 class EventsEditorItemsAreas;
17 class EventsEditorSelection;
18 namespace gd { class Layout; }
19 class wxWindow;
20
24 class CppCodeEvent : public gd::BaseEvent
25 {
26 public:
27 CppCodeEvent();
28 CppCodeEvent(const CppCodeEvent & event);
29 virtual ~CppCodeEvent() {};
30
31 CppCodeEvent& operator=(const CppCodeEvent & event);
32 virtual gd::BaseEventSPtr Clone() const { return boost::shared_ptr<gd::BaseEvent>(new CppCodeEvent(*this));}
33
34 virtual bool IsExecutable() const {return true;}
35 virtual bool CanHaveSubEvents() const {return false;}
36
37 void EnsureAssociatedSourceFileIsUpToDate(gd::Project & parentGame) const;
38
39 const std::vector<std::string> & GetIncludeFiles() const { return includeFiles; };
40 void SetIncludeFiles(const std::vector<std::string> & include_) { includeFiles = include_; };
41
42 const std::string & GetInlineCode() const { return inlineCode; };
43 void SetInlineCode(const std::string & code) { inlineCode = code; };
44
45 const std::string & GetFunctionToCall() const { return functionToCall; };
46 void SetFunctionToCall(const std::string & functionToCall_) { functionToCall = functionToCall_; };
47
48 bool IsFunctionNameAutoGenerated() const { return functionNameAutogenerated; };
49 void SetFunctionNameAutoGenerated(bool autogenerate) { functionNameAutogenerated = autogenerate; };
50
51 const std::string & GetAssociatedGDManagedSourceFile(gd::Project & parentGame) const { EnsureAssociatedSourceFileIsUpToDate(parentGame); return associatedGDManagedSourceFile; };
52
53 void SetLastChangeTimeStamp(time_t lastChangeTimeStamp_) { lastChangeTimeStamp = lastChangeTimeStamp_; }
54
55 const std::vector<std::string> & GetDependencies() const { return dependencies; };
56 void SetDependencies(const std::vector<std::string> & dependencies_) { dependencies = dependencies_; };
57
58 bool GetPassSceneAsParameter() const { return passSceneAsParameter; };
59 void SetPassSceneAsParameter(bool passScene) { passSceneAsParameter = passScene; };
60
61 bool GetPassObjectListAsParameter() const { return passObjectListAsParameter; };
62 void SetPassObjectListAsParameter(bool passObjectList) { passObjectListAsParameter = passObjectList; };
63
64 std::string GetObjectToPassAsParameter() const { return objectToPassAsParameter; };
65 void SetObjectToPassAsParameter(std::string objectName) { objectToPassAsParameter = objectName; };
66
67 bool IsCodeDisplayedInEditor() const { return codeDisplayedInEditor; };
68 void EnableCodeDisplayedInEditor(bool enable) { codeDisplayedInEditor = enable; eventHeightNeedUpdate = true; };
69
70 const std::string & GetDisplayedName() const { return displayedName; };
71 void SetDisplayedName(const std::string & displayedName_) { displayedName = displayedName_; };
72
73 virtual void SaveToXml(TiXmlElement * eventElem) const;
74 virtual void LoadFromXml(gd::Project & project, const TiXmlElement * eventElem);
75
79 virtual void Render(wxDC & dc, int x, int y, unsigned int width, EventsEditorItemsAreas & areas, EventsEditorSelection & selection, const gd::Platform & platform);
80
84 virtual unsigned int GetRenderedHeight(unsigned int width, const gd::Platform & platform) const;
85
89 virtual EditEventReturnType EditEvent(wxWindow* parent_, gd::Project & game_, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_);
90
91 private:
92 void Init(const CppCodeEvent & event);
93 std::string GenerateAssociatedFileCode() const;
94 void AutogenerateFunctionName();
95
96 std::vector<std::string> includeFiles;
97 std::vector<std::string> dependencies;
98 std::string functionToCall;
99 bool functionNameAutogenerated;
100 std::string inlineCode;
101 mutable std::string associatedGDManagedSourceFile;
102 time_t lastChangeTimeStamp;
103
104 bool passSceneAsParameter;
105 bool passObjectListAsParameter;
106 std::string objectToPassAsParameter;
107
108 bool codeDisplayedInEditor;
109 std::string displayedName;
110
111 bool objectsToPickSelected;
112 };
113
114
115 #endif // CPPCODEEVENT_H
116
117 #endif
118