Midnight Blue Game and Engine
Public Member Functions | Protected Member Functions | Properties | List of all members
MB2D.UI.UIElement Class Referenceabstract

Defines a UI object that can be contained within Views and Layouts, drawn, updated, and moved about More...

Inheritance diagram for MB2D.UI.UIElement:
Inheritance graph
Collaboration diagram for MB2D.UI.UIElement:
Collaboration graph

Public Member Functions

void SetRelativeSize (UIContent parent, Point at, Point span)
 Sets the size of the element relative to its parent More...
 
void SetRelativeSize (UIContent parent, int atRow, int atCol, int rowSpan, int colSpan)
 Sets the size of the element relative to its parent More...
 
virtual void Draw (SpriteBatch spriteBatch)
 Draws the element to the window. Overriden in derived classes More...
 
abstract void Update ()
 Update the elements state and handles input. Overriden in derived classes More...
 

Protected Member Functions

 UIElement (int rows, int cols)
 Initializes a new instance of the T:MB2D.UI.UIElement class. Sets default property values More...
 
void DrawBorder (SpriteBatch spriteBatch)
 Draws the elements border to the window. Skips sides that have color set to Color.Transparent More...
 

Properties

UIContent Content [get]
 Gets the UIContent of the element, only available in container elements More...
 
Vector2 Size [get]
 Gets the column and row count of the element More...
 
Rectangle BoundingBox [get]
 Gets the bounding box of this element More...
 
bool Fill [get, set]
 Gets or sets a value that indicates the element should be stretched or shrunk to fill its parents bounds exactly More...
 
Color BackgroundColor [get, set]
 Gets or sets the color of the elements background. More...
 
string TextContent [get, set]
 Gets or sets the string rendered by the element. More...
 
Color TextColor [get, set]
 Gets or sets the current color of the text. More...
 
SpriteFont Font [get, set]
 Gets or sets the font used in rendering the elements TextContent More...
 
bool BorderDisplayed [get, set]
 Gets or sets a value indicating whether this T:MB2D.UI.UIElement has itsborder displayed. More...
 
int BorderWidth [get, set]
 Gets or sets the width of the border. More...
 
Color BorderColor [get, set]
 Gets or sets the color of the border. More...
 
Color BorderTopColor [get, set]
 Gets or sets the color of the border top. More...
 
Color BorderRightColor [get, set]
 Gets or sets the color of the border right. More...
 
Color BorderBottomColor [get, set]
 Gets or sets the color of the border bottom. More...
 
Color BorderLeftColor [get, set]
 Gets or sets the color of the border left. More...
 
string Tag [get, set]
 Gets or sets the tag used to quickly access this element and uniquely identify it. More...
 

Detailed Description

Defines a UI object that can be contained within Views and Layouts, drawn, updated, and moved about

Constructor & Destructor Documentation

§ UIElement()

MB2D.UI.UIElement.UIElement ( int  rows,
int  cols 
)
inlineprotected

Initializes a new instance of the T:MB2D.UI.UIElement class. Sets default property values

Parameters
rowsNumber of rows this element should span - used only be used for container elements
colsNumber of columns this element should span - used only be used for container elements.

Member Function Documentation

§ Draw()

virtual void MB2D.UI.UIElement.Draw ( SpriteBatch  spriteBatch)
inlinevirtual

Draws the element to the window. Overriden in derived classes

Parameters
spriteBatchSprite batch to draw to.

Reimplemented in MB2D.UI.ListControl, MB2D.UI.UIControlElement, MB2D.UI.Layout, and MB2D.UI.Label.

Here is the caller graph for this function:

§ DrawBorder()

void MB2D.UI.UIElement.DrawBorder ( SpriteBatch  spriteBatch)
inlineprotected

Draws the elements border to the window. Skips sides that have color set to Color.Transparent

Parameters
spriteBatchSprite batch to draw the border to.

§ SetRelativeSize() [1/2]

void MB2D.UI.UIElement.SetRelativeSize ( UIContent  parent,
Point  at,
Point  span 
)
inline

Sets the size of the element relative to its parent

Parameters
parentParent content to align to
atPosition element should be set to
spanNumber of columns/rows the element should span.
Here is the caller graph for this function:

§ SetRelativeSize() [2/2]

void MB2D.UI.UIElement.SetRelativeSize ( UIContent  parent,
int  atRow,
int  atCol,
int  rowSpan,
int  colSpan 
)
inline

Sets the size of the element relative to its parent

Parameters
parentParent content to align to
atRowRow position the element should align to.
atColColumn position the element should align to.
rowSpanNumber of rows in the parent the element should span.
colSpanNumber of columns in the parent the element should span.

§ Update()

abstract void MB2D.UI.UIElement.Update ( )
pure virtual

Update the elements state and handles input. Overriden in derived classes

Implemented in MB2D.UI.ListControl, MB2D.UI.UIControlElement, MB2D.UI.Label, MB2D.UI.Button, and MB2D.UI.Layout.

Here is the caller graph for this function:

Property Documentation

§ BackgroundColor

Color MB2D.UI.UIElement.BackgroundColor
getset

Gets or sets the color of the elements background.

The color of the background.

§ BorderBottomColor

Color MB2D.UI.UIElement.BorderBottomColor
getset

Gets or sets the color of the border bottom.

The color of the border bottom.

§ BorderColor

Color MB2D.UI.UIElement.BorderColor
getset

Gets or sets the color of the border.

The color of the border. Resets all border sides' colors to this color.

§ BorderDisplayed

bool MB2D.UI.UIElement.BorderDisplayed
getset

Gets or sets a value indicating whether this T:MB2D.UI.UIElement has itsborder displayed.

true if border should be displayed; otherwise, false.

§ BorderLeftColor

Color MB2D.UI.UIElement.BorderLeftColor
getset

Gets or sets the color of the border left.

The color of the border left.

§ BorderRightColor

Color MB2D.UI.UIElement.BorderRightColor
getset

Gets or sets the color of the border right.

The color of the border right.

§ BorderTopColor

Color MB2D.UI.UIElement.BorderTopColor
getset

Gets or sets the color of the border top.

The color of the border top.

§ BorderWidth

int MB2D.UI.UIElement.BorderWidth
getset

Gets or sets the width of the border.

The width of the border.

§ BoundingBox

Rectangle MB2D.UI.UIElement.BoundingBox
get

Gets the bounding box of this element

The bounding box.

§ Content

UIContent MB2D.UI.UIElement.Content
get

Gets the UIContent of the element, only available in container elements

The content.

§ Fill

bool MB2D.UI.UIElement.Fill
getset

Gets or sets a value that indicates the element should be stretched or shrunk to fill its parents bounds exactly

true if set to fill parent; otherwise, false.

§ Font

SpriteFont MB2D.UI.UIElement.Font
getset

Gets or sets the font used in rendering the elements TextContent

The font.

§ Size

Vector2 MB2D.UI.UIElement.Size
get

Gets the column and row count of the element

The elements grid size.

§ Tag

string MB2D.UI.UIElement.Tag
getset

Gets or sets the tag used to quickly access this element and uniquely identify it.

The tag.

§ TextColor

Color MB2D.UI.UIElement.TextColor
getset

Gets or sets the current color of the text.

The text contents current color value.

§ TextContent

string MB2D.UI.UIElement.TextContent
getset

Gets or sets the string rendered by the element.

The content of the text.


The documentation for this class was generated from the following file: