Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Rect Class Reference

#include <guidefs.h>

Public Member Functions

float left (void) const
 
float right (void) const
 
float bottom (void) const
 
float top (void) const
 
Point center (void) const
 
bool inside (const Point &p) const
 
void inset (const Size &s)
 
Rect copyAndInset (const Size s)
 
bool operator== (const Rect &other)
 
bool operator!= (const Rect &other)
 
 Rect ()
 
 Rect (Point &p, Size &s)
 
 Rect (float x, float y, float width, float height)
 

Public Attributes

Point origin
 
Size size
 

Detailed Description

Definition at line 76 of file guidefs.h.

Constructor & Destructor Documentation

Rect::Rect ( )
inline

Definition at line 140 of file guidefs.h.

140 {}
Rect::Rect ( Point p,
Size s 
)
inline

Definition at line 141 of file guidefs.h.

141  :
142  origin( p )
143  , size( s )
144  {}
Rect::Rect ( float  x,
float  y,
float  width,
float  height 
)
inline

Definition at line 145 of file guidefs.h.

145  :
146  origin( x, y )
147  , size( width, height )
148  {}

Member Function Documentation

float Rect::bottom ( void  ) const
inline

Definition at line 91 of file guidefs.h.

References origin, and Point::y.

Referenced by GuiTexture::draw(), drawRect(), drawRectOutline(), and inside().

92  {
93  return origin.y;
94  }
Point Rect::center ( void  ) const
inline

Definition at line 101 of file guidefs.h.

References Size::height, origin, size, Size::width, Point::x, and Point::y.

Referenced by ScrollerButton::draw().

102  {
103  return Point( origin.x+size.width/2, origin.y+size.height/2 );
104  }
Rect Rect::copyAndInset ( const Size  s)
inline

Definition at line 122 of file guidefs.h.

References inset().

Referenced by Scroller::calcLayout(), Slider::processMouseDrag(), and StaticDisplay::setPaintTextRect().

123  {
124  Rect result = *this;
125  result.inset( s );
126  return result;
127  }
void Rect::inset ( const Size s)
inline

Definition at line 113 of file guidefs.h.

References Size::height, origin, size, Size::width, Point::x, and Point::y.

Referenced by copyAndInset(), Slider::draw(), and Picker::draw().

114  {
115  origin.x += s.width;
116  origin.y += s.height;
117  size.width -= s.width*2;
118  size.height -= s.height*2;
119  }
bool Rect::inside ( const Point p) const
inline

Definition at line 107 of file guidefs.h.

References bottom(), left(), right(), top(), Point::x, and Point::y.

Referenced by Picker::cellForMouse(), and Slider::processMouseDrag().

108  {
109  return p.x >= left() && p.x < right() && p.y >= bottom() && p.y < top();
110  }
float Rect::left ( void  ) const
inline

Definition at line 83 of file guidefs.h.

References origin, and Point::x.

Referenced by GuiTexture::draw(), drawRect(), drawRectOutline(), and inside().

84  {
85  return origin.x;
86  }
bool Rect::operator!= ( const Rect other)
inline

Definition at line 134 of file guidefs.h.

135  {
136  return !(*this == other);
137  }
bool Rect::operator== ( const Rect other)
inline

Definition at line 130 of file guidefs.h.

References origin, and size.

131  {
132  return origin == other.origin && size == other.size;
133  }
float Rect::right ( void  ) const
inline

Definition at line 87 of file guidefs.h.

References origin, size, Size::width, and Point::x.

Referenced by Scroller::calcLayout(), GuiTexture::draw(), drawRect(), drawRectOutline(), inside(), and Slider::processMouseDown().

88  {
89  return origin.x+size.width;
90  }
float Rect::top ( void  ) const
inline

Member Data Documentation


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