Spinning Topp Logo BlackTopp Studios
inc
quadrenderable.h
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _uiquadrenderable_h
41 #define _uiquadrenderable_h
42 
43 #include "datatypes.h"
44 #include "UI/uienumerations.h"
45 #include "UI/unifieddim.h"
46 #include "UI/positioninginfo.h"
47 #include "UI/sizinginfo.h"
48 #include "UI/renderable.h"
49 #include "UI/rect.h"
50 
51 namespace Mezzanine
52 {
53  namespace UI
54  {
55  class ScreenRenderData;
56  class RenderLayer;
57  class SingleImageLayer;
58  class MultiImageLayer;
59  class SingleLineTextLayer;
60  class MultiLineTextLayer;
61  class LayoutStrategy;
62  class QuadRenderable;
63  class Widget;
64  class RenderLayerGroup;
65  ///////////////////////////////////////////////////////////////////////////////
66  /// @brief This is a small convenience class used to store a RenderLayerGroup ID and a ZOrder on that RenderLayerGroup.
67  /// @details This class is mostly used for placing RenderLayers into RenderLayerGroups, either during or after RenderLayer construction.
68  ///////////////////////////////////////
70  {
71  /// @brief The ID of the RenderLayerGroup this entry is referring to.
73  /// @brief The ZOrder within the specified RenderLayerGroup to modify.
75 
76  /// @brief Class constructor.
77  GroupOrderEntry(const UInt16 ID, const UInt16 ZOrder) :
78  GroupID(ID),
79  LayerZOrder(ZOrder)
80  { }
81  /// @brief Class destructor.
83  { }
84  };//GroupOrderEntry
85  /// @brief Convenience container type for @ref GroupOrderEntry storage.
86  typedef std::vector<GroupOrderEntry> GroupOrderEntryVector;
87 
88  ///////////////////////////////////////////////////////////////////////////////
89  /// @brief This represents a nestable quad for an object in a GUI layout.
90  /// @details QuadRenderables use "Unified" units for setting their position and size. Unified units
91  /// contain both relative and absolute information for their position on screen or inside their
92  /// parent. It is important to note that the Relative portion of the Unified unit is always
93  /// calculated first. @n @n
94  /// The relative portions of the Unified units used to set the dimensions aren't relative to the
95  /// screen size, but instead their parents size. For the most part QuadRenderables are oblivious to
96  /// the size of the screen they are in. @n @n
97  /// It is important to note that the RenderLayer's stored directly by this class are all the
98  /// layers that were created by this class, in creation order. They aren't not what will be rendered,
99  /// nor are they in the order they will be rendered in. To get either of these bits of information you
100  /// must check the active RenderLayerGroup and check the RenderLayers there. @n @n
101  /// Also only one RenderLayerGroup may render at a time, but a single RenderLayer can be shared between
102  /// as many groups under the same QuadRenderable as you want.
103  ///////////////////////////////////////
105  {
106  public:
107  /// @brief Basic container type for @ref Widget storage by this class.
108  typedef std::vector<Widget*> ChildContainer;
109  /// @brief Iterator type for @ref Widget instances stored by this class.
110  typedef ChildContainer::iterator ChildIterator;
111  /// @brief Const Iterator type for @ref Widget instances stored by this class.
112  typedef ChildContainer::const_iterator ConstChildIterator;
113  /// @brief Reverse Iterator type for @ref Widget instances stored by this class.
114  typedef ChildContainer::reverse_iterator ReverseChildIterator;
115  /// @brief Const Reverse Iterator type for @ref Widget instances stored by this class.
116  typedef ChildContainer::const_reverse_iterator ConstReverseChildIterator;
117  /// @brief Basic container type for @ref RenderLayer storage by this class.
118  typedef std::vector<RenderLayer*> RenderLayerContainer;
119  /// @brief Iterator type for @ref RenderLayer instances stored by this class.
120  typedef RenderLayerContainer::iterator RenderLayerIterator;
121  /// @brief Const Iterator type for @ref RenderLayer instances stored by this class.
122  typedef RenderLayerContainer::const_iterator ConstRenderLayerIterator;
123  /// @brief Basic container type for @ref RenderLayerGroup storage by this class.
124  typedef std::vector<RenderLayerGroup*> RenderLayerGroupContainer;
125  /// @brief Iterator type for @ref RenderLayerGroup instances stored by this class.
126  typedef RenderLayerGroupContainer::iterator RenderLayerGroupIterator;
127  /// @brief Const Iterator type for @ref RenderLayerGroup instances stored by this class.
128  typedef RenderLayerGroupContainer::const_iterator ConstRenderLayerGroupIterator;
129  protected:
130  /// @internal
131  /// @brief This is a container storing all the @ref RenderLayerGroup instances created by and belonging to this Quad.
132  RenderLayerGroupContainer RenderLayerGroups;
133  /// @internal
134  /// @brief This is a container storing all the @ref RenderLayer instances created by and belonging to this Quad.
135  RenderLayerContainer RenderLayers;
136  /// @internal
137  /// @brief This is a container storing all the children that belong to this Quad.
138  ChildContainer ChildWidgets;
139  /// @internal
140  /// @brief This stores all the information needed to determine the specific behaviors this Quad should have when it's size is being updated.
142  /// @internal
143  /// @brief This stores all the information needed to determine the specific behaviors this Quad should have when it's position is being updated.
145  /// @internal
146  /// @brief The actual (pixel) position and size of this Quad on the screen it belongs to.
148  /// @internal
149  /// @brief This is a pointer to the Quad that owns this Quad and is responsible for transform updates applied to this Quad.
151  /// @internal
152  /// @brief This is a pointer to the group of RenderLayers currently being used for rendering.
154  /// @internal
155  /// @brief This is a pointer to the strategy being used by this Quad to determine the positions and sizes of children during transform updates.
157  /// @internal
158  /// @brief This is a pointer to the optional cache of vertex's belonging to this Quad and all of it's children.
160  /// @internal
161  /// @brief This is the ZOrder of this Quad in relation to all other Quads in it's parent.
163  /// @internal
164  /// @brief Controls whether or not this Quad will be considered for mouse hover checks.
166  /// @internal
167  /// @brief Controls whether or not this Quad and it's children will recieve automatic transform updates.
169  /// @internal
170  /// @brief Determines whether or not this Quad needs all of it's layers refreshed. Usually after a transform update.
172 
173  /// @copydoc Renderable::ProtoSerializeImpl(XML::Node&) const
174  virtual void ProtoSerializeImpl(XML::Node& SelfRoot) const;
175  /// @copydoc Renderable::ProtoDeSerializeImpl(const XML::Node&)
176  virtual void ProtoDeSerializeImpl(const XML::Node& SelfRoot);
177  /// @internal
178  /// @brief Adds all the vertices belonging to all the layers of this renderable to the provided vector.
179  /// @param Vertices The vector to store the generated vertices.
180  void AppendLayerVertices(std::vector<VertexData>& Vertices);
181  /// @internal
182  /// @brief Resizes the container for RenderLayers in this QuadRenderable.
183  /// @param NewSize The new capacity for RenderLayer storage.
184  void ResizeLayers(const Whole NewSize);
185  /// @internal
186  /// @brief Creates a new RenderLayerGroup with the provided ID, without checking if it is unique.
187  /// @param ID The ID to be given to the RenderLayerGroup.
188  /// @return Returns a pointer to the created RenderLayerGroup.
189  RenderLayerGroup* CreateRenderLayerGroupNoCheck(const UInt16 ID);
190  public:
191  /// @brief Blank constructor.
192  /// @note This is primarily useful for (and used as) a basic constructor suitable for XML deserialization post-construction.
193  /// @param Parent The parent screen that created this renderable.
194  QuadRenderable(Screen* Parent);
195  /// @brief Class constructor.
196  /// @param RendName The name to be given to this renderable.
197  /// @param Parent The parent screen that created this renderable.
198  QuadRenderable(const String& RendName, Screen* Parent);
199  /// @brief Parent-less constructor.
200  /// @param RendName The name to be given to this renderable.
201  /// @param RendRect The rect describing this quad's transform relative to it's parent.
202  /// @param Parent The parent screen that created this renderable.
203  QuadRenderable(const String& RendName, const UnifiedRect& RendRect, Screen* Parent);
204  /// @brief Class destructor.
205  /// @note Any and all children of this quad at the time of it's destruction will be destroyed as well.
206  /// If you want to preserve the children for whatever reason, remove them from the quad prior to destroying it.
207  virtual ~QuadRenderable();
208 
209  ///////////////////////////////////////////////////////////////////////////////
210  // Utility Methods
211 
212  /// @brief Gets the currently set ZOrder of this QuadRenderable with it's parent.
213  /// @details A QuadRenderable without a parent yet will have the default ZOrder of 0, which is a valid ZOrder when it gains a parent.
214  /// In these cases it is recommended to check to see if this QuadRenderable has a parent.
215  /// @return Returns a UInt16 representing this renderables ZOrder.
216  virtual const UInt16& GetZOrder() const;
217  /// @brief Gets the highest ZOrder among the children of this QuadRenderable.
218  /// @note This method assumes the children are ordered. If you alter the ZOrder of children often, ensure you call UpdateChildOrder after
219  /// the alterations so this method will work.
220  /// @return Returns a UInt16 representing the highest ZOrder of all the children in this QuadRenderable, or 0 if this quad has no children.
221  virtual UInt16 GetHighestChildZOrder() const;
222  /// @brief Gets the lowest ZOrder among the children of this QuadRenderable.
223  /// @note This method assumes the children are ordered. If you alter the ZOrder of children often, ensure you call UpdateChildOrder after
224  /// the alterations so this method will work.
225  /// @return Returns a UInt16 representing the lowest ZOrder of all the children in this QuadRenderable, or 0 if this quad has no children.
226  virtual UInt16 GetLowestChildZOrder() const;
227  /// @brief Updates the order of children in this QuadRenderable based on the ZOrder set on each child.
228  virtual void UpdateChildOrder();
229 
230  /// @brief Checks to see if another Quad is overlapping with this one.
231  /// @param Quad The other Quad to check for overlap.
232  /// @return Returns true if this quad overlaps with the provided quad, false otherwise.
233  virtual Boole CheckOverlap(const QuadRenderable* Quad) const;
234  /// @brief Checks to see if a point in 2D space is inside this quad.
235  /// @param Point The point in 2D space to check.
236  /// @return Returns true if the provided point is within this quad, false otherwise.
237  virtual Boole IsInside(const Vector2& Point) const;
238  /// @brief Gets whether or not this QuadRenderable is a direct child of it's screen.
239  /// @return Returns true if the screen is this QuadRenderable's parent, false otherwise.
240  virtual Boole IsChildOfScreen() const;
241 
242  /// @brief Populates all text lines in all text layers owned by this quad.
243  /// @note Populating text lines can be a slow process, use with care.
244  /// @param MaxWidth The maximum line width to assume for all text lines that are to be populated.
245  virtual void PopulateTextLinesInLayers(const Real MaxWidth);
246  /// @brief Gets the height needed for this quadrenderable to be able to completely display text in it's child text layers.
247  /// @return Returns a Real representing the pixel height this quad needs to be to display it's largest batch of text among it's text layers.
248  virtual Real GetIdealHeightForText() const;
249 
250  /// @brief Updates the dimensions of this QuadRenderable based on the transform of it's parent.
251  /// @details This is a convenience function that will call the more descriptive version of "UpdateDimensions" on this objects parent using its
252  /// existing dimensions as both parameters, causing all of its children to be updated (including this). This method can be expensive based on
253  /// the number of siblings this quad has.
254  virtual void UpdateDimensions();
255  /// @brief Updates the dimensions of the children in this QuadRenderable.
256  /// @details This is a convenience function that will call the more descriptive version of "UpdateDimensions" on this object using its existing
257  /// dimensions as both parameters, causing all of this quads children to be updated. This method can be expensive based on
258  /// the number of children this quad has.
259  virtual void UpdateChildDimensions();
260  /// @brief Updates the dimensions of this QuadRenderable based on the transform of it's parent.
261  /// @details This function is called automatically by this objects parent when it changes in size or position, and should only need to be called
262  /// manually if the positioning or sizing rules were updated manually.
263  /// @param OldSelfRect The previous dimensions of this quad prior to it's dimensions being updated.
264  /// @param NewSelfRect The updated and current dimensions of this quad.
265  virtual void UpdateDimensions(const Rect& OldSelfRect, const Rect& NewSelfRect);
266 
267  /// @brief Sets whether or not this quad should be skipped when determining if the mouse is hovered over this quad.
268  /// @note This does not affect the ability for the children of this quad to be detected and/or checked.
269  /// @param Enable True if you want to have this quad be skipped for mouse hover checks, false if you want this quad checked.
270  virtual void SetMousePassthrough(Boole Enable);
271  /// @brief Gets whether or not Mouse Passthrough is enabled.
272  /// @return Returns true if Mouse Passthrough is enabled, false otherwise.
273  virtual Boole GetMousePassthrough() const;
274  /// @brief Sets whether or not this quad has specific behaviors for it's transform updates and they should not be done automatically.
275  /// @note Setting this to true will prevent child quads from being updated. This setting does not mean that a quad will never be
276  /// updated, just that it has special logic for doing so located elsewhere from the normal logic. Example: Transform updates to be
277  /// applied to the scroller of a scrollbar.
278  /// @param Enable True to make this quad skip automatic updating and intent to provide that logic explicitly elsewhere, false for automatic transform updates.
279  virtual void SetManualTransformUpdates(Boole Enable);
280  /// @brief Gets whether or not this quad will be automatically updated when parent transforms are updated.
281  /// @return Returns true if this quad needs manual updating, false if it recieves automatic updates.
282  virtual Boole GetManualTransformUpdates() const;
283 
284  ///////////////////////////////////////////////////////////////////////////////
285  // Transform Policy Methods
286 
287  /// @brief Sets the behavior to be used when this QuadRenderable is positioned.
288  /// @note This method is not retroactive. Setting this to a different value will not cause it to reposition.
289  /// @param Policy The @ref PositioningInfo to be applied to this QuadRenderable.
290  virtual void SetPositioningPolicy(const PositioningInfo& Policy);
291  /// @brief Gets the current behavior this QuadRenderable will use when it is positioned.
292  /// @return Returns a const @ref PositioningInfo reference describing how this QuadRenderable is positioned.
293  virtual const PositioningInfo& GetPositioningPolicy() const;
294  /// @brief Sets the behavior to be used when this QuadRenderable is sized.
295  /// @note This method is not retroactive. Setting this to a different value will not cause it to resize.
296  /// @param Policy The @ref SizingInfo to be applied to this QuadRenderable.
297  virtual void SetSizingPolicy(const SizingInfo& Policy);
298  /// @brief Gets the current behavior this QuadRenderable will use when it is sized.
299  /// @return Returns a const @ref SizingInfo reference describing how this QuadRenderable is sized.
300  virtual const SizingInfo& GetSizingPolicy() const;
301 
302  /// @brief Sets the behavior this quad will have when it is positioned automatically on the X axis.
303  /// @note This method is not retroactive. Setting this to a different value will not cause it to reposition.
304  /// @param Rules The action to take when this is positioned on the X axis. See @ref PositioningFlags enum for more info.
305  virtual void SetHorizontalPositioningRules(const Whole Rules);
306  /// @brief Gets the current behavior this quad will follow when it is positioned automatically on the X axis.
307  /// @return Returns a bitfield of @ref PositioningFlags reprensenting the action this quad will take when it is positioned on the X axis.
308  virtual Whole GetHorizontalPositioningRules() const;
309  /// @brief Sets the behavior this quad will have when it is positioned automatically on the Y axis.
310  /// @note This method is not retroactive. Setting this to a different value will not cause it to reposition.
311  /// @param Rules The action to take when this is positioned on the Y axis. See @ref PositioningFlags enum for more info.
312  virtual void SetVerticalPositioningRules(const Whole Rules);
313  /// @brief Gets the current behavior this quad will follow when it is positioned automatically on the Y axis.
314  /// @return Returns a bitfield of @ref PositioningFlags reprensenting the action this quad will take when it is positioned on the Y axis.
315  virtual Whole GetVerticalPositioningRules() const;
316  /// @brief Sets the behavior this quad will have on the X axis when it is resized.
317  /// @note This method is not retroactive. Setting this to a different value will not cause it to resize.
318  /// @param Rules The action to take when this is resized. See @ref SizingRules enum for more info.
319  virtual void SetHorizontalSizingRules(const Whole Rules);
320  /// @brief Gets the current behavior this quad will follow for the X axis when it is resized.
321  /// @return Returns a whole reprensenting the action this quad will take when it is resized. See @ref SizingRules enum for more info.
322  virtual Whole GetHorizontalSizingRules() const;
323  /// @brief Sets the behavior this quad will have on the Y axis when it is resized.
324  /// @note This method is not retroactive. Setting this to a different value will not cause it to resize.
325  /// @param Rules The action to take when this is resized. See @ref SizingRules enum for more info.
326  virtual void SetVerticalSizingRules(const Whole Rules);
327  /// @brief Gets the current behavior this quad will follow for the Y axis when it is resized.
328  /// @return Returns a whole reprensenting the action this quad will take when it is resized. See @ref SizingRules enum for more info.
329  virtual Whole GetVerticalSizingRules() const;
330  /// @brief Sets how (and if) the aspect ratio of this quad is locked.
331  /// @param Lock An AspectRatioLock enum value expressing the action this quad will take when it's aspect ratio would change.
332  virtual void SetAspectRatioLock(const UI::AspectRatioLock Lock);
333  /// @brief Gets how (and if) the aspect ratio of this quad is locked.
334  /// @return Returns an AspectRatioLock enum value representing how this quad reacts when it's aspect ratio would change.
335  virtual UI::AspectRatioLock GetAspectRationLock() const;
336 
337  /// @brief Sets the minimum size this quad is allowed to have.
338  /// @note This function expects the provided UnifiedVec2 to be in pixels.
339  /// @param Min The size this quad is not allowed to go under.
340  virtual void SetMinSize(const UnifiedVec2& Min);
341  /// @brief Gets the currently set minimum size for this quad.
342  /// @return Returns a vector2 containing the minimum size for this quad in pixels.
343  virtual UnifiedVec2 GetMinSize() const;
344  /// @brief Sets the maximum size this quad is allowed to have.
345  /// @note This function expects the provided UnifiedVec2 to be in pixels.
346  /// @param Max The size this quad is not allowed to exceed.
347  virtual void SetMaxSize(const UnifiedVec2& Max);
348  /// @brief Gets the currently set maximum size for this quad.
349  /// @return Returns a vector2 containing the maximum size for this quad in pixels.
350  virtual UnifiedVec2 GetMaxSize() const;
351 
352  ///////////////////////////////////////////////////////////////////////////////
353  // RenderLayer Management
354 
355  /// @brief Creates a SingleImageLayer for this renderable.
356  /// @note This will not add the created layer to any group, thus it must be added manually to be rendered.
357  /// @return Returns a pointer to the created SingleImageLayer.
358  SingleImageLayer* CreateSingleImageLayer();
359  /// @brief Creates a SingleImageLayer for this renderable.
360  /// @note This will attempt to add the created layer to both the "Normal" and "Hovered" RenderLayerGroups, which are auto-generated, but not guaranteed to exist.
361  /// @param NormalZ The Zorder which will be used when inserting the created layer into the "Normal" RenderLayerGroup, if it exists.
362  /// @param HoveredZ The Zorder which will be used when inserting the created layer into the "Hovered" RenderLayerGroup, if it exists.
363  /// @return Returns a pointer to the created SingleImageLayer.
364  SingleImageLayer* CreateSingleImageLayer(const UInt16 NormalZ, const UInt16 HoveredZ);
365  /// @brief Creates a SingleImageLayer for this renderable and adds it to a RenderLayerGroup.
366  /// @note If the requested group does not exist it will be created.
367  /// @param GroupAndZ A GroupOrderEntry containing the ID of the RenderLayerGroup to add the created layer to and the ZOrder to insert it at.
368  /// @return Returns a pointer to the created SingleImageLayer.
369  SingleImageLayer* CreateSingleImageLayer(const GroupOrderEntry& GroupAndZ);
370  /// @brief Creates a SingleImageLayer for this renderable.
371  /// @note This will not add the created layer to any group, thus it must be added manually to be rendered.
372  /// @param SpriteName The name of the sprite to be set to the created layer.
373  /// @return Returns a pointer to the created SingleImageLayer.
374  SingleImageLayer* CreateSingleImageLayer(const String& SpriteName);
375  /// @brief Creates a SingleImageLayer for this renderable.
376  /// @note This will attempt to add the created layer to both the "Normal" and "Hovered" RenderLayerGroups, which are auto-generated, but not guaranteed to exist.
377  /// @param NormalZ The Zorder which will be used when inserting the created layer into the "Normal" RenderLayerGroup, if it exists.
378  /// @param HoveredZ The Zorder which will be used when inserting the created layer into the "Hovered" RenderLayerGroup, if it exists.
379  /// @param SpriteName The name of the sprite to be set to the created layer.
380  /// @return Returns a pointer to the created SingleImageLayer.
381  SingleImageLayer* CreateSingleImageLayer(const String& SpriteName, const UInt16 NormalZ, const UInt16 HoveredZ);
382  /// @brief Creates a SingleImageLayer for this renderable and adds it to a RenderLayerGroup.
383  /// @note If the requested group does not exist it will be created.
384  /// @param SpriteName The name of the sprite to be set to the created layer.
385  /// @param GroupAndZ A GroupOrderEntry containing the ID of the RenderLayerGroup to add the created layer to and the ZOrder to insert it at.
386  /// @return Returns a pointer to the created SingleImageLayer.
387  SingleImageLayer* CreateSingleImageLayer(const String& SpriteName, const GroupOrderEntry& GroupAndZ);
388 
389  /// @brief Creates an MultiImageLayer for this renderable.
390  /// @note This will not add the created layer to any group, thus it must be added manually to be rendered.
391  /// @return Returns a pointer to the created MultiImageLayer.
392  MultiImageLayer* CreateMultiImageLayer();
393  /// @brief Creates an MultiImageLayer for this renderable.
394  /// @note This will attempt to add the created layer to both the "Normal" and "Hovered" RenderLayerGroups, which are auto-generated, but not guaranteed to exist.
395  /// @param NormalZ The Zorder which will be used when inserting the created layer into the "Normal" RenderLayerGroup, if it exists.
396  /// @param HoveredZ The Zorder which will be used when inserting the created layer into the "Hovered" RenderLayerGroup, if it exists.
397  /// @return Returns a pointer to the created MultiImageLayer.
398  MultiImageLayer* CreateMultiImageLayer(const UInt16 NormalZ, const UInt16 HoveredZ);
399  /// @brief Creates an MultiImageLayer for this renderable and adds it to a RenderLayerGroup.
400  /// @note If the requested group does not exist it will be created.
401  /// @param GroupAndZ A GroupOrderEntry containing the ID of the RenderLayerGroup to add the created layer to and the ZOrder to insert it at.
402  /// @return Returns a pointer to the created MultiImageLayer.
403  MultiImageLayer* CreateMultiImageLayer(const GroupOrderEntry& GroupAndZ);
404 
405  /// @brief Creats a SingleLineTextLayer for this renderable.
406  /// @note This will not add the created layer to any group, thus it must be added manually to be rendered.
407  /// @return Returns a pointer to the created layer.
408  SingleLineTextLayer* CreateSingleLineTextLayer();
409  /// @brief Creats a SingleLineTextLayer for this renderable.
410  /// @note This will attempt to add the created layer to both the "Normal" and "Hovered" RenderLayerGroups, which are auto-generated, but not guaranteed to exist.
411  /// @param NormalZ The Zorder which will be used when inserting the created layer into the "Normal" RenderLayerGroup, if it exists.
412  /// @param HoveredZ The Zorder which will be used when inserting the created layer into the "Hovered" RenderLayerGroup, if it exists.
413  /// @return Returns a pointer to the created layer.
414  SingleLineTextLayer* CreateSingleLineTextLayer(const UInt16 NormalZ, const UInt16 HoveredZ);
415  /// @brief Creats a SingleLineTextLayer for this renderable.
416  /// @note If the requested group does not exist it will be created.
417  /// @param GroupAndZ A GroupOrderEntry containing the ID of the RenderLayerGroup to add the created layer to and the ZOrder to insert it at.
418  /// @return Returns a pointer to the created layer.
419  SingleLineTextLayer* CreateSingleLineTextLayer(const GroupOrderEntry& GroupAndZ);
420  /// @brief Creats a SingleLineTextLayer for this renderable.
421  /// @note This will not add the created layer to any group, thus it must be added manually to be rendered.
422  /// @param FontName The name of the font to use when rendering characters on the created layer.
423  /// @return Returns a pointer to the created layer.
424  SingleLineTextLayer* CreateSingleLineTextLayer(const String& FontName);
425  /// @brief Creats a SingleLineTextLayer for this renderable.
426  /// @note This will attempt to add the created layer to both the "Normal" and "Hovered" RenderLayerGroups, which are auto-generated, but not guaranteed to exist.
427  /// @param NormalZ The Zorder which will be used when inserting the created layer into the "Normal" RenderLayerGroup, if it exists.
428  /// @param HoveredZ The Zorder which will be used when inserting the created layer into the "Hovered" RenderLayerGroup, if it exists.
429  /// @param FontName The name of the font to use when rendering characters on the created layer.
430  /// @return Returns a pointer to the created layer.
431  SingleLineTextLayer* CreateSingleLineTextLayer(const String& FontName, const UInt16 NormalZ, const UInt16 HoveredZ);
432  /// @brief Creats a SingleLineTextLayer for this renderable.
433  /// @note If the requested group does not exist it will be created.
434  /// @param FontName The name of the font to use when rendering characters on the created layer.
435  /// @param GroupAndZ A GroupOrderEntry containing the ID of the RenderLayerGroup to add the created layer to and the ZOrder to insert it at.
436  /// @return Returns a pointer to the created layer.
437  SingleLineTextLayer* CreateSingleLineTextLayer(const String& FontName, const GroupOrderEntry& GroupAndZ);
438 
439  /// @brief Creats a MultiLineTextLayer for this renderable.
440  /// @note This will not add the created layer to any group, thus it must be added manually to be rendered.
441  /// @return Returns a pointer to the created layer.
442  MultiLineTextLayer* CreateMultiLineTextLayer();
443  /// @brief Creats a MultiLineTextLayer for this renderable.
444  /// @note This will attempt to add the created layer to both the "Normal" and "Hovered" RenderLayerGroups, which are auto-generated, but not guaranteed to exist.
445  /// @param NormalZ The Zorder which will be used when inserting the created layer into the "Normal" RenderLayerGroup, if it exists.
446  /// @param HoveredZ The Zorder which will be used when inserting the created layer into the "Hovered" RenderLayerGroup, if it exists.
447  /// @return Returns a pointer to the created layer.
448  MultiLineTextLayer* CreateMultiLineTextLayer(const UInt16 NormalZ, const UInt16 HoveredZ);
449  /// @brief Creats a MultiLineTextLayer for this renderable.
450  /// @note If the requested group does not exist it will be created.
451  /// @param GroupAndZ A GroupOrderEntry containing the ID of the RenderLayerGroup to add the created layer to and the ZOrder to insert it at.
452  /// @return Returns a pointer to the created layer.
453  MultiLineTextLayer* CreateMultiLineTextLayer(const GroupOrderEntry& GroupAndZ);
454  /// @brief Creats a MultiLineTextLayer for this renderable.
455  /// @note This will not add the created layer to any group, thus it must be added manually to be rendered.
456  /// @param FontName The name of the font to use when rendering characters on the created layer.
457  /// @return Returns a pointer to the created layer.
458  MultiLineTextLayer* CreateMultiLineTextLayer(const String& FontName);
459  /// @brief Creats a MultiLineTextLayer for this renderable.
460  /// @note This will attempt to add the created layer to both the "Normal" and "Hovered" RenderLayerGroups, which are auto-generated, but not guaranteed to exist.
461  /// @param NormalZ The Zorder which will be used when inserting the created layer into the "Normal" RenderLayerGroup, if it exists.
462  /// @param HoveredZ The Zorder which will be used when inserting the created layer into the "Hovered" RenderLayerGroup, if it exists.
463  /// @param FontName The name of the font to use when rendering characters on the created layer.
464  /// @return Returns a pointer to the created layer.
465  MultiLineTextLayer* CreateMultiLineTextLayer(const String& FontName, const UInt16 NormalZ, const UInt16 HoveredZ);
466  /// @brief Creats a MultiLineTextLayer for this renderable.
467  /// @note If the requested group does not exist it will be created.
468  /// @param FontName The name of the font to use when rendering characters on the created layer.
469  /// @param GroupAndZ A GroupOrderEntry containing the ID of the RenderLayerGroup to add the created layer to and the ZOrder to insert it at.
470  /// @return Returns a pointer to the created layer.
471  MultiLineTextLayer* CreateMultiLineTextLayer(const String& FontName, const GroupOrderEntry& GroupAndZ);
472 
473  /// @brief Gets a RenderLayer belonging to this QuadRenderable by index.
474  /// @param Index The index of the RenderLayer to retrieve.
475  /// @return Returns a pointer to the RenderLayer at the specified index.
476  RenderLayer* GetRenderLayer(const UInt32& Index) const;
477  /// @brief Gets a RenderLayer belonging to this QuadRenderable by it's type.
478  /// @param Which The Nth RenderLayer of the specified type to retrieve.
479  /// @param Type The type of RenderLayer to be considered for retrieval.
480  /// @return Returns a pointer to the Nth RenderLayer of the specified type, or NULL if one does not exist.
481  RenderLayer* GetRenderLayer(const Whole Which, const UI::RenderLayerType Type);
482  /// @brief Gets the number of RenderLayers created for this renderable.
483  /// @return Returns a UInt32 containing the number of RenderLayers in this renderable.
484  UInt32 GetNumRenderLayers() const;
485  /// @brief Gets the number of RenderLayers that are visible in this renderable.
486  /// @return Returns a UInt32 containing the number of RenderLayers that would be rendered if this renderable is visible.
487  UInt32 GetNumVisibleRenderLayers() const;
488  /// @brief Destroys a RenderLayer being stored by this renderable.
489  /// @param ToBeDestroyed The RenderLayer to be destroyed.
490  void DestroyRenderLayer(RenderLayer* ToBeDestroyed);
491  /// @brief Destroys all RenderLayers being stored by this renderable.
492  void DestroyAllRenderLayers();
493 
494  /// @brief Gets an iterator to the first RenderLayer.
495  /// @return Returns an iterator to the first RenderLayer being stored by this renderable.
496  RenderLayerIterator RenderLayerBegin();
497  /// @brief Gets an iterator to one passed the last RenderLayer.
498  /// @return Returns an iterator to one passed the last RenderLayer being stored by this renderable.
499  RenderLayerIterator RenderLayerEnd();
500  /// @brief Gets a const iterator to the first RenderLayer.
501  /// @return Returns a const iterator to the first RenderLayer being stored by this renderable.
502  ConstRenderLayerIterator RenderLayerBegin() const;
503  /// @brief Gets an iterator to one passed the last RenderLayer.
504  /// @return Returns an iterator to one passed the last RenderLayer being stored by this renderable.
505  ConstRenderLayerIterator RenderLayerEnd() const;
506 
507  ///////////////////////////////////////////////////////////////////////////////
508  // RenderLayerGroup Management
509 
510  /// @brief Sets the RenderLayerGroup that will be used to render this renderable.
511  /// @param GroupID The ID of the RenderLayerGroup that will be used.
512  void SetActiveGroup(const UInt16 GroupID);
513  /// @brief Sets the RenderLayerGroup that will be used to render this renderable.
514  /// @param Group Pointer to the RenderLayerGroup that will be used.
515  void SetActiveGroup(RenderLayerGroup* Group);
516  /// @brief Gets the current RenderLayerGroup used for rendering.
517  /// @return Returns a pointer to the group currently being used to render this renderable.
518  RenderLayerGroup* GetActiveGroup() const;
519  /// @brief Checks to see if a RenderLayerGroup exists.
520  /// @param GroupID The ID of the RenderLayerGroup to check for.
521  /// @return Returns true if the named RenderLayerGroup exists in this renderable.
522  Boole RenderLayerGroupExists(const UInt16 GroupID) const;
523  /// @brief Gets the number of RenderLayerGroup's created for this renderable.
524  /// @return Returns a UInt32 containing the number of RenderLayerGroups in this renderable.
525  UInt32 GetNumRenderLayerGroups() const;
526  /// @brief Adds a RenderLayer to the specified group.
527  /// @note If the requested group does not exist it will be created.
528  /// @param Layer The RenderLayer to be added to the named group.
529  /// @param LayerZOrder The ZOrder that will be given to this layer to determine the order it is rendered with other layers.
530  /// @param GroupID The ID of the group the created ImageLayer should be added to.
531  void AddLayerToGroup(RenderLayer* Layer, const UInt16 LayerZOrder, const UInt16 GroupID);
532  /// @brief Adds a RenderLayer to the specified group.
533  /// @note If the requested group does not exist it will be created.
534  /// @param Layer The RenderLayer to be added to the named group.
535  /// @param GroupAndZ A GroupOrderEntry containing the ID of the RenderLayerGroup to add the specified layer to and the ZOrder to insert it at.
536  void AddLayerToGroup(RenderLayer* Layer, const GroupOrderEntry& GroupAndZ);
537  /// @brief Adds a RenderLayer to the specified group.
538  /// @note Unlike it's counterpart that doesn't specify "Existing", this will only add to groups that already exist and will not create any RenderLayerGroups.
539  /// @param Layer The RenderLayer to be added to the named group.
540  /// @param LayerZOrder The ZOrder that will be given to this layer to determine the order it is rendered with other layers.
541  /// @param GroupID The ID of the group the created ImageLayer should be added to.
542  void AddLayerToExistingGroup(RenderLayer* Layer, const UInt16 LayerZOrder, const UInt16 GroupID);
543  /// @brief Adds a RenderLayer to multiple groups.
544  /// @note If the requested groups do not exist they will be created.
545  /// @param Layer The RenderLayer to be added to the named groups.
546  /// @param Entrys A vector of std::pair's that contain the ZOrders and the names of the groups the provided layer should be added to.
547  void AddLayerToGroups(RenderLayer* Layer, const GroupOrderEntryVector& Entrys);
548  /// @brief Removes a single RenderLayer from a specified RenderLayerGroup.
549  /// @param Layer The RenderLayer to be removed from the named group.
550  /// @param GroupID The ID of the RenderLayerGroup the provided layer will be removed from.
551  void RemoveLayerFromGroup(RenderLayer* Layer, const UInt16 GroupID);
552  /// @brief Removes a single RenderLayer from all RenderLayerGroups owned by this QuadRenderable.
553  /// @param Layer The RenderLayer to be removed from all groups.
554  void RemoveLayerFromAllGroups(RenderLayer* Layer);
555 
556  /// @brief Creates a new RenderLayerGroup that can have.
557  /// @exception This function will throw an exception if a group already exists with the provided name.
558  /// @remarks The first RenderLayerGroup that is created will automatically be set to the ActiveGroup. You can override
559  /// this by calling "SetActiveGroup" manually after creating any additional RenderLayerGroup.
560  /// @param GroupID The unique ID to be given to the new RenderLayerGroup.
561  /// @return Returns a pointer to the created RenderLayerGroup.
562  RenderLayerGroup* CreateRenderLayerGroup(const UInt16 GroupID);
563  /// @brief Gets the named RenderLayerGroup or creates one with the specified ID if it does not exist.
564  /// @remarks This function is unlike the "create" function in that it won't throw an exception in an error condition,
565  /// and it is unlike the "get" function in that it will not return a NULL pointer. This function guarentee's returning
566  /// a valid RenderLayerGroup with the given ID. @n @n
567  /// The first RenderLayerGroup that is created will automatically be set to the ActiveGroup. You can override
568  /// this by calling "SetActiveGroup" manually after creating any additional RenderLayerGroup.
569  /// @param GroupID The unique ID of the RenderLayerGroup to get or create.
570  /// @return Returns a pointer to the named RenderLayerGroup.
571  RenderLayerGroup* CreateOrRetrieveRenderLayerGroup(const UInt16 GroupID);
572  /// @brief Gets a RenderLayerGroup by ID.
573  /// @param GroupID The unique ID of the RenderLayerGroup to retrieve.
574  /// @return Returns a pointer to the named RenderLayerGroup, or NULL if it does not exist.
575  RenderLayerGroup* GetRenderLayerGroup(const UInt16 GroupID) const;
576  /// @brief Destroy's a RenderLayerGroup by ID.
577  /// @param GroupID The unique ID of the RenderLayerGroup to destroy.
578  void DestroyRenderLayerGroup(const UInt16 GroupID);
579  /// @brief Destroy's a RenderLayerGroup by pointer.
580  /// @param ToBeDestroyed The RenderLayerGroup to be destroyed.
581  void DestroyRenderLayerGroup(RenderLayerGroup* ToBeDestroyed);
582  /// @brief Destroy's all RenderLayerGroups being stored/managed by this QuadRenderable.
583  void DestroyAllRenderLayerGroups();
584 
585  /// @brief Gets an iterator to the first RenderLayerGroup.
586  /// @return Returns an iterator to the first RenderLayerGroup being stored by this renderable.
587  RenderLayerGroupIterator RenderLayerGroupBegin();
588  /// @brief Gets an iterator to one passed the last RenderLayerGroup.
589  /// @return Returns an iterator to one passed the last RenderLayerGroup being stored by this renderable.
590  RenderLayerGroupIterator RenderLayerGroupEnd();
591  /// @brief Gets a const iterator to the first RenderLayerGroup.
592  /// @return Returns a const iterator to the first RenderLayerGroup being stored by this renderable.
593  ConstRenderLayerGroupIterator RenderLayerGroupBegin() const;
594  /// @brief Gets an iterator to one passed the last RenderLayerGroup.
595  /// @return Returns an iterator to one passed the last RenderLayerGroup being stored by this renderable.
596  ConstRenderLayerGroupIterator RenderLayerGroupEnd() const;
597 
598  ///////////////////////////////////////////////////////////////////////////////
599  // Child Management
600 
601  /// @brief Adds a Widget to this as a child of this quad.
602  /// @warning Unless this method is being called from a @ref Screen or @ref LayoutContainer (or it's derived
603  /// classes) this method is not intended for casual use. Different QuadRenderable implementations have
604  /// different expectations on their children and may need a specific quantity, or have them inserted in a
605  /// specific order to achieve the behavior designed for them. Use with care.
606  /// @param Child A pointer to the Widget that is to become a child of this.
607  virtual void AddChild(Widget* Child);
608  /// @brief Adds a Widget to this as a child of this quad.
609  /// @warning Unless this method is being called from a @ref Screen or @ref LayoutContainer (or it's derived
610  /// classes) this method is not intended for casual use. Different QuadRenderable implementations have
611  /// different expectations on their children and may need a specific quantity, or have them inserted in a
612  /// specific order to achieve the behavior designed for them. Use with care.
613  /// @param Child A pointer to the Widget that is to become a child of this.
614  /// @param ZOrder The ZOrder to assign to the child renderable.
615  virtual void AddChild(Widget* Child, const UInt16 ZOrder);
616  /// @brief Gets a child by it's ZOrder.
617  /// @note ZOrders do not have to be unique. In the case of multiple identical ZOrders the first one found will be returned.
618  /// @param Zorder The ZOrder on the child to search for.
619  /// @return Returns a pointer to the requested child.
620  virtual Widget* GetChild(const UInt16 Zorder) const;
621  /// @brief Gets a child by it's name.
622  /// @param RendName The name of the child to search for.
623  /// @return Returns a pointer to the requested child.
624  virtual Widget* GetChild(const String& RendName) const;
625  /// @brief Gets the number of children in this QuadRenderable.
626  /// @return Returns the number of children directly connected to this QuadRenderable.
627  virtual Whole GetNumChildren() const;
628  /// @brief Removes a child Widget from this quadrenderable.
629  /// @note The child is NOT destroyed.
630  /// @param ToBeRemoved A pointer to the child to be removed.
631  virtual void RemoveChild(Widget* ToBeRemoved);
632  /// @brief Removes all child Widgets from this QuadRenderable.
633  /// @note The chilren are NOT destroyed.
634  virtual void RemoveAllChildren();
635  /// @brief Destroys a child Widget currently inside this QuadRenderable.
636  /// @param ToBeDestroyed A pointer to the child to be destroyed.
637  virtual void DestroyChild(Widget* ToBeDestroyed);
638  /// @brief Destroys all child Widgets currently inside this QuadRenderable.
639  virtual void DestroyAllChildren();
640 
641  /// @brief Gets an iterator to the first child Widget.
642  /// @return Returns an iterator to the first Widget being stored by this QuadRenderable.
643  ChildIterator ChildrenBegin();
644  /// @brief Gets an iterator to one passed the last child Widget.
645  /// @return Returns an iterator to one passed the last Widget being stored by this QuadRenderable.
646  ChildIterator ChildrenEnd();
647  /// @brief Gets a const iterator to the first child Widget.
648  /// @return Returns a const iterator to the first Widget being stored by this QuadRenderable.
649  ConstChildIterator ChildrenBegin() const;
650  /// @brief Gets an iterator to one passed the last child Widget.
651  /// @return Returns a const iterator to one passed the last Widget being stored by this QuadRenderable.
652  ConstChildIterator ChildrenEnd() const;
653 
654  /// @brief Gets an iterator to the last Widget.
655  /// @return Returns an iterator to the last Widget being stored by this QuadRenderable.
656  ReverseChildIterator RChildrenBegin();
657  /// @brief Gets an iterator to one before the first child Widget.
658  /// @return Returns an iterator to one before the first child Widget being stored by this QuadRenderable.
659  ReverseChildIterator RChildrenEnd();
660  /// @brief Gets a const iterator to the last Widget.
661  /// @return Returns a const iterator to the last Widget being stored by this QuadRenderable.
662  ConstReverseChildIterator RChildrenBegin() const;
663  /// @brief Gets a const iterator to one before the first child Widget.
664  /// @return Returns a const iterator to one before the first child Widget being stored by this QuadRenderable.
665  ConstReverseChildIterator RChildrenEnd() const;
666 
667  ///////////////////////////////////////////////////////////////////////////////
668  // Transform Methods
669 
670  /// @brief Sets the position this QuadRenderable will have within it's parent
671  /// @param Position The top-left position relative to it's parents' rect.
672  virtual void SetUnifiedPosition(const UnifiedVec2& Position);
673  /// @brief Sets the size this QuadRenderable will have within it's parent.
674  /// @param Size The width and height relative to it's parents' rect.
675  virtual void SetUnifiedSize(const UnifiedVec2& Size);
676  /// @brief Gets the position of this QuadRenderable as a Unified Vector2.
677  /// @return Returns a UnifiedVec2 representing the relative position and pixel offset of this QuadRenderable.
678  virtual UnifiedVec2 GetUnifiedPosition() const;
679  /// @brief Gets the size of this QuadRenderable as a Unified Vector2.
680  /// @return Returns a UnifiedVec2 representing the relative size and pixel offset of this QuadRenderable.
681  virtual UnifiedVec2 GetUnifiedSize() const;
682  /// @brief Gets the Unified positiona nd size of this QuadRenderable as a unified rect.
683  /// @return Returns a UnifiedRect containing the position and size of this QuadRenderable.
684  virtual UnifiedRect GetUnifiedRect() const;
685  /// @brief Gets the pixel position of this widget.
686  /// @return Returns a vector2 representing the pixel position of this widget.
687  virtual Vector2 GetActualPosition() const;
688  /// @brief Gets the pixel size of this widget.
689  /// @return Returns a vector2 representing the pixel size of this widget.
690  virtual Vector2 GetActualSize() const;
691  /// @brief Gets this QuadRenderables' Rect.
692  /// @note This function will always return a non-relative rect(units in pixels).
693  /// @return Returns a Rect containing this QuadRenderables' Position and Size.
694  virtual Rect GetRect() const;
695 
696  ///////////////////////////////////////////////////////////////////////////////
697  // Fetch Methods
698 
699  /// @brief Gets the parent of this quad.
700  /// @return Returns a pointer to the parent object of this quad, or NULL if it's the root object.
701  QuadRenderable* GetParent() const;
702  /// @brief Gets the QuadRenderable after this one among the QuadRenderables owned by it's parent.
703  /// @param Wrap Whether or not you want to return the first QuadRenderable owned by this Quad's parent if this Quad is last.
704  /// @return Returns a pointer to the next QuadRenderable (by sort order).
705  QuadRenderable* GetNextSibling(Boole Wrap = true);
706  /// @brief Gets the QuadRenderable before this one among the QuadRenderables owned by it's parent.
707  /// @param Wrap Whether or not you want to return the last QuadRenderable owned by this Quad's parent if this Quad is first.
708  /// @return Returns a pointer to the previous QuadRenderable (by sort order).
709  QuadRenderable* GetPrevSibling(Boole Wrap = true);
710  /// @brief Gets the QuadRenderable that is both an ancestor of this quad, and a direct child of the screen.
711  /// @note Since the screen is pretty much always the root and you can get the screen through other methods,
712  /// that isn't factored in when searching. If this quad is a direct child of the screen, this will be returned.
713  /// @return Returns a pointer to the QuadRenderable that is both an ancestor of this quad, and a direct child of the screen.
714  QuadRenderable* GetTopMostQuad();
715  /// @brief Gets a pointer to the child of this QuadRenderable that is storing a child, or another quad that is.
716  /// @note If the Child argument is a child of this, this method will return the Child argument.
717  /// @param Child A pointer to the Widget to check for.
718  /// @return Returns a pointer to the Widget most closely related to the specified child that is also a child of this quad, or NULL if the Widget isn't a child of this.
719  Widget* GetClosestChild(Widget* Child);
720 
721  ///////////////////////////////////////////////////////////////////////////////
722  // VertexCaching Methods
723 
724  /// @brief Enables or disables caching of vertex's belonging to this and all child renderables.
725  /// @remarks If enabled, this will create a local instance of ScreenRenderData. Whenever this or
726  /// any of this Quad's children are updated the cache will be flushed and regenerated. When a request
727  /// to append vertices is made, they will be appended from the local cache. If needed the cache will
728  /// be regenerated immediately. @n @n
729  /// This will increase the memory consumed, but in some cases can dramatically increase the performance
730  /// of redrawing a screen when only a small portion of the screen is changed. By default all direct
731  /// children of the screen have this enabled. @n @n
732  /// It is also important to note that this cache is only used when the "_AppendVerticesCascading" method
733  /// is called.
734  /// @param Enable Whether to enable or disable this feature.
735  void SetLocalVertexCaching(Boole Enable);
736  /// @brief Gets whether or not vertex caching is enabled for this Quad.
737  /// @return Returns true if this Quad caches the vertex's of it and it's children, false otherwise.
738  Boole IsVertexCachingEnabled() const;
739 
740  ///////////////////////////////////////////////////////////////////////////////
741  // Serialization
742 
743  /// @copydoc Renderable::ProtoSerialize(XML::Node&) const
744  virtual void ProtoSerialize(XML::Node& ParentNode) const;
745  /// @copydoc Renderable::ProtoSerializeProperties(XML::Node&) const
746  virtual void ProtoSerializeProperties(XML::Node& SelfRoot) const;
747  /// @brief Convert the RenderLayers of this class to an XML::Node ready for serialization.
748  /// @param SelfRoot The root node containing all the serialized data for this instance.
749  virtual void ProtoSerializeRenderLayers(XML::Node& SelfRoot) const;
750  /// @brief Convert the RenderLayerGroups of this class to an XML::Node ready for seriailization.
751  /// @param SelfRoot The root node containing all the serialized data for this instance.
752  virtual void ProtoSerializeRenderLayerGroups(XML::Node& SelfRoot) const;
753  /// @brief Convert the child quads of this class to an XML::Node ready for serialization.
754  /// @param SelfRoot The root node containing all the serialized data for this instance.
755  virtual void ProtoSerializeChildQuads(XML::Node& SelfRoot) const;
756 
757  /// @copydoc Renderable::ProtoDeSerialize(const XML::Node&)
758  virtual void ProtoDeSerialize(const XML::Node& SelfRoot);
759  /// @copydoc Renderable::ProtoDeSerializeProperties(const XML::Node&)
760  virtual void ProtoDeSerializeProperties(const XML::Node& SelfRoot);
761  /// @brief Take the data stored in an XML Node and overwrite the RenderLayers of this object with it.
762  /// @param SelfRoot An XML::Node containing the data to populate this class with.
763  virtual void ProtoDeSerializeRenderLayers(const XML::Node& SelfRoot);
764  /// @brief Take the data stored in an XML Node and overwrite the RenderLayerGroups of this object with it.
765  /// @param SelfRoot An XML::Node containing the data to populate this class with.
766  virtual void ProtoDeSerializeRenderLayerGroups(const XML::Node& SelfRoot);
767  /// @brief Take the data stored in an XML Node and overwrite the ChildQuads of this object with it.
768  /// @param SelfRoot An XML::Node containing the data to populate this class with.
769  virtual void ProtoDeSerializeChildQuads(const XML::Node& SelfRoot);
770 
771  /// @copydoc Renderable::GetDerivedSerializableName() const
772  virtual String GetDerivedSerializableName() const;
773  /// @copydoc Renderable::GetSerializableName()
774  static String GetSerializableName();
775 
776  ///////////////////////////////////////////////////////////////////////////////
777  // Internal Methods
778 
779  /// @internal
780  /// @brief Ssts the ZOrder value for this renderable.
781  /// @warning Under no circumstances would any user need to call this method themselves. Doing so can damage how things are rendered.
782  /// @param Zorder The ZOrder this renderable has among the renderables belonging to it's parent.
783  virtual void _SetZOrder(const UInt16& Zorder);
784  /// @internal
785  /// @brief Notifies this QuadRenderable that it has been added to another QuadRenderable.
786  /// @param NewParent A pointer to the QuadRenderable this is becoming the child of.
787  virtual void _NotifyParenthood(QuadRenderable* NewParent);
788  /// @internal
789  /// @brief Sets a new LayoutStrategy for this quad to use.
790  /// @note If a LayoutStrategy is already applied to this, then the old one will be deleted.
791  /// @param ToSet A pointer to the new LayoutStrategy for this quad to use.
792  virtual void _SetLayoutStrat(LayoutStrategy* ToSet);
793 
794  /// @copydoc Renderable::_Clean()
795  virtual void _Clean();
796  /// @copydoc Renderable::_MarkDirty()
797  virtual void _MarkDirty();
798  /// @internal
799  /// @brief Tells this QuadRenderable to mark each of it's children (and their children) as dirty.
800  /// @note This will also mark itself as dirty in the process.
801  virtual void _MarkAllChildrenDirty();
802  /// @internal
803  /// @brief Tells this QuadRenderable that all of it's layers are dirty.
804  virtual void _MarkAllLayersDirty();
805 
806  /// @copydoc Renderable::_AppendRenderData(ScreenRenderData& RenderData)
807  virtual void _AppendRenderData(ScreenRenderData& RenderData);
808  /// @internal
809  /// @brief Appends the vertices of this renderable to another vector, and then does the same for this renderable's children.
810  /// @param RenderData The vector of vertex's to append to.
811  virtual void _AppendRenderDataCascading(ScreenRenderData& RenderData);
812  };//QuadRenderable
813  }//UI
814 }//Mezzanine
815 
816 #endif
This is a render layer specializing in single-line text.
RenderLayerContainer::iterator RenderLayerIterator
Iterator type for RenderLayer instances stored by this class.
std::vector< RenderLayer * > RenderLayerContainer
Basic container type for RenderLayer storage by this class.
RenderLayerGroupContainer::iterator RenderLayerGroupIterator
Iterator type for RenderLayerGroup instances stored by this class.
This is a base class for the algorithms used by QuadRenderables to determine how they should update t...
Basic class for all structures that get inserted into the rendering hierarchy.
Definition: renderable.h:58
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
RenderLayerGroup * ActiveGroup
This is a pointer to the group of RenderLayers currently being used for rendering.
ChildContainer::reverse_iterator ReverseChildIterator
Reverse Iterator type for Widget instances stored by this class.
PositioningInfo PositioningPolicy
This stores all the information needed to determine the specific behaviors this Quad should have when...
~GroupOrderEntry()
Class destructor.
std::vector< Widget * > ChildContainer
Basic container type for Widget storage by this class.
SizingInfo SizingPolicy
This stores all the information needed to determine the specific behaviors this Quad should have when...
ChildContainer::const_iterator ConstChildIterator
Const Iterator type for Widget instances stored by this class.
UInt16 ZOrder
This is the ZOrder of this Quad in relation to all other Quads in it's parent.
This is a helper class designed to describe the behaviors of a quad when it needs to be resized...
Definition: sizinginfo.h:56
All the definitions for datatypes as well as some basic conversion functions are defined here...
This is a render layer specializing in multi-line text.
GroupOrderEntry(const UInt16 ID, const UInt16 ZOrder)
Class constructor.
This class represents a box shaped area on the screen.
Definition: rect.h:55
RenderLayerContainer::const_iterator ConstRenderLayerIterator
Const Iterator type for RenderLayer instances stored by this class.
RenderLayerContainer RenderLayers
This is a container storing all the RenderLayer instances created by and belonging to this Quad...
Boole AllLayersDirty
Determines whether or not this Quad needs all of it's layers refreshed. Usually after a transform upd...
ChildContainer ChildWidgets
This is a container storing all the children that belong to this Quad.
Rect ActDims
The actual (pixel) position and size of this Quad on the screen it belongs to.
RenderLayerGroupContainer::const_iterator ConstRenderLayerGroupIterator
Const Iterator type for RenderLayerGroup instances stored by this class.
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
This class represents a 2D rect which can express the size and position of a renderable on screen...
Definition: unifieddim.h:661
AspectRatioLock
Used by sizing behavior classes to determine how resizes that preserve aspect ratio should behave...
uint16_t UInt16
An 16-bit unsigned integer.
Definition: datatypes.h:122
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
uint32_t UInt32
An 32-bit unsigned integer.
Definition: datatypes.h:126
This is used to represent a point on a 2 dimentional area, such as a screen.
Definition: vector2.h:63
ChildContainer::const_reverse_iterator ConstReverseChildIterator
Const Reverse Iterator type for Widget instances stored by this class.
This is the base class for all widgets.
Definition: widget.h:126
Boole ManualTransformUpdates
Controls whether or not this Quad and it's children will recieve automatic transform updates...
This is a small convenience class used to store a RenderLayerGroup ID and a ZOrder on that RenderLaye...
ScreenRenderData * VertexCache
This is a pointer to the optional cache of vertex's belonging to this Quad and all of it's children...
std::vector< GroupOrderEntry > GroupOrderEntryVector
Convenience container type for GroupOrderEntry storage.
This class stores a group of render layers that can be set to be rendered.
RenderLayerGroupContainer RenderLayerGroups
This is a container storing all the RenderLayerGroup instances created by and belonging to this Quad...
RenderLayerType
This enum describes the type of RenderLayer this is for use in casting.
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
UInt16 GroupID
The ID of the RenderLayerGroup this entry is referring to.
UInt16 LayerZOrder
The ZOrder within the specified RenderLayerGroup to modify.
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
This class stores all vertices pertaining to a layer sorted by their priority for rendering...
Definition: screen.h:115
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Definition: datatypes.h:151
ChildContainer::iterator ChildIterator
Iterator type for Widget instances stored by this class.
This class represents a point in 2D space using UnifiedDim's.
Definition: unifieddim.h:306
This represents a nestable quad for an object in a GUI layout.
This is an image layer that supports rendering only a single image/sprite.
Boole MousePassthrough
Controls whether or not this Quad will be considered for mouse hover checks.
This class is a helper class for creating UI's. It is responsible for storing and keeping track of al...
Definition: screen.h:142
LayoutStrategy * LayoutStrat
This is a pointer to the strategy being used by this Quad to determine the positions and sizes of chi...
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
std::vector< RenderLayerGroup * > RenderLayerGroupContainer
Basic container type for RenderLayerGroup storage by this class.
QuadRenderable * ParentQuad
This is a pointer to the Quad that owns this Quad and is responsible for transform updates applied to...
This is an image layer that supports rendering of multiple images within it's space.
This is the base class for the types of layers that can be added to a renderable. ...
Definition: renderlayer.h:58
This is a helper class designed to describe the behaviors of a quad when it needs to be repositioned...