40 #ifndef _uipagedcontainer_cpp
41 #define _uipagedcontainer_cpp
43 #include "UI/pagedcontainer.h"
44 #include "UI/pageprovider.h"
45 #include "UI/screen.h"
64 LastSelectedChild(NULL),
67 { this->
AddEvent(PagedContainer::EventChildSelected); }
71 LastSelectedChild(NULL),
74 { this->
AddEvent(PagedContainer::EventChildSelected); }
77 Widget(RendName,RendRect,Parent),
78 LastSelectedChild(NULL),
81 { this->
AddEvent(PagedContainer::EventChildSelected); }
105 if( !( OldState & WS_Focused ) && ( NewState & WS_Focused ) ) {
112 if( DirectChild != NULL ) {
192 if( this->
Visible != CanSee ) {
200 { (*It)->SetVisible(CanSee); }
393 if( !PageDataNode.
Empty() ) {
396 if( !XProviderNode.
Empty() ) {
401 if( !CurrAttrib.
Empty() )
402 ProviderName = CurrAttrib.
AsString();
405 if( !CurrAttrib.
Empty() )
406 ProviderConfig = static_cast<ProviderMode>( CurrAttrib.
AsWhole() );
408 if( !ProviderName.empty() ) {
413 switch( ProviderConfig )
425 if( !YProviderNode.
Empty() ) {
430 if( !CurrAttrib.
Empty() )
431 ProviderName = CurrAttrib.
AsString();
434 if( !CurrAttrib.
Empty() )
435 ProviderConfig = static_cast<ProviderMode>( CurrAttrib.
AsWhole() );
437 if( !ProviderName.empty() ) {
442 switch( ProviderConfig )
467 if( !PropertiesNode.
Empty() ) {
504 { (*ChildIt)->_AppendRenderDataCascading(*
VertexCache); }
510 { (*It)->_AppendRenderDataCascading(RenderData); }
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.
void Clear()
Clears all Vertex vectors.
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.
bool Boole
Generally acts a single bit, true or false.
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.
Thrown when the requested identity could not be found.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
void Append(ScreenRenderData &OtherData)
Appends the contents of another ScreenRenderData to the end of this.
A simple reference counting pointer.
virtual UnifiedVec2 GetUnifiedSize() const
Gets the size of this QuadRenderable as a Unified Vector2.
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
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).
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.
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...
uint16_t UInt16
An 16-bit unsigned integer.
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.
virtual void Hide()
Forces this renderable to hide.
A light-weight handle for manipulating nodes in DOM tree.
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.
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.
bool Empty() const
Is this storing anything at all?
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 RemoveChild(Widget *ToBeRemoved)
Removes a child Widget from this quadrenderable.
String Name
The unique name of this Renderable.
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.
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.
void ProtoSerialize(XML::Node &CurrentRoot) const
Convert this class to an XML::Node ready for serialization.
virtual void SetYProvider(PageProvider *YProv)=0
Sets the PageProvider for the Y axis.
The bulk of the engine components go in this namspace.
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...
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.
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.
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...
std::string String
A datatype used to a series of characters.
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.
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.
virtual void _NotifyParenthood(QuadRenderable *NewParent)
Notifies this QuadRenderable that it has been added to another QuadRenderable.