MezzanineEngine March 18, 2012

Mezzanine::UI::Rectangle Class Reference

This class is a helper class, specifically for use with background sprites and colours. More...

#include <uirectangle.h>

Inheritance diagram for Mezzanine::UI::Rectangle:
Mezzanine::UI::BasicRenderable Mezzanine::UI::Button Mezzanine::UI::Caption Mezzanine::UI::MarkupText Mezzanine::UI::TextButton

List of all members.

Public Member Functions

 Rectangle (const RenderableRect &Rect, Layer *PLayer)
 Class constructor.
virtual ~Rectangle ()
 Class destructor.
virtual void _AppendVertices (ScreenVertexData &Vertices)
virtual void _Redraw ()
virtual bool CheckMouseHover ()
 Determines whether the mouse is over this renderable.
virtual Vector2 GetActualPosition () const
 Gets the top left position of this renderable in pixels.
virtual Vector2 GetActualSize () const
 Gets the size of this renderable in pixels.
virtual ColourValue GetBackgroundColour (const UI::QuadCorner &Corner) const
 Gets the colour of a corner of this renderable.
virtual ColourValue GetBorderColour (const UI::Border &Side) const
 Gets the colour of a border on this renderable.
virtual Real GetBorderWidth () const
 Gets the border width of this renderable.
virtual bool GetMouseHover ()
 Gets the stored value of whether or not the mouse is over the renderable.
virtual Vector2 GetPosition () const
 Gets the relative top left position of this renderable.
virtual Vector2 GetRotationCenter () const
 Gets the current set rotation point.
virtual Real GetRotationDegrees () const
 Gets the current rotation applied to this renderable in degrees.
virtual Real GetRotationRadians () const
 Gets the current rotation applied to this renderable in radians.
virtual Vector2 GetSize () const
 Gets the relative size of this renderable.
virtual void NoBorder ()
 Disables any border set on this renderable if one is currently set.
virtual void SetActualPosition (const Vector2 &Position)
 Sets the top left position of this renderable in pixels.
virtual void SetActualSize (const Vector2 &Size)
 Sets the size of this renderable in pixels.
virtual void SetBackgroundColour (const ColourValue &Colour)
 Sets the background colour of the renderable.
virtual void SetBackgroundColour (const UI::QuadCorner &Corner, const ColourValue &Colour)
 Sets the background colour for one corner the renderable.
virtual void SetBackgroundGradient (const UI::Gradient &Grad, const ColourValue &ColourA, const ColourValue &ColourB)
 Sets a colour gradient to be applied to this renderable.
virtual void SetBackgroundSprite (const String &SpriteName)
 Sets the background image(if provided in the atlas) of the renderable.
virtual void SetBackgroundSprite (Sprite *PSprite)
 Sets the background image(if provided in the atlas) of the renderable.
virtual void SetBackgroundSprite (const String &SpriteName, const String &Atlas)
 Sets the background image(if provided in the atlas) of the renderable.
virtual void SetBorder (const Real &Width, const ColourValue &North, const ColourValue &South, const ColourValue &East, const ColourValue &West)
 Sets all parameters for enabling a border.
virtual void SetBorder (const Real &Width, const ColourValue &Colour)
 Sets all parameters for enabling a border.
virtual void SetBorderColour (const UI::Border &Side, const ColourValue &Colour)
 Sets the colour of one side of the border for this renderable.
virtual void SetBorderColour (const ColourValue &Colour)
 Sets the colour of the border for this renderable.
virtual void SetBorderWidth (const Real &Width)
 Sets the width of the border for this renderable.
virtual void SetPosition (const Vector2 &Position)
 Sets the relative top left position of this renderable.
virtual void SetRotationCenter (bool Custom, const Vector2 &Center=Vector2())
 Sets the point around which this renderable should rotate.
virtual void SetRotationDegrees (const Real &Degrees)
 Sets the rotation to be applied to this renderable.
