40 #ifndef _uiverticalcontainer_cpp
41 #define _uiverticalcontainer_cpp
43 #include "UI/verticalcontainer.h"
44 #include "UI/verticallayoutstrategy.h"
46 #include "UI/verticalscrollbar.h"
47 #include "UI/spinner.h"
87 const Real HalfPadding = ActPadding * 0.5;
88 std::vector< std::pair<Real,Vector2> > ChildTransformCache( this->
ChildWidgets.size() );
106 ChildTransformCache.at(CurrIndex).first = this->
WorkAreaSize.
Y;
107 ChildTransformCache.at(CurrIndex).second = ChildSize;
125 YTarget = std::min( ( this->YProvider->GetCurrentYPage() - 1 ) * NewSelfRect.
Size.
Y, YTargetLimit );
132 while( ChildUpdateIt != this->
ChildWidgets.end() && ChildTransformCache.at(CurrIndex).first < YTarget )
134 const Rect OldChildRect = (*ChildUpdateIt)->GetRect();
139 NewChildRect.
Size = ChildTransformCache.at(CurrIndex).second;
142 (*ChildUpdateIt)->UpdateDimensions(OldChildRect,NewChildRect);
145 (*ChildUpdateIt)->Hide();
157 YTarget = NewSelfRect.
Size.
Y;
158 Real TotalLinearSize = HalfPadding;
162 const Whole VisibleStartIndex = CurrIndex;
165 Vector2 ChildSize = ChildTransformCache.at(CurrIndex).second;
167 if( TotalLinearSize + ChildSize.
Y < YTarget ) {
169 TotalLinearSize += ( ChildSize.
Y + ActPadding );
181 const Rect OldChildRect = (*ChildUpdateIt)->GetRect();
186 NewChildRect.
Size = ChildTransformCache.at(CurrIndex).second;
189 (*ChildUpdateIt)->UpdateDimensions(OldChildRect,NewChildRect);
192 (*ChildUpdateIt)->Hide();
204 case UI::LA_TopLeft: CurrYPos = ( NewSelfRect.
Position.
Y + HalfPadding );
break;
205 case UI::LA_Center: CurrYPos = ( NewSelfRect.
Position.
Y + ( NewSelfRect.
Size.
Y * 0.5 ) ) - ( TotalLinearSize * 0.5 );
break;
206 case UI::LA_BottomRight: CurrYPos = ( NewSelfRect.
Position.
Y + NewSelfRect.
Size.
Y ) - ( TotalLinearSize + HalfPadding );
break;
217 NewChildRect.
Size = ChildTransformCache.at(VisibleStartIndex + VisIndex).second;
224 CurrYPos += ( NewChildRect.
Size.
Y + ActPadding );
228 ChildTransformCache.clear();
239 const Real HalfPadding = ActPadding * 0.5;
243 Vector2 ChildSize = (*ChildIt)->GetActualSize();
255 const Real HalfPadding = ActPadding * 0.5;
virtual Rect GetRect() const
Gets this QuadRenderables' Rect.
UnifiedDim LinearPadding
The amount of space to add to both sides of a child object on the relevant axis.
This is a base class for the algorithms used by QuadRenderables to determine how they should update t...
static String GetSerializableName()
Get the name of the the XML tag the Renderable class will leave behind as its instances are serialize...
bool Boole
Generally acts a single bit, true or false.
virtual Vector2 HandleChildSizing(const Rect &OldSelfRect, const Rect &NewSelfRect, QuadRenderable *Child)
Handles the sizing of a child that needs it's dimensions updated.
virtual void UpdateWorkAreaSize()
Checks the size of every child in this container and updates the work area to match the size needed...
virtual const String & GetTypeName() const
Gets the type of widget this is.
Vector2 Size
Vector2 representing the width and height of the rect.
The preset size for children of this container will be enforced constantly on each update...
virtual VerticalContainer * CreateVerticalContainer(const String &RendName, Screen *Parent)
Creates a new VerticalContainer.
virtual ~VerticalContainer()
Class destructor.
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.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
virtual void SetYProvider(PageProvider *YProv)
Sets the PageProvider for the Y axis.
Vector2 CalculateActualDimensions(const Vector2 &Actual) const
Calculates the actual values when a Vector2 with actual dimensions has this unified vector2 applied t...
This is a simple widget for a numeric variable in a box.
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.
float Real
A Datatype used to represent a real floating point number.
This class represents a 2D rect which can express the size and position of a renderable on screen...
virtual void SetSpinnerProvider(Spinner *Prov)
Convenience method for configuring a Spinner as the page provider for this container.
virtual void UpdateContainerDimensionsImpl(const Rect &OldSelfRect, const Rect &NewSelfRect)
The container specific logic for updating it's dimensions.
Real Y
Coordinate on the Y vector.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
static const String TypeName
String containing the type name for this class: "VerticalContainer".
A light-weight handle for manipulating nodes in DOM tree.
Real X
Coordinate on the X vector.
Whole ForcedSizingRules
The current enforcement for child size in this container.
This is used to represent a point on a 2 dimentional area, such as a screen.
virtual void UnbindProvider(PageProvider *Prov)
Unbinds a provider being used by this container.
virtual Vector2 GetActualSize() const
Gets the pixel size of this widget.
void SetIdentity()
Sets the values of this vector2 to identity values(0,0).
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
A layout container that aligns it's children along a common Y axis.
virtual Widget * CreateWidget(Screen *Parent)
Creates a Widget of the type represented by this factory.
virtual String GetWidgetTypeName() const
Gets the name of the Widget that is created by this factory.
virtual Boole GetVisible() const
Gets the visibility setting of this renderable.
virtual void _SetLayoutStrat(LayoutStrategy *ToSet)
Sets a new LayoutStrategy for this quad to use.
SizingInfo ChildSizing
The size given to children layed out by this container.
VerticalContainer(Screen *Parent)
Blank constructor.
PageProvider * YProvider
A pointer to the Y axis provider.
This is the base class for interpretting widget values to page positions.
virtual void SetProviders(PageProvider *XProv, PageProvider *YProv)
Sets the page providers for both axes.
Vector2 WorkAreaSize
Vector2 storing the size for all pages of this container.
virtual void DestroyWidget(Widget *ToBeDestroyed)
Destroys a Widget created by this factory.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
UI::LinearAlignment VisibleChildAlign
The alignment to be given to the sequence of children visible in this container.
ChildContainer::iterator ChildIterator
Iterator type for Widget instances stored by this class.
This class represents a point in 2D space using UnifiedDim's.
virtual Real HandleChildHorizontalPositioning(const Rect &OldSelfRect, const Rect &NewSelfRect, const Vector2 &NewChildSize, QuadRenderable *Child)
Handles the positioning of a child on the X axis.
virtual void _NotifyContainerUpdated()=0
Notifies this provider that the container it is providing page data to has been updated.
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
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.
Vector2 Position
Vector2 representing the top-left position of the rect.
std::map< String, String > NameValuePairMap
This is a datatype mostly used for describing settings or parameters that can't be declared in advanc...
This class is a helper class for creating UI's. It is responsible for storing and keeping track of al...
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.
QuadRenderable * ParentQuad
This is a pointer to the Quad that owns this Quad and is responsible for transform updates applied to...
Real CalculateActualDimension(const Real &Actual) const
Calculates the actual value when a Real in pixels has this unified dim applied to it...
virtual void SetScrollbarProvider(VerticalScrollbar *Prov)
Convenience method for configuring a VerticalScrollbar as the page provider for this container...
virtual void SetXProvider(PageProvider *XProv)
Sets the PageProvider for the X axis.
This is a container class for placing child objects in succession on a single axis.
virtual void QuickUpdateWorkAreaSize(const UnifiedVec2 &ChildSize, Boole Adding)
Quickly updates the work area size based on a single childs' dimensions.