Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

PG_Rect Class Reference

Inheritance diagram for PG_Rect:

Inheritance graph
[legend]
Collaboration diagram for PG_Rect:

Collaboration graph
[legend]
List of all members.

Detailed Description

Encapsulation of the SDL_Rect structure.

Author:
Alexander Pipelka
Examples:

paratest.cpp, and sigc.cpp.


Public Member Functions

 PG_Rect (Sint16 x, Sint16 y, Uint16 w, Uint16 h)
 Create a new PG_Rect object with give values.

 PG_Rect ()
 Create an empty PG_Rect object Initializes the created PG_Rect object with x=y=w=h=0.

 PG_Rect (const PG_Rect &src)
 Create a new PG_Rect from a reference.

 PG_Rect (const SDL_Rect &src)
 Create a new PG_Rect from a SDL_Rect structure.

virtual ~PG_Rect ()
void SetRect (Sint16 nx, Sint16 ny, Uint16 nw, Uint16 nh)
 Set the position of the rectangle.

PG_Rectoperator= (const SDL_Rect &src)
PG_Rectoperator= (const PG_Rect &src)
PG_Rect operator/ (PG_Rect &b)
bool operator== (const PG_Rect &r) const
bool operator!= (const PG_Rect &r) const
bool IsInside (const PG_Point &p)
 Check if a given point is inside a rectangle (boxtest).

PG_Rect IntersectRect (const PG_Rect &p) const
 Intersect two rectangles.

Uint16 Width ()
 Return the width of the rectangle.

Uint16 Width () const
Uint16 Height ()
 Return the height of the rectangle.

Uint16 Height () const
bool IsNull ()
bool OverlapRect (const PG_Rect &p, const PG_Rect &c) const
 Check if two rectangles overlap.

bool OverlapRect (const PG_Rect &p) const
 Check if this rectangle overlap another one.

bool OverlapRect (PG_Rect *p)
 Check if this rectangle overlap another one.

PG_Widgetnext ()
 Get the next Rectangle from the list Moves to the next rectangle in the list.

PG_Widgetprev ()
 Get the previous Rectangle from the list Moves to the previous rectangle in the list.


Static Public Member Functions

bool IsInside (const PG_Point &p, PG_Rect &r)
 Check if a given point is inside a rectangle (boxtest).

PG_Rect IntersectRect (const PG_Rect &p, const PG_Rect &c)
 Intersect two rectangles.


Public Attributes

Sint16 & my_xpos
Sint16 & my_ypos
Uint16 & my_width
Uint16 & my_height
Uint32 index

Static Public Attributes

PG_Rect null

Protected Attributes

PG_Widgetmy_next
PG_Widgetmy_prev

Friends

class PG_RectList


Constructor & Destructor Documentation

PG_Rect::PG_Rect Sint16  x,
Sint16  y,
Uint16  w,
Uint16  h
 

Create a new PG_Rect object with give values.

Parameters:
x x-startposition
y y-startposition
w width
h height
Initializes the created PG_Rect object with x/y postions and width/height

PG_Rect::PG_Rect  ) 
 

Create an empty PG_Rect object Initializes the created PG_Rect object with x=y=w=h=0.

Examples:
paratest.cpp.

PG_Rect::PG_Rect const PG_Rect src  ) 
 

Create a new PG_Rect from a reference.

Parameters:
src reference rectangle
Initializes the created PG_Rect object with the position of the reference rectangle

PG_Rect::PG_Rect const SDL_Rect &  src  ) 
 

Create a new PG_Rect from a SDL_Rect structure.

Parameters:
src source SDL_Rect structure
Initializes the created PG_Rect object with the position of the SDL_Rect structure

virtual PG_Rect::~PG_Rect  )  [virtual]
 


Member Function Documentation

Uint16 PG_Rect::Height  )  const [inline]
 

Reimplemented in PG_PopupMenu::MenuItem.

Uint16 PG_Rect::Height  )  [inline]
 

Return the height of the rectangle.

Returns:
height

PG_Rect PG_Rect::IntersectRect const PG_Rect p  )  const
 

Intersect two rectangles.

Parameters:
p rectangle to intersect with
Returns:
resulting intersection rectangle

PG_Rect PG_Rect::IntersectRect const PG_Rect p,
const PG_Rect c
[static]
 

Intersect two rectangles.

Parameters:
p reference rectangle
c rectangle to intersect with reference
Returns:
resulting intersection rectangle

bool PG_Rect::IsInside const PG_Point p  )  [inline]
 

Check if a given point is inside a rectangle (boxtest).

Parameters:
p the point to test
Returns:
true if the point is inside the rectangle

bool PG_Rect::IsInside const PG_Point p,
PG_Rect r
[inline, static]
 

Check if a given point is inside a rectangle (boxtest).

Parameters:
p the point to test
r the rectangle the point should be inside
Returns:
true if the point is inside the rectangle

bool PG_Rect::IsNull  )  [inline]
 

PG_Widget* PG_Rect::next  )  [inline]
 

Get the next Rectangle from the list Moves to the next rectangle in the list.

Examples:
paratest.cpp.

bool PG_Rect::operator!= const PG_Rect r  )  const [inline]
 

PG_Rect PG_Rect::operator/ PG_Rect b  ) 
 

PG_Rect& PG_Rect::operator= const PG_Rect src  ) 
 

PG_Rect& PG_Rect::operator= const SDL_Rect &  src  ) 
 

bool PG_Rect::operator== const PG_Rect r  )  const [inline]
 

bool PG_Rect::OverlapRect PG_Rect p  )  [inline]
 

Check if this rectangle overlap another one.

Parameters:
p pointer to rectangle to check for overlap
Returns:
true if this rectangle an p overlap, false otherwise

bool PG_Rect::OverlapRect const PG_Rect p  )  const [inline]
 

Check if this rectangle overlap another one.

Parameters:
p rectangle to check for overlap
Returns:
true if this rectangle an p overlap, false otherwise

bool PG_Rect::OverlapRect const PG_Rect p,
const PG_Rect c
const [inline]
 

Check if two rectangles overlap.

Parameters:
p,c rectangles to check for overlap
Returns:
true if the rectangles overlap, false otherwise

PG_Widget* PG_Rect::prev  )  [inline]
 

Get the previous Rectangle from the list Moves to the previous rectangle in the list.

void PG_Rect::SetRect Sint16  nx,
Sint16  ny,
Uint16  nw,
Uint16  nh
[inline]
 

Set the position of the rectangle.

Parameters:
nx x-startposition
ny y-startposition
nw width
nh height Moves the rectangle to the given values

Uint16 PG_Rect::Width  )  const [inline]
 

Reimplemented in PG_PopupMenu::MenuItem.

Uint16 PG_Rect::Width  )  [inline]
 

Return the width of the rectangle.

Returns:
width


Friends And Related Function Documentation

friend class PG_RectList [friend]
 


Member Data Documentation

Uint32 PG_Rect::index
 

Uint16& PG_Rect::my_height
 

PG_Widget* PG_Rect::my_next [protected]
 

PG_Widget* PG_Rect::my_prev [protected]
 

Uint16& PG_Rect::my_width
 

Sint16& PG_Rect::my_xpos
 

Sint16& PG_Rect::my_ypos
 

PG_Rect PG_Rect::null [static]
 



The ParaGUI Project - Alexander Pipelka