virtual void SetRotationRadians (const Real &Radians)
 Sets the rotation to be applied to this renderable.
virtual void SetSize (const Vector2 &Size)
 Sets the relative size of this renderable.
virtual void UpdateDimensions ()
 Updates the dimensions of this renderable to match those of the new screen size.

Protected Member Functions

 Rectangle (const String &name, const RenderableRect &Rect, Layer *PLayer)
 Inheritance constructor.
virtual void ConstructRectangle (const UI::RenderableRect &Rect)
 Builds the rectangle.
virtual void DrawBorder (const Vector2 &TopLeft, const Vector2 &TopRight, const Vector2 &BottomLeft, const Vector2 &BottomRight, const Vector2 &OuterTopLeft, const Vector2 &OuterTopRight, const Vector2 &OuterBottomLeft, const Vector2 &OuterBottomRight)
 Draws the border, if any is set.
virtual void DrawFill (const Vector2 &TopLeft, const Vector2 &TopRight, const Vector2 &BottomLeft, const Vector2 &BottomRight)
 Draws the main rectangle.
virtual void RotationTransform (Vector2 &TopLeft, Vector2 &TopRight, Vector2 &BottomLeft, Vector2 &BottomRight)
 Transforms coordinates to be used in rendering.
virtual void SetHovered (bool Hovered)
 Sets the hovered state of this renderable.
virtual void SetSprite (Sprite *PSprite)
 Sets all the sprite meta-data of this class to render a specific sprite.

Protected Attributes

Vector2 ActPosition
Vector2 ActSize
ColourValue BackgroundColours [4]
ColourValue BorderColours [4]
Real BorderWidth
bool CustomCenter
bool MouseHover
Vector2 RelPosition
Vector2 RelSize
Real RotAngle
Vector2 RotCenter
Vector2 UVs [4]

Detailed Description

This class is a helper class, specifically for use with background sprites and colours.

Unlike a button, this class cannot be interacted with by clicking. It is important to understand what you want your space to do when selecting the class to use.

Definition at line 62 of file uirectangle.h.


Constructor & Destructor Documentation

Mezzanine::UI::Rectangle::Rectangle ( const String name,
const RenderableRect Rect,
Layer PLayer 
) [protected]

Inheritance constructor.

Parameters:
nameThe name to be given to this renderable.
RectThe Rect representing the position and size of the rectangle.
LayerPointer to the parent Layer that created this rectangle.

Definition at line 67 of file uirectangle.cpp.

Mezzanine::UI::Rectangle::Rectangle ( const RenderableRect Rect,
Layer PLayer 
)

Class constructor.

Parameters:
RectThe Rect representing the position and size of the rectangle.
LayerPointer to the parent Layer that created this rectangle.

Definition at line 57 of file uirectangle.cpp.


Member Function Documentation

void Mezzanine::UI::Rectangle::_AppendVertices ( ScreenVertexData Vertices) [virtual]

Appends the vertices of this renderable to another vector.

Parameters:
VerticesThe vector of vertex's to append to.

Implements Mezzanine::UI::BasicRenderable.

Definition at line 570 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::_Redraw ( ) [virtual]

Regenerates the verticies in this renderable.

Implements Mezzanine::UI::BasicRenderable.

Reimplemented in Mezzanine::UI::Caption, Mezzanine::UI::MarkupText, and Mezzanine::UI::TextButton.

Definition at line 471 of file uirectangle.cpp.

bool Mezzanine::UI::Rectangle::CheckMouseHover ( ) [virtual]

Determines whether the mouse is over this renderable.

Returns:
Returns a bool indicating whether the mouse is over this renderable.

Definition at line 229 of file uirectangle.cpp.

Vector2 Mezzanine::UI::Rectangle::GetActualPosition ( ) const [virtual]

Gets the top left position of this renderable in pixels.

Returns:
Returns a Vector2 representing the location of this renderable.

