Spinning Topp Logo BlackTopp Studios
inc
pagedcontainer.cpp
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 _uipagedcontainer_cpp
41 #define _uipagedcontainer_cpp
42 
43 #include "UI/pagedcontainer.h"
44 #include "UI/pageprovider.h"
45 #include "UI/screen.h"
46 
47 #include <algorithm>
48 
49 namespace Mezzanine
50 {
51  namespace UI
52  {
53  ///////////////////////////////////////////////////////////////////////////////
54  // PagedContainer Static Members
55 
56  const String PagedContainer::TypeName = "PagedContainer";
57  const String PagedContainer::EventChildSelected = "ChildSelected";
58 
59  ///////////////////////////////////////////////////////////////////////////////
60  // PagedContainer Methods
61 
63  Widget(Parent),
64  LastSelectedChild(NULL),
65  XProvider(NULL),
66  YProvider(NULL)
67  { this->AddEvent(PagedContainer::EventChildSelected); }
68 
69  PagedContainer::PagedContainer(const String& RendName, Screen* Parent) :
70  Widget(RendName,Parent),
71  LastSelectedChild(NULL),
72  XProvider(NULL),
73  YProvider(NULL)
74  { this->AddEvent(PagedContainer::EventChildSelected); }
75 
76  PagedContainer::PagedContainer(const String& RendName, const UnifiedRect& RendRect, Screen* Parent) :
77  Widget(RendName,RendRect,Parent),
78  LastSelectedChild(NULL),
79  XProvider(NULL),
80  YProvider(NULL)
81  { this->AddEvent(PagedContainer::EventChildSelected); }
82 
84  {
85  if( this->XProvider != NULL )
86  this->XProvider->_SetContainer(NULL);
87  if( this->YProvider != NULL )
88  this->YProvider->_SetContainer(NULL);
89  }
90 
92  {
93  this->Widget::ProtoSerializeImpl(SelfRoot);
94  this->ProtoSerializePageData(SelfRoot);
95  }
96 
98  {
99  this->Widget::ProtoDeSerializeImpl(SelfRoot);
100  this->ProtoDeSerializePageData(SelfRoot);
101  }
102 
103  void PagedContainer::HandleChildStateChangeImpl(Widget* Child, const UInt32& OldState, const UInt32& NewState)
104  {
105  if( !( OldState & WS_Focused ) && ( NewState & WS_Focused ) ) {
106  Widget* DirectChild = this->GetClosestChild(Child);
107  if( this->LastSelectedChild != DirectChild ) {
108  if( this->LastSelectedChild != NULL ) {
109  ChildSelectedArgumentsPtr DeselectArgs( new ChildSelectedArguments(PagedContainer::EventChildSelected,this->Name,this->LastSelectedChild->GetName(),false) );
110  this->FireEvent(DeselectArgs);
111  }
112  if( DirectChild != NULL ) {
113  ChildSelectedArgumentsPtr SelectArgs( new ChildSelectedArguments(PagedContainer::EventChildSelected,this->Name,DirectChild->GetName(),true) );
114  this->FireEvent(SelectArgs);
115  }
116  this->LastSelectedChild = DirectChild;
117  }
118  }
119  }
120 
121  ///////////////////////////////////////////////////////////////////////////////
122  // Utility
123 
125  {
126  return this->WorkAreaSize;
127  }
128 
129  void PagedContainer::UpdateDimensions(const Rect& OldSelfRect, const Rect& NewSelfRect)
130  {
131  // Update the personal data first
132  this->ActDims = NewSelfRect;
133 
134  // Perform the container specific update logic
135  this->UpdateContainerDimensionsImpl(OldSelfRect,NewSelfRect);
136 
137  // We done got icky
138  this->_MarkAllLayersDirty();
139  }
140 
142  {
143  Rect CurrDims = this->GetRect();
144  this->UpdateContainerDimensionsImpl(CurrDims,CurrDims);
145  }
146 
148  {
149  return this->LastSelectedChild;
150  }
151 
153  {
154  if( this->LastSelectedChild != NULL ) {
155  ChildSelectedArgumentsPtr DeselectArgs( new ChildSelectedArguments(PagedContainer::EventChildSelected,this->Name,this->LastSelectedChild->GetName(),false) );
156  this->FireEvent(DeselectArgs);
157  this->LastSelectedChild = NULL;
158  }
159  }
160 
162  {
163  if( this->XProvider != NULL && this->YProvider != NULL ) {
165  }else if( this->XProvider != NULL ) {
167  }else if( this->YProvider != NULL ) {
169  }else{
171  }
172  }
173 
175  {
176  if( this->XProvider == Prov && this->YProvider == Prov ) {
178  }else if( this->XProvider == Prov ) {
180  }else if( this->YProvider == Prov ) {
182  }else{
184  }
185  }
186 
187  ///////////////////////////////////////////////////////////////////////////////
188  // Visibility and Priority Methods
189 
191  {
192  if( this->Visible != CanSee ) {
193  if(CanSee) {
194  this->_OnVisibilityShown();
195  }else{
196  this->_OnVisibilityHidden();
197  }
198 
199  for( VisibleChildIterator It = this->VisibleChildren.begin() ; It != this->VisibleChildren.end() ; ++It )
200  { (*It)->SetVisible(CanSee); }
201  }
202  }
203 
205  {
206  return this->Visible;
207  }
208 
210  {
211  if( this->ParentQuad ) {
212  return this->Visible && this->ParentQuad->IsVisible();
213  }else{
214  return this->Visible;
215  }
216  }
217 
219  {
220  if( this->Visible == false ) {
221  this->_OnVisibilityShown();
222  for( VisibleChildIterator It = this->VisibleChildren.begin() ; It != this->VisibleChildren.end() ; ++It )
223  { (*It)->Show(); }
224  }
225  }
226 
228  {
229  if( this->Visible == true ) {
230  this->_OnVisibilityHidden();
231  for( VisibleChildIterator It = this->VisibleChildren.begin() ; It != this->VisibleChildren.end() ; ++It )
232  { (*It)->Hide(); }
233  }
234  }
235 
236  ///////////////////////////////////////////////////////////////////////////////
237  // PagedContainer Configuration
238 
240  { this->SetProviders(Prov,Prov); }
241 
243  { return this->XProvider; }
244 
246  { return this->YProvider; }
247 
249  {
250  if( this->XProvider == Prov ) {
251  if( this->YProvider != Prov ) {
252  this->XProvider->_SetContainer(NULL);
253  }
254  this->XProvider = NULL;
255  }
256  if( this->YProvider == Prov ) {
257  if( this->XProvider != Prov ) {
258  this->YProvider->_SetContainer(NULL);
259  }
260  this->YProvider = NULL;
261  }
262  }
263 
264  ///////////////////////////////////////////////////////////////////////////////
265  // Child Management
266 
268  {
269  this->QuadRenderable::AddChild(Child);
270  this->QuickUpdateWorkAreaSize(Child->GetUnifiedSize(),true);
271  }
272 
273  void PagedContainer::AddChild(Widget* Child, const UInt16 ZOrder)
274  {
275  this->QuadRenderable::AddChild(Child,ZOrder);
276  }
277 
279  {
280  if( this->LastSelectedChild == ToBeRemoved ) {
281  this->LastSelectedChild = NULL;
282  }
283  this->QuickUpdateWorkAreaSize(ToBeRemoved->GetUnifiedSize(),false);
284  this->QuadRenderable::RemoveChild(ToBeRemoved);
285 
286  VisibleChildIterator ChildIt = std::find(this->VisibleChildren.begin(),this->VisibleChildren.end(),ToBeRemoved);
287  if( ChildIt != this->VisibleChildren.end() ) {
288  this->VisibleChildren.erase(ChildIt);
289  }
290  }
291 
293  {
294  this->LastSelectedChild = NULL;
295  for( ChildIterator It = this->ChildWidgets.begin() ; It != this->ChildWidgets.end() ; ++It )
296  {
297  (*It)->_NotifyParenthood(NULL);
298  }
299  this->ChildWidgets.clear();
300  this->VisibleChildren.clear();
301  this->UpdateWorkAreaSize();
302  this->_MarkDirty();
303  }
304 
306  {
307  if( this->LastSelectedChild == ToBeDestroyed ) {
308  this->LastSelectedChild = NULL;
309  }
310  this->QuickUpdateWorkAreaSize(ToBeDestroyed->GetUnifiedSize(),false);
311  this->QuadRenderable::DestroyChild(ToBeDestroyed);
312 
313  VisibleChildIterator ChildIt = std::find(this->VisibleChildren.begin(),this->VisibleChildren.end(),ToBeDestroyed);
314  if( ChildIt != this->VisibleChildren.end() ) {
315  this->VisibleChildren.erase(ChildIt);
316  }
317  }
318 
320  {
321  this->LastSelectedChild = NULL;
322  for( ChildIterator It = this->ChildWidgets.begin() ; It != this->ChildWidgets.end() ; ++It )
323  {
324  (*It)->_NotifyParenthood(NULL);
325  this->ParentScreen->DestroyWidget( (*It) );
326  }
327  this->ChildWidgets.clear();
328  this->VisibleChildren.clear();
329  this->UpdateWorkAreaSize();
330  this->_MarkDirty();
331  }
332 
333  ///////////////////////////////////////////////////////////////////////////////
334  // Serialization
335 
337  {
338  if( this->XProvider != NULL || this->YProvider != NULL ) {
339  XML::Node PageDataNode = SelfRoot.AppendChild( PagedContainer::GetSerializableName() + "PageData" );
340  if( PageDataNode.AppendAttribute("Version").SetValue("1") )
341  {
342  if( this->XProvider != NULL ) {
343  XML::Node XProviderNode = PageDataNode.AppendChild("XProvider");
344  if( XProviderNode.AppendAttribute("Name").SetValue( this->XProvider->GetName() ) &&
345  XProviderNode.AppendAttribute("Config").SetValue( this->GetProviderConfig( this->XProvider ) ) )
346  {
347  return;
348  }else{
349  SerializeError("Create XML Attribute Values",PagedContainer::GetSerializableName() + "PageData",true);
350  }
351  }
352 
353  if( this->YProvider != NULL ) {
354  XML::Node YProviderNode = PageDataNode.AppendChild("YProvider");
355  if( YProviderNode.AppendAttribute("Name").SetValue( this->YProvider->GetName() ) &&
356  YProviderNode.AppendAttribute("Config").SetValue( this->GetProviderConfig( this->YProvider ) ) )
357  {
358  return;
359  }else{
360  SerializeError("Create XML Attribute Values",PagedContainer::GetSerializableName() + "PageData",true);
361  }
362  }
363 
364  return;
365  }else{
366  SerializeError("Create XML Attribute Values",PagedContainer::GetSerializableName() + "PageData",true);
367  }
368  }
369  }
370 
372  {
373  this->Widget::ProtoSerializeProperties(SelfRoot);
374 
375  XML::Node PropertiesNode = SelfRoot.AppendChild( PagedContainer::GetSerializableName() + "Properties" );
376 
377  if( PropertiesNode.AppendAttribute("Version").SetValue("1") )
378  {
379  XML::Node WorkAreaSizeNode = PropertiesNode.AppendChild("WorkAreaSize");
380  this->WorkAreaSize.ProtoSerialize(WorkAreaSizeNode);
381 
382  return;
383  }else{
384  SerializeError("Create XML Attribute Values",PagedContainer::GetSerializableName() + "Properties",true);
385  }
386  }
387 
389  {
390  XML::Attribute CurrAttrib;
391  XML::Node PageDataNode = SelfRoot.GetChild( PagedContainer::GetSerializableName() + "PageData" );
392 
393  if( !PageDataNode.Empty() ) {
394  if(PageDataNode.GetAttribute("Version").AsInt() == 1) {
395  XML::Node XProviderNode = PageDataNode.GetChild("XProvider");
396  if( !XProviderNode.Empty() ) {
397  String ProviderName;
398  ProviderMode ProviderConfig;
399 
400  CurrAttrib = XProviderNode.GetAttribute("Name");
401  if( !CurrAttrib.Empty() )
402  ProviderName = CurrAttrib.AsString();
403 
404  CurrAttrib = XProviderNode.GetAttribute("Config");
405  if( !CurrAttrib.Empty() )
406  ProviderConfig = static_cast<ProviderMode>( CurrAttrib.AsWhole() );
407 
408  if( !ProviderName.empty() ) {
409  /// @todo This is a blind cast and can cause some issues if the configuration is edited externally such that the named
410  /// widget isn't a provider. Some check may being added may be warrented.
411  PageProvider* Casted = static_cast<PageProvider*>( this->ParentScreen->GetWidget(ProviderName) );
412  if( Casted ) {
413  switch( ProviderConfig )
414  {
415  case PagedContainer::PM_Single_X: this->SetXProvider(Casted); break;
416  case PagedContainer::PM_Single_Y: this->SetYProvider(Casted); break;
417  case PagedContainer::PM_Single_XY: this->SetProviders(Casted,Casted); break;
418  default: /* Do Nothing */ break;
419  }
420  }
421  }
422  }
423 
424  XML::Node YProviderNode = PageDataNode.GetChild("YProvider");
425  if( !YProviderNode.Empty() ) {
426  String ProviderName;
427  ProviderMode ProviderConfig;
428 
429  CurrAttrib = YProviderNode.GetAttribute("Name");
430  if( !CurrAttrib.Empty() )
431  ProviderName = CurrAttrib.AsString();
432 
433  CurrAttrib = YProviderNode.GetAttribute("Config");
434  if( !CurrAttrib.Empty() )
435  ProviderConfig = static_cast<ProviderMode>( CurrAttrib.AsWhole() );
436 
437  if( !ProviderName.empty() ) {
438  /// @todo This is a blind cast and can cause some issues if the configuration is edited externally such that the named
439  /// widget isn't a provider. Some check may being added may be warrented.
440  PageProvider* Casted = static_cast<PageProvider*>( this->ParentScreen->GetWidget(ProviderName) );
441  if( Casted ) {
442  switch( ProviderConfig )
443  {
444  case PagedContainer::PM_Single_X: this->SetXProvider(Casted); break;
445  case PagedContainer::PM_Single_Y: this->SetYProvider(Casted); break;
446  case PagedContainer::PM_Single_XY: this->SetProviders(Casted,Casted); break;
447  default: /* Do Nothing */ break;
448  }
449  }
450  }
451  }
452  }else{
453  MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (PagedContainer::GetSerializableName() + "PageData") + ": Not Version 1.");
454  }
455  }else{
456  MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,PagedContainer::GetSerializableName() + "PageData" + " was not found in the provided XML node, which was expected.");
457  }
458  }
459 
461  {
462  this->Widget::ProtoDeSerializeProperties(SelfRoot);
463 
464  //XML::Attribute CurrAttrib;
465  XML::Node PropertiesNode = SelfRoot.GetChild( PagedContainer::GetSerializableName() + "Properties" );
466 
467  if( !PropertiesNode.Empty() ) {
468  if(PropertiesNode.GetAttribute("Version").AsInt() == 1) {
469  XML::Node WorkAreaSizeNode = PropertiesNode.GetChild("WorkAreaSize");
470  this->WorkAreaSize.ProtoDeSerialize(WorkAreaSizeNode);
471  }else{
472  MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (PagedContainer::GetSerializableName() + "Properties") + ": Not Version 1.");
473  }
474  }else{
475  MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,PagedContainer::GetSerializableName() + "Properties" + " was not found in the provided XML node, which was expected.");
476  }
477  }
478 
480  {
482  }
483 
484  ///////////////////////////////////////////////////////////////////////////////
485  // Internal Event Methods
486 
487  void PagedContainer::_OnChildSelected(const String& ChildName, const Boole Selected)
488  {
489  ChildSelectedArgumentsPtr Args( new ChildSelectedArguments(PagedContainer::EventChildSelected,this->Name,ChildName,Selected) );
490  this->FireEvent(Args);
491  }
492 
493  ///////////////////////////////////////////////////////////////////////////////
494  // Internal Methods
495 
497  {
498  // Update the children based on page positions and the container size so we can grab the proper vertices.
499  if(this->VertexCache) {
500  if( this->Dirty || this->AllLayersDirty ) {
501  this->VertexCache->Clear();
503  for( VisibleChildIterator ChildIt = this->VisibleChildren.begin() ; ChildIt != this->VisibleChildren.end() ; ++ChildIt )
504  { (*ChildIt)->_AppendRenderDataCascading(*VertexCache); }
505  }
506  RenderData.Append(*VertexCache);
507  }else{
508  this->_AppendRenderData(RenderData);
509  for( VisibleChildIterator It = this->VisibleChildren.begin() ; It != this->VisibleChildren.end() ; ++It )
510  { (*It)->_AppendRenderDataCascading(RenderData); }
511  }
512  }
513  }//UI
514 }//Mezzanine
515 
516 #endif
Widget * LastSelectedChild
A pointer to the last child widget that was selected within this container.
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
virtual Rect GetRect() const
Gets this QuadRenderables' Rect.
const String & GetName() const
Gets the name of this renderable.
Definition: renderable.cpp:77
void Clear()
Clears all Vertex vectors.
Definition: screen.cpp:176
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
A light-weight handle for manipulating attributes in DOM tree.
Definition: attribute.h:74
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
virtual ~PagedContainer()
Class destructor.
There is only one PageProvider providing pages for both the X and Y axes of this container, or the queried provider is being used for both the X and Y axes be the container.
virtual void _MarkAllLayersDirty()
Tells this QuadRenderable that all of it's layers are dirty.
virtual void DestroyChild(Widget *ToBeDestroyed)
Destroys a child Widget currently inside this QuadRenderable.
static const String TypeName
String containing the type name for this class: "PagedContainer".
VisibleChildContainer::iterator VisibleChildIterator
Iterator type for Visible Widget instances stored by this class.
virtual void SetProviders(PageProvider *XProv, PageProvider *YProv)=0
Sets the page providers for both axes.
virtual void HandleChildStateChangeImpl(Widget *Child, const UInt32 &OldState, const UInt32 &NewState)
Handles the logic to execute when a child of this widget has it's state updated.
virtual void _OnVisibilityShown()
Self logic to be executed when this widget becomes visible.
Definition: widget.cpp:519
Thrown when the requested identity could not be found.
Definition: exception.h:94
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
Definition: exception.h:3048
void Append(ScreenRenderData &OtherData)
Appends the contents of another ScreenRenderData to the end of this.
Definition: screen.cpp:182
A simple reference counting pointer.
Definition: countedptr.h:70
virtual UnifiedVec2 GetUnifiedSize() const
Gets the size of this QuadRenderable as a Unified Vector2.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
Definition: widget.cpp:278
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
Definition: exception.h:112
const Char8 * AsString(const Char8 *def="") const
Attempts to convert the value of the attribute to a String and returns the results.
Boole Visible
Stores whether this Renderable is to be rendered (also dependent on parent visibility).
Definition: renderable.h:75
virtual void SetVisible(Boole CanSee)
Sets the visibility of this renderable.
virtual void SetXYProvider(PageProvider *Prov)
Sets a single PageProvider as the provider for both the X and Y axis.
virtual void ProtoSerializePageData(XML::Node &SelfRoot) const
Convert the PageProvider data of this class to an XML::Node ready for serialization.
This class represents a box shaped area on the screen.
Definition: rect.h:55
virtual void _SetContainer(PagedContainer *ToUpdate)
Sets the container that is using this provider to update which renderables are visible.
bool Empty() const
Is this storing anything at all?
PageProvider * XProvider
A pointer to the X axis provider.
static const String EventChildSelected
Event name for when a child of this widget gets selected.
virtual void DestroyAllChildren()
Destroys all child Widgets currently inside this QuadRenderable.
virtual void ProtoDeSerializeImpl(const XML::Node &SelfRoot)
Implementation method for deseriailizing additional sets of data.
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.
virtual Boole IsVisible() const
Gets whether or not this renderable is being drawn.
There are two different PageProviders each providing pages for their respective axis. This value isn't returned by a provider query.
virtual void _OnChildSelected(const String &ChildName, const Boole Selected)
Self logic to be executed when focus is given to a child of this widget.
Rect ActDims
The actual (pixel) position and size of this Quad on the screen it belongs to.
virtual void _AppendRenderData(ScreenRenderData &RenderData)
Appends the vertices of this renderable to another vector.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
bool SetValue(const Char8 *rhs)
Set the value of this.
This class represents a 2D rect which can express the size and position of a renderable on screen...
Definition: unifieddim.h:661
uint16_t UInt16
An 16-bit unsigned integer.
Definition: datatypes.h:122
Whole AsWhole(Whole def=0) const
Attempts to convert the value of the attribute to a Whole and returns the results.
virtual void RemoveChild(Widget *ToBeRemoved)
Removes a child Widget from this quadrenderable.
virtual void ProtoSerializeImpl(XML::Node &SelfRoot) const
Implementation method for serializing additional sets of data.
This is the EventArguments class for when a child of a paged container is selected.
virtual void DestroyWidget(Widget *ToBeDestroyed)
Destroys a widget.
Definition: screen.cpp:585
virtual void Hide()
Forces this renderable to hide.
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
virtual PageProvider * GetXProvider() const
Gets the PageProvider for the X axis.
int AsInt(int def=0) const
Attempts to convert the value of the attribute to an int and returns the results. ...
uint32_t UInt32
An 32-bit unsigned integer.
Definition: datatypes.h:126
virtual const Vector2 & GetWorkAreaSize() const
Gets the size of this containers work area.
This is used to represent a point on a 2 dimentional area, such as a screen.
Definition: vector2.h:63
bool Empty() const
Is this storing anything at all?
This is the base class for all widgets.
Definition: widget.h:126
virtual void UnbindProvider(PageProvider *Prov)
Unbinds a provider being used by this container.
Event * AddEvent(const String &EventName)
Creates a new event this Publisher can fire.
virtual void SetXProvider(PageProvider *XProv)=0
Sets the PageProvider for the X axis.
ScreenRenderData * VertexCache
This is a pointer to the optional cache of vertex's belonging to this Quad and all of it's children...
virtual Widget * GetLastSelectedChild() const
Gets a pointer to the last selected child widget in this container.
virtual PageProvider * GetYProvider() const
Gets the PageProvider for the Y axis.
virtual void ProtoDeSerializeImpl(const XML::Node &SelfRoot)
Implementation method for deseriailizing additional sets of data.
Definition: widget.cpp:105
virtual void RemoveChild(Widget *ToBeRemoved)
Removes a child Widget from this quadrenderable.
String Name
The unique name of this Renderable.
Definition: renderable.h:81
void FireEvent(EventArgumentsPtr Args)
Fires an event.
virtual ProviderMode GetProviderConfig() const
Gets the current provider configuration of this container.
virtual void UpdateWorkAreaSize()=0
Checks the size of every child in this container and updates the work area to match the size needed...
virtual Boole GetVisible() const
Gets the visibility setting of this renderable.
There is only one PageProvider providing pages for the Y axis of this container, or the queried provi...
virtual void AddChild(Widget *Child)
Adds a Widget to this as a child of this quad.
virtual void QuickUpdateWorkAreaSize(const UnifiedVec2 &ChildSize, Boole Adding)=0
Quickly updates the work area size based on a single childs' dimensions.
virtual void _AppendRenderDataCascading(ScreenRenderData &RenderData)
Appends the vertices of this renderable to another vector, and then does the same for this renderable...
virtual void AddChild(Widget *Child)
Adds a Widget to this as a child of this quad.
virtual void Show()
Forces this renderable to be shown.
PageProvider * YProvider
A pointer to the Y axis provider.
This is the base class for interpretting widget values to page positions.
Definition: pageprovider.h:55
virtual void ProtoDeSerializePageData(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the PageProvider data of this object with it...
Widget * GetClosestChild(Widget *Child)
Gets a pointer to the child of this QuadRenderable that is storing a child, or another quad that is...
Vector2 WorkAreaSize
Vector2 storing the size for all pages of this container.
virtual Widget * GetWidget(const String &Name)
Gets a widget in this screen by name.
Definition: screen.cpp:573
void ProtoSerialize(XML::Node &CurrentRoot) const
Convert this class to an XML::Node ready for serialization.
Definition: vector2.cpp:314
virtual void ProtoSerializeImpl(XML::Node &SelfRoot) const
Implementation method for serializing additional sets of data.
Definition: widget.cpp:97
virtual void SetYProvider(PageProvider *YProv)=0
Sets the PageProvider for the Y axis.
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
virtual void ClearSelectedChild()
Forces the currently selected child to become deselected.
This class stores all vertices pertaining to a layer sorted by their priority for rendering...
Definition: screen.h:115
virtual void RemoveAllChildren()
Removes all child Widgets from this QuadRenderable.
The PageProvider configuration is invalid, or the queried PageProvider isn't in use by the container...
ChildContainer::iterator ChildIterator
Iterator type for Widget instances stored by this class.
ProviderMode
An enum describing how the providers for this container are configured and being used.
Boole Dirty
Stores whether this Renderables vertices need to be regenerated.
Definition: renderable.h:78
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
Definition: widget.cpp:337
VisibleChildContainer VisibleChildren
A container of children that meet the criteria for rendering in this container.
virtual void UpdateDimensions()
Updates the dimensions of this QuadRenderable based on the transform of it's parent.
virtual void UpdateContainerDimensionsImpl(const Rect &OldSelfRect, const Rect &NewSelfRect)=0
The container specific logic for updating it's dimensions.
static String GetSerializableName()
Get the name of the the XML tag the Renderable class will leave behind as its instances are serialize...
virtual void _MarkDirty()
Marks this renderable as dirty, and informs other renderables if needed.
void SerializeError(const String &FailedTo, const String &ClassName, Boole SOrD)
Simply does some string concatenation, then throws an Exception.
virtual void DestroyChild(Widget *ToBeDestroyed)
Destroys a child Widget currently inside this QuadRenderable.
virtual void _OnVisibilityHidden()
Self logic to be executed when this widget becomes invisible.
Definition: widget.cpp:528
Node AppendChild(NodeType Type=NodeElement)
Creates a Node and makes it a child of this one.
virtual Boole IsVisible() const =0
Gets whether or not this renderable is being drawn.
This class is a helper class for creating UI's. It is responsible for storing and keeping track of al...
Definition: screen.h:142
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
QuadRenderable * ParentQuad
This is a pointer to the Quad that owns this Quad and is responsible for transform updates applied to...
void ProtoDeSerialize(const XML::Node &OneNode)
Take the data stored in an XML and overwrite this instance of this object with it.
Definition: vector2.cpp:335
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
PagedContainer(Screen *Parent)
Blank constructor.
virtual void UpdateVisibleChildren()
Forces an update of the visible children in this container.
There is only one PageProvider providing pages for the X axis of this container, or the queried provi...
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.
Screen * ParentScreen
A pointer to the Screen that created this Renderable.
Definition: renderable.h:72
virtual void _NotifyParenthood(QuadRenderable *NewParent)
Notifies this QuadRenderable that it has been added to another QuadRenderable.