Game Develop Core: EventsRenderingHelper.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
EventsRenderingHelper.h
Go to the documentation of this file.
1
5 #if !defined(GD_NO_WX_GUI)
6 #ifndef EventsRenderingHelper_H
7 #define EventsRenderingHelper_H
8 #include <wx/dc.h>
9 #include <wx/html/htmprint.h>
10 #include <vector>
11
12 namespace gd { class BaseEvent; }
13 namespace gd { class Instruction; }
14 namespace gd { class Platform; }
15 namespace gd { class EventsEditorItemsAreas; }
16 namespace gd { class EventsEditorSelection; }
17 namespace gd { class InstructionMetadata;}
18 namespace gd {class InstructionsMetadataHolder;}
19
20 namespace gd
21 {
22
32 class GD_CORE_API EventsRenderingHelper
33 {
34 public:
35 static EventsRenderingHelper * GetInstance();
36 static void DestroySingleton();
37
41 void DrawNiceRectangle(wxDC & dc, const wxRect & rect) const;
42
56 int DrawConditionsList(std::vector < gd::Instruction > & conditions, wxDC & dc, int x, int y, int width, gd::BaseEvent * event,
57 gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform);
58
63 int DrawActionsList(std::vector < gd::Instruction > & actions, wxDC & dc, int x, int y, int width, gd::BaseEvent * event,
64 gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform);
65
73 unsigned int GetRenderedConditionsListHeight(const std::vector < gd::Instruction > & conditions, int width, const gd::Platform & platform);
78 unsigned int GetRenderedActionsListHeight(const std::vector < gd::Instruction > & actions, int width, const gd::Platform & platform);
79
80 inline unsigned int GetConditionsColumnWidth() const {return conditionsColumnWidth;};
81 inline void SetConditionsColumnWidth(unsigned int conditionsColumnWidth_) { conditionsColumnWidth = conditionsColumnWidth_; };
82
87 wxPoint DrawTextInArea(std::string text, wxDC & dc, wxRect rect, wxPoint point);
88
92 unsigned int GetTextHeightInArea(const std::string & text, unsigned int widthAvailable);
93
107 int DrawInstruction(gd::Instruction & instruction,
108 const gd::InstructionMetadata & instructionMetadata,
109 bool isCondition, wxDC & dc, wxPoint point, int freeWidth,
110 gd::BaseEvent * event, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection);
111
115 void SetFont(const wxFont & font);
116
117 inline const wxFont & GetFont() const {return font;};
118 inline wxFont & GetFont() {return font;};
119
120 inline const wxFont & GetNiceFont() const {return niceFont;};
121 inline wxFont & GetNiceFont() {return niceFont;};
122
123 inline const wxHtmlDCRenderer & GetHTMLRenderer() const {return htmlRenderer;};
124 inline wxHtmlDCRenderer & GetHTMLRenderer() {return htmlRenderer;};
125
126 const wxBrush & GetSelectedRectangleFillBrush() const { return selectionRectangleFill; }
127 wxBrush & GetSelectedRectangleFillBrush() { return selectionRectangleFill; }
128
129 const wxPen & GetSelectedRectangleOutlinePen() const { return selectionRectangleOutline; }
130 wxPen & GetSelectedRectangleOutlinePen() { return selectionRectangleOutline; }
131
132 const wxBrush & GetHighlightedRectangleFillBrush() const { return highlightRectangleFill; }
133 wxBrush & GetHighlightedRectangleFillBrush() { return highlightRectangleFill; }
134
135 const wxPen & GetHighlightedRectangleOutlinePen() const { return highlightRectangleOutline; }
136 wxPen & GetHighlightedRectangleOutlinePen() { return highlightRectangleOutline; }
137
138 const wxPen & GetConditionsRectangleOutlinePen() const { return conditionsRectangleOutline; }
139 wxPen & GetConditionsRectangleOutlinePen() { return conditionsRectangleOutline; }
140
141 const wxPen & GetActionsRectangleOutlinePen() const { return actionsRectangleOutline; }
142 wxPen & GetActionsRectangleOutlinePen() { return actionsRectangleOutline; }
143
144 const wxBrush & GetConditionsRectangleFillBrush() const { return conditionsRectangleFill; }
145 wxBrush & GetConditionsRectangleFillBrush() { return conditionsRectangleFill; }
146
147 const wxBrush & GetActionsRectangleFillBrush() const { return actionsRectangleFill; }
148 wxBrush & GetActionsRectangleFillBrush() { return actionsRectangleFill; }
149
154 std::string GetHTMLText(std::string text);
155
156 wxColor eventGradient1;
157 wxColor eventGradient2;
158 wxColor eventGradient3;
159 wxColor eventGradient4;
160 wxColor eventBorderColor;
161 wxColor eventConditionsGradient1;
162 wxColor eventConditionsGradient2;
163 wxColor eventConditionsGradient3;
164 wxColor eventConditionsGradient4;
165 wxColor eventConditionsBorderColor;
166 wxColor selectionColor;
167 wxColor disabledColor;
168 wxColor disabledColor2;
169
170 int instructionsListBorder;
171 int separationBetweenInstructions;
172
173 private:
174 EventsRenderingHelper();
175 virtual ~EventsRenderingHelper() {};
176
177 unsigned int conditionsColumnWidth;
178
179 wxPen selectionRectangleOutline;
180 wxBrush selectionRectangleFill;
181 wxPen highlightRectangleOutline;
182 wxBrush highlightRectangleFill;
183
184 wxPen niceRectangleOutline;
185 wxColour niceRectangleFill1;
186 wxColour niceRectangleFill2;
187
188 wxPen actionsRectangleOutline;
189 wxPen conditionsRectangleOutline;
190 wxBrush actionsRectangleFill;
191 wxBrush conditionsRectangleFill;
192
193 wxFont font;
194 float fontCharacterWidth;
195
196 wxFont niceFont;
197
198 wxHtmlDCRenderer htmlRenderer;
199
200 static EventsRenderingHelper *singleton;
201 wxBitmap fakeBmp;
202 };
203
204 }
205
206 #endif // EventsRenderingHelper_H
207 #endif