Humble Framework for SkyOS


Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

HRect Class Reference
[Graphical User Interface]

#include <HGUI.h>

Inheritance diagram for HRect:

HObj

Detailed Description

A thin wrapper around the s_region structure to simplify the creation and usage of rectangles.

Definition at line 245 of file HGUI.h.

Public Member Functions

 HRect (int32 nL, int32 nT, int32 nR, int32 nB)
 HRect (const s_region &rhs)
 HRect (const HPoint &ptTL, const HPoint &ptBR)
ErrCode CenterToScreen (void)
 Centers the given rectangle on the screen.
bool Inflate (int32 nXDelta, int32 nYDelta)
 inflates the rectangle by a given delta
void MoveTo (int32 nX, int32 nY)
 Moves the rectangle to a given location.
void MoveTo (const HPoint &pt)
 moves the rectangle to a given location
void Normalize (void)
 normalizes the rectangle so that its origin is 0,0
void Offset (int32 nXDelta, int32 nYDelta)
 Adjusts the location of a rectangle by a caller-supplied delta.
void Offset (HPoint const &ptDelta)
 Adjusts the location of a rectangle by a caller-supplied delta.
virtual StringPtr ToString (void) const
 Returns the object's value as a human-readble string.
bool Get (s_region &rect) const
 Returns a copy of the s_region structure.
HPoint GetBottomRight (void) const
 Returns the bottom-right corner of the rectangle as a point.
HPoint GetDimensions (void) const
 Returns the rectangle's dimensions.
int32 GetHeight (void) const
 Returns the height of the rectangle, or zero if invalid.
HPoint GetOrigin (void) const
 Returns the rectangle's origin (top-left corner).
HPoint GetTopLeft (void) const
 Returns the top-left corner.
int32 GetWidth (void) const
 Returns the width of the rectangle, or zero if invalid.
bool Set (int32 nL, int32 nT, int32 nR, int32 nB)
bool Set (const HPoint &ptTL, const HPoint &ptBR)
 sets the rectangle to an caller-supplied set of values
void SetEmpty (void)
 Sets the rectangle to an empty rectangle (0, 0, 0, 0).
bool Contains (const HPoint &pt) const
 Evaluates to true if a point lies within the rectangle.
bool IsEmpty (void) const
 Evaluates to true if the rectangle is empty.
bool IsNotEmpty (void) const
 Evaluates to true if the rectangle is NOT empty.
HRectoperator+= (const HRect &rhs)
HRectoperator-= (const HRect &rhs)
bool operator== (const HRect &rhs) const
bool operator!= (const HRect &rhs) const


Member Function Documentation

ErrCode HRect::CenterToScreen void   ) 
 

Modifies the rectangle so that it is centered in the current screen, regardless of the resolution.

Returns:
NO_ERROR on success, error code otherwise

Definition at line 282 of file HGUI.h.

bool HRect::Inflate int32  nXDelta,
int32  nYDelta
 

Adjusts that size of a rectangle by a caller-supplied delta. Passing negative values will cause the rectangle to shrink.

Returns:
true if resulting rectangle is NOT empty
Parameters:
nXDelta Horizontal delta (negative = shrink)
nYDelta Vertical delta (negative = shrink)

Definition at line 309 of file HGUI.h.

void HRect::MoveTo int32  nX,
int32  nY
 

Moves the rectangle so that the top left corner is at a given location, without changing the rectangle's size.

Parameters:
nX desired X coordinate of top left corner
nY desired Y coordinate of top left corner

Definition at line 328 of file HGUI.h.

void HRect::MoveTo const HPoint pt  ) 
 

Moves the rectangle so that the top left corner is at a given location, without changing the rectangle's size.

Parameters:
pt location to move the top left corner to.

Definition at line 339 of file HGUI.h.

void HRect::Normalize void   ) 
 

Normalizes the rectangle by moving the top left corner to (0,0). If necessary, the coordinates are also swapped so that the top left corner is mathematically less than the bottom right corner.

Definition at line 349 of file HGUI.h.

void HRect::Offset int32  nXDelta,
int32  nYDelta
 

Parameters:
nXDelta Horizontal delta (negative = to the left)
nYDelta Vertical delta (negative = upwards)

Definition at line 367 of file HGUI.h.

void HRect::Offset HPoint const &  ptDelta  ) 
 

Parameters:
ptDelta Desired delta

Definition at line 381 of file HGUI.h.

virtual StringPtr HRect::ToString void   )  const [virtual]
 

Returns:
Ptr to string

Definition at line 389 of file HGUI.h.

bool HRect::Get s_region &  rect  )  const
 

Returns:
True if not empty, false otherwise
Parameters:
[out] rect s_region structure

Definition at line 402 of file HGUI.h.

HPoint HRect::GetBottomRight void   )  const
 

Returns:
Bottom-right corner of the rectangle
See also:
GetTopLeft()

Definition at line 411 of file HGUI.h.

HPoint HRect::GetDimensions void   )  const
 

Returns:
Dimensions of rectangle as an HPoint structure

Definition at line 415 of file HGUI.h.

int32 HRect::GetHeight void   )  const
 

Returns:
Height in pixels
See also:
GetWidth()

Definition at line 420 of file HGUI.h.

HPoint HRect::GetOrigin void   )  const
 

Returns:
Top-left corner of rectangle as a point

Definition at line 424 of file HGUI.h.

HPoint HRect::GetTopLeft void   )  const
 

Returns:
Top-left corner of the rectangle
See also:
GetBottomRight()

Definition at line 429 of file HGUI.h.

int32 HRect::GetWidth void   )  const
 

Returns:
Width in pixels
See also:
GetHeight()

Definition at line 434 of file HGUI.h.

bool HRect::Set int32  nL,
int32  nT,
int32  nR,
int32  nB
 

Sets the rectange to a caller-supplied set of values.

Returns:
true if rectangle is NOT empty
Parameters:
nL value of "left" (x1)
nT value of "top" (y1)
nR value of "right" (x2)
nB value of "bottom" (y2)

Definition at line 445 of file HGUI.h.

bool HRect::Set const HPoint ptTL,
const HPoint ptBR
 

Sets the rectange to an arbitrary set of values, given the top left and bottom right corner expressed as points.

Returns:
true if rectangle is NOT empty
Parameters:
ptTL value of top left corner
ptBR value of bottom right corner

Definition at line 461 of file HGUI.h.

bool HRect::Contains const HPoint pt  )  const
 

Returns:
True if point inside rectangle
Parameters:
pt HPoint to test

Definition at line 478 of file HGUI.h.

bool HRect::IsEmpty void   )  const
 

Returns:
True if rectangle is empty, false otherwise
See also:
IsNotEmpty()

Definition at line 483 of file HGUI.h.

bool HRect::IsNotEmpty void   )  const
 

Returns:
True if rectangle is NOT empty
See also:
IsEmpty()

Definition at line 488 of file HGUI.h.


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

2006.01.09-16:37