Definition at line 433 of file uirectangle.cpp.

Vector2 Mezzanine::UI::Rectangle::GetActualSize ( ) const [virtual]

Gets the size of this renderable in pixels.

Returns:
Returns a vector2 representing the size of this renderable.

Definition at line 459 of file uirectangle.cpp.

ColourValue Mezzanine::UI::Rectangle::GetBackgroundColour ( const UI::QuadCorner Corner) const [virtual]

Gets the colour of a corner of this renderable.

Parameters:
CornerThe corner to get the colour for.
Returns:
Returns the colour of the specified corner.

Definition at line 321 of file uirectangle.cpp.

ColourValue Mezzanine::UI::Rectangle::GetBorderColour ( const UI::Border Side) const [virtual]

Gets the colour of a border on this renderable.

Parameters:
SideThe side to retrieve the colour for.
Returns:
Returns the colour of the border on the specified side.

Definition at line 373 of file uirectangle.cpp.

Real Mezzanine::UI::Rectangle::GetBorderWidth ( ) const [virtual]

Gets the border width of this renderable.

Returns:
Returns a Real with the currently set width of the border.

Definition at line 368 of file uirectangle.cpp.

bool Mezzanine::UI::Rectangle::GetMouseHover ( ) [virtual]

Gets the stored value of whether or not the mouse is over the renderable.

This function does not perform any checks. If you want to do a manual check, call CheckMouseHover().

Returns:
Returns the stored value of whether or not the mouse is over the renderable.

Definition at line 241 of file uirectangle.cpp.

Vector2 Mezzanine::UI::Rectangle::GetPosition ( ) const [virtual]

Gets the relative top left position of this renderable.

Returns:
Returns a Vector2 representing the location of this renderable.

Definition at line 420 of file uirectangle.cpp.

Vector2 Mezzanine::UI::Rectangle::GetRotationCenter ( ) const [virtual]

Gets the current set rotation point.

Returns:
Returns a vector 2 with the point around which this renderable rotates in screen space.

Definition at line 407 of file uirectangle.cpp.

Real Mezzanine::UI::Rectangle::GetRotationDegrees ( ) const [virtual]

Gets the current rotation applied to this renderable in degrees.

Returns:
Returns a Real with the current rotation.

Definition at line 390 of file uirectangle.cpp.

Real Mezzanine::UI::Rectangle::GetRotationRadians ( ) const [virtual]

Gets the current rotation applied to this renderable in radians.

Returns:
Returns a Real with the current rotation.

Definition at line 395 of file uirectangle.cpp.

Vector2 Mezzanine::UI::Rectangle::GetSize ( ) const [virtual]

Gets the relative size of this renderable.

Returns:
Returns a vector2 representing the size of this renderable.

Definition at line 446 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetActualPosition ( const Vector2 Position) [virtual]

Sets the top left position of this renderable in pixels.

Parameters:
PositionA Vector2 representing the location of this renderable.

Definition at line 425 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetActualSize ( const Vector2 Size) [virtual]

Sets the size of this renderable in pixels.

Parameters:
SizeA vector2 representing the size of this renderable.

Definition at line 451 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetBackgroundColour ( const ColourValue Colour) [virtual]

Sets the background colour of the renderable.

Parameters:
ColourA colour value representing the colour to be set.

Definition at line 246 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetBackgroundColour ( const UI::QuadCorner Corner,
const ColourValue Colour 
) [virtual]

Sets the background colour for one corner the renderable.

Parameters:
CornerWhich corner the colour should be applied to.
ColourA colour value representing the colour to be set.

Definition at line 255 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetBackgroundGradient ( const UI::Gradient Grad,
const ColourValue ColourA,
const ColourValue ColourB 
) [virtual]

Sets a colour gradient to be applied to this renderable.

Parameters:
GradThe direction/style of gradient to enable.
ColourAThe colour to apply to the first side of the gradient.
ColourBThe colour to apply to the second side of the gradient.

