40 #ifndef _uiverticalscrollbar_cpp
41 #define _uiverticalscrollbar_cpp
43 #include "UI/verticalscrollbar.h"
44 #include "UI/button.h"
45 #include "UI/screen.h"
46 #include "UI/pagedcontainer.h"
47 #include "UI/uimanager.h"
49 #include "UI/verticallayoutstrategy.h"
51 #include "Input/metacode.h"
52 #include "stringtool.h"
53 #include "MathTools/mathtools.h"
105 if( UI::SB_NoButtons == ScrollStyle )
118 if(UI::SB_Separate == ScrollStyle)
142 else if(UI::SB_TogetherDownRight == ScrollStyle)
166 else if(UI::SB_TogetherUpLeft == ScrollStyle)
193 if( this->
ActDims != TempDims ) {
221 if(Value > 1 || Value < 0)
226 Rect NewScrollerRect;
228 NewScrollerRect.
Size.
X = OldScrollerRect.
Size.
X;
229 NewScrollerRect.
Size.
Y = OldScrollerRect.
Size.
Y;
240 return ( RelLimit > 0 ? RelPos / RelLimit : 0 );
245 if(Size > 1 || Size < 0)
251 Rect NewScrollerRect;
254 NewScrollerRect.
Size.
X = ScrollBackRect.
Size.
X;
255 NewScrollerRect.
Size.
Y = ScrollBackRect.
Size.
Y * Size;
284 Rect NewScrollerRect;
285 NewScrollerRect.
Size.
X = ScrollBackRect.
Size.
X;
286 NewScrollerRect.
Size.
Y = ScrollBackRect.
Size.
Y * ScrollSize;
337 if( ContainerYSize > 0 ) {
339 return ( Ret > 1 ? Ret : 1 );
428 Rect NewScrollerRect;
429 NewScrollerRect.
Size = OldScrollerRect.
Size;
434 NewScrollerRect.
Position.
Y = std::min(NewScrollerRect.
Position.
Y,this->GetUpperScrollLimit() - OldScrollerRect.
Size.
Y);
435 NewScrollerRect.
Position.
Y = std::max(NewScrollerRect.
Position.
Y,this->GetLowerScrollLimit());
440 if( OldScrollerValue != NewScrollerValue ) {
454 Rect NewScrollerRect;
455 NewScrollerRect.
Size = OldScrollerRect.
Size;
461 NewScrollerRect.
Position.
Y = std::min(NewScrollerRect.
Position.
Y,this->GetUpperScrollLimit() - OldScrollerRect.
Size.
Y);
462 NewScrollerRect.
Position.
Y = std::max(NewScrollerRect.
Position.
Y,this->GetLowerScrollLimit());
467 if( OldScrollerValue != NewScrollerValue ) {
475 Rect NewScrollerRect;
476 NewScrollerRect.
Size = OldScrollerRect.
Size;
482 NewScrollerRect.
Position.
Y = std::min(NewScrollerRect.
Position.
Y,this->GetUpperScrollLimit() - OldScrollerRect.
Size.
Y);
483 NewScrollerRect.
Position.
Y = std::max(NewScrollerRect.
Position.
Y,this->GetLowerScrollLimit());
488 if( OldScrollerValue != NewScrollerValue ) {
504 Rect NewScrollerRect(OldScrollerRect);
507 if( HitPosition.
X < 0.0 || HitPosition.
Y < 0.0 )
510 if( HitPosition.
Y < OldScrollerRect.
Position.
Y ) {
514 }
else if( HitPosition.
Y > OldScrollerRect.
Position.
Y + OldScrollerRect.
Size.
Y ) {
523 if( OldScrollerValue != NewScrollerValue ) {
537 Rect NewScrollerRect;
538 NewScrollerRect.
Size = OldScrollerRect.
Size;
544 NewScrollerRect.
Position.
Y = std::min(NewScrollerRect.
Position.
Y,this->GetUpperScrollLimit() - OldScrollerRect.
Size.
Y);
545 NewScrollerRect.
Position.
Y = std::max(NewScrollerRect.
Position.
Y,this->GetLowerScrollLimit());
550 if( OldScrollerValue != NewScrollerValue ) {
558 Rect NewScrollerRect;
559 NewScrollerRect.
Size = OldScrollerRect.
Size;
565 NewScrollerRect.
Position.
Y = std::min(NewScrollerRect.
Position.
Y,this->GetUpperScrollLimit() - OldScrollerRect.
Size.
Y);
566 NewScrollerRect.
Position.
Y = std::max(NewScrollerRect.
Position.
Y,this->GetLowerScrollLimit());
571 if( OldScrollerValue != NewScrollerValue ) {
618 NameValuePairMap::const_iterator ParamIt;
619 ParamIt = Params.find(
"ScrollbarStyle");
620 if( ParamIt != Params.end() )
630 NameValuePairMap::const_iterator ParamIt;
631 ParamIt = Params.find(
"ScrollbarStyle");
632 if( ParamIt != Params.end() )
virtual void ProtoSerializeChildQuads(XML::Node &SelfRoot) const
Convert the child quads of this class to an XML::Node ready for serialization.
virtual Rect GetRect() const
Gets this QuadRenderables' Rect.
bool Boole
Generally acts a single bit, true or false.
virtual void _MarkAllLayersDirty()
Tells this QuadRenderable that all of it's layers are dirty.
Vector2 Size
Vector2 representing the width and height of the rect.
Anchors to the bottom side of the quad.
This is a specialization of a layout strategy where a group of quads are sized and placed in a linear...
Unified dimensions are ignored and will instead us all available space.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
int Integer
A datatype used to represent any integer close to.
This class represents a box shaped area on the screen.
ScrollbarStyle
Used by the scrollbar class to determine what styling should be used for the scrollbar.
PagedContainer * Container
A pointer to the PagedContainer this scrollbar is providing page data for.
virtual Widget * GetChild(const UInt16 Zorder) const
Gets a child by it's ZOrder.
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...
Resizing will use the provided unified dimensions with no further alterations. This is the default fo...
virtual void RemoveChild(Widget *ToBeRemoved)
Removes a child Widget from this quadrenderable.
The calculated value for the perpendicular axis will be used as the final value for this axis...
Real Y
Coordinate on the Y vector.
virtual void DestroyWidget(Widget *ToBeDestroyed)
Destroys a widget.
A light-weight handle for manipulating nodes in DOM tree.
Real X
Coordinate on the X vector.
virtual const Vector2 & GetWorkAreaSize() const
Gets the size of this containers work area.
virtual void SetManualTransformUpdates(Boole Enable)
Sets whether or not this quad has specific behaviors for it's transform updates and they should not b...
This is used to represent a point on a 2 dimentional area, such as a screen.
virtual void SetHorizontalSizingRules(const Whole Rules)
Sets the behavior this quad will have on the X axis when it is resized.
virtual void UnbindProvider(PageProvider *Prov)
Unbinds a provider being used by this container.
virtual Vector2 GetActualSize() const
Gets the pixel size of this widget.
virtual void Layout(const Rect &OldSelfRect, const Rect &NewSelfRect, const ChildContainer &ChildQuads)
Updates the dimensions of a collection of QuadRenderables.
String Name
The unique name of this Renderable.
Thrown when the available information should have worked but failed for unknown reasons.
Uses the its own updated size as the offset for the new transform, and applies the Unified Dim of the...
virtual void AddChild(Widget *Child)
Adds a Widget to this as a child of this quad.
virtual void _SetLayoutStrat(LayoutStrategy *ToSet)
Sets a new LayoutStrategy for this quad to use.
virtual Button * CreateButton(const String &RendName)
Creates a Button.
The bulk of the engine components go in this namspace.
virtual void SetVerticalSizingRules(const Whole Rules)
Sets the behavior this quad will have on the Y axis when it is resized.
virtual Whole GetNumChildren() const
Gets the number of children in this QuadRenderable.
virtual Vector2 GetActualPosition() const
Gets the pixel position of this widget.
This class represents a point in 2D space using UnifiedDim's.
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
virtual void SetVerticalPositioningRules(const Whole Rules)
Sets the behavior this quad will have when it is positioned automatically on the Y axis...
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...
virtual void ProtoDeSerializeChildQuads(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the ChildQuads of this object with it...
This class is a helper class for creating UI's. It is responsible for storing and keeping track of al...
Anchors to the top side of the quad.
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.
Screen * ParentScreen
A pointer to the Screen that created this Renderable.