Back to index

extremetuxracer  0.5beta
Public Member Functions | Private Member Functions | Private Attributes
pp::Alignment Class Reference

A class for storing the alignment of an UI widget. More...

#include <alignment.h>

List of all members.

Public Member Functions

 Alignment (float horizontal=0.0f, float vertical=0.0f)
void left ()
void right ()
 horizontal align left
void center ()
 horizontal align right
void bottom ()
 horizontal allign center
void top ()
 vertical align bottom
void middle ()
 vertical align top
void setHorizontal (float horizontal)
 vertical align middle
void setVertical (float vertical)
void set (float horizontal, float vertical)
pp::Vec2d alignPosition (const pp::Vec2d &position, const pp::Vec2d &size) const

Private Member Functions

void checkHorizontal ()
 ensure 0.0f <= m_horizontal <= 1.0f
void checkVertical ()
 ensure 0.0f <= m_vertical <= 1.0f

Private Attributes

float m_horizontal
float m_vertical

Detailed Description

A class for storing the alignment of an UI widget.

Definition at line 27 of file alignment.h.


Constructor & Destructor Documentation

pp::Alignment::Alignment ( float  horizontal = 0.0f,
float  vertical = 0.0f 
)

Definition at line 23 of file alignment.cpp.

 : m_horizontal(horizontal),
   m_vertical(vertical)
{      
       checkHorizontal();
       checkVertical();
}

Here is the call graph for this function:


Member Function Documentation

pp::Vec2d pp::Alignment::alignPosition ( const pp::Vec2d position,
const pp::Vec2d size 
) const

Definition at line 73 of file alignment.cpp.

{
       return pp::Vec2d(
              position.x - (m_horizontal*size.x),
              position.y - (m_vertical*size.y)   
       );     
}

Here is the caller graph for this function:

void pp::Alignment::bottom ( ) [inline]

horizontal allign center

Definition at line 45 of file alignment.h.

{ m_vertical=0.0f; };   
void pp::Alignment::center ( ) [inline]

horizontal align right

Definition at line 44 of file alignment.h.

{ m_horizontal=0.5f; }; 

Here is the caller graph for this function:

void pp::Alignment::checkHorizontal ( ) [private]

ensure 0.0f <= m_horizontal <= 1.0f

Definition at line 32 of file alignment.cpp.

{
       if(m_horizontal>1.0f){
              m_horizontal = 1.0f;
       }else if(m_horizontal<0.0f){
              m_horizontal = 0.0f;
       }             
}

Here is the caller graph for this function:

void pp::Alignment::checkVertical ( ) [private]

ensure 0.0f <= m_vertical <= 1.0f

Definition at line 42 of file alignment.cpp.

{
       if(m_vertical>1.0f){
              m_vertical = 1.0f;
       }else if(m_vertical<0.0f){
              m_vertical = 0.0f;
       }
}

Here is the caller graph for this function:

void pp::Alignment::left ( ) [inline]

Definition at line 42 of file alignment.h.

{ m_horizontal=0.0f; }; 
void pp::Alignment::middle ( ) [inline]

vertical align top

Definition at line 47 of file alignment.h.

{ m_vertical=0.5f; };       

Here is the caller graph for this function:

void pp::Alignment::right ( ) [inline]

horizontal align left

Definition at line 43 of file alignment.h.

{ m_horizontal=1.0f; }; 
void pp::Alignment::set ( float  horizontal,
float  vertical 
)

Definition at line 66 of file alignment.cpp.

{
       setHorizontal(horizontal);
       setVertical(vertical);      
}      

Here is the call graph for this function:

void pp::Alignment::setHorizontal ( float  horizontal)

vertical align middle

Definition at line 52 of file alignment.cpp.

{
       m_horizontal = horizontal;
       checkHorizontal();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void pp::Alignment::setVertical ( float  vertical)

Definition at line 59 of file alignment.cpp.

{
       m_vertical = vertical;
       checkVertical();     
}

Here is the call graph for this function:

Here is the caller graph for this function:

void pp::Alignment::top ( ) [inline]

vertical align bottom

Definition at line 46 of file alignment.h.

{ m_vertical=1.0f; };   

Here is the caller graph for this function:


Member Data Documentation

float pp::Alignment::m_horizontal [private]

Definition at line 30 of file alignment.h.

float pp::Alignment::m_vertical [private]

Definition at line 31 of file alignment.h.


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