Definition at line 278 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetBackgroundSprite ( Sprite PSprite) [virtual]

Sets the background image(if provided in the atlas) of the renderable.

Parameters:
PSpriteA pointer to the sprite to set as the background.

Reimplemented in Mezzanine::UI::Button.

Definition at line 261 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetBackgroundSprite ( const String SpriteName) [virtual]

Sets the background image(if provided in the atlas) of the renderable.

Parameters:
SpriteNameThe name of the sprite to set as the background.

Reimplemented in Mezzanine::UI::Button.

Definition at line 266 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetBackgroundSprite ( const String SpriteName,
const String Atlas 
) [virtual]

Sets the background image(if provided in the atlas) of the renderable.

Parameters:
SpriteNameThe name of the sprite to set as the background.
AtlasThe Atlas to load the sprite from.

Reimplemented in Mezzanine::UI::Button.

Definition at line 272 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetBorder ( const Real Width,
const ColourValue Colour 
) [virtual]

Sets all parameters for enabling a border.

Parameters:
WidthThe width to set for the border.
ColourThe colour to be applied to all sides of the border.

Definition at line 347 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetBorder ( const Real Width,
const ColourValue North,
const ColourValue South,
const ColourValue East,
const ColourValue West 
) [virtual]

Sets all parameters for enabling a border.

Parameters:
WidthThe width to set for the border.
NorthThe colour to apply to the north side of the border.
SouthThe colour to apply to the south side of the border.
EastThe colour to apply to the east side of the border.
WestThe colour to apply to the west side of the border.

Definition at line 353 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetBorderColour ( const ColourValue Colour) [virtual]

Sets the colour of the border for this renderable.

Parameters:
ColourThe colour to set for the border.

Definition at line 332 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetBorderColour ( const UI::Border Side,
const ColourValue Colour 
) [virtual]

Sets the colour of one side of the border for this renderable.

Parameters:
SideThe side to have the colour applied to.
ColourThe colour to be applied.

Definition at line 341 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetBorderWidth ( const Real Width) [virtual]

Sets the width of the border for this renderable.

Parameters:
WidthThe width to set for the border.

Definition at line 326 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetPosition ( const Vector2 Position) [virtual]

Sets the relative top left position of this renderable.

Parameters:
PositionA Vector2 representing the location of this renderable.

Definition at line 412 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetRotationCenter ( bool  Custom,
const Vector2 Center = Vector2() 
) [virtual]

Sets the point around which this renderable should rotate.

Remarks:
By default, when rotating a renderable it will rotate around the center of it's quad. Using this however you can rotate it around any point in screen space. When disabling this feature, you can simple pass in "false" as the only arguement.
Parameters:
CustomWhether to enable or disable a custom rotation point.
CenterThe point in screen space where this renderable should rotate around.

Definition at line 400 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetRotationDegrees ( const Real Degrees) [virtual]

Sets the rotation to be applied to this renderable.

Parameters:
DegreesThe angle of rotation in degrees.

Definition at line 378 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetRotationRadians ( const Real Radians) [virtual]

Sets the rotation to be applied to this renderable.

Parameters:
RadiansThe angle of rotation in radians.

Definition at line 384 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::SetSize ( const Vector2 Size) [virtual]

Sets the relative size of this renderable.

Parameters:
SizeA vector2 representing the size of this renderable.

Definition at line 438 of file uirectangle.cpp.

void Mezzanine::UI::Rectangle::UpdateDimensions ( ) [virtual]

Updates the dimensions of this renderable to match those of the new screen size.

This function is called automatically when a viewport changes in size, and shouldn't need to be called manually.

Implements Mezzanine::UI::BasicRenderable.

Reimplemented in Mezzanine::UI::Caption, Mezzanine::UI::MarkupText, and Mezzanine::UI::TextButton.

Definition at line 464 of file uirectangle.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines