BRect Class Reference

#include <Rect.h>

List of all members.


Detailed Description

A BRect object represents a rectangle. BRects are used throughout the Interface Kit to define the frames of windows, views, bitmaps - even the screen itself.

See also:
Using BRect

Data Members

float left
The value of the rectangle's left side.
float top
The value of the rectangle's top.
float right
The value of the rectangle's right side.
float bottom
The value of the rectangle's bottom.


Public Member Functions

 BRect ()
 BRect (const BRect &)
 BRect (float l, float t, float r, float b)
 BRect (BPoint leftTop, BPoint rightBottom)
BRectoperator= (const BRect &from)
void Set (float l, float t, float r, float b)
 Sets the object's rectangle by defining the coordinates of all four sides.
void SetAsSize (float l, float t, float w, float h)
void PrintToStream () const
BPoint LeftTop () const
BPoint RightBottom () const
BPoint LeftBottom () const
BPoint RightTop () const
void SetLeftTop (const BPoint)
void SetRightBottom (const BPoint)
void SetLeftBottom (const BPoint)
void SetRightTop (const BPoint)
void InsetBy (BPoint)
void InsetBy (float dx, float dy)
void InsetBy (const BInsets &d)
void OffsetBy (BPoint)
void OffsetBy (float dx, float dy)
void OffsetTo (BPoint)
void OffsetTo (float x, float y)
BRectInsetBySelf (BPoint)
BRectInsetBySelf (float dx, float dy)
BRectInsetBySelf (const BInsets &d)
BRect InsetByCopy (BPoint) const
BRect InsetByCopy (float dx, float dy) const
BRect InsetByCopy (const BInsets &d) const
BRectOffsetBySelf (BPoint)
BRectOffsetBySelf (float dx, float dy)
BRect OffsetByCopy (BPoint) const
BRect OffsetByCopy (float dx, float dy) const
BRectOffsetToSelf (BPoint)
BRectOffsetToSelf (float dx, float dy)
BRect OffsetToCopy (BPoint) const
BRect OffsetToCopy (float dx, float dy) const
bool operator== (BRect) const
bool operator!= (BRect) const
BRect operator & (BRect) const
BRect operator| (BRect) const
bool Intersects (BRect r) const
bool IsValid () const
float Width () const
int32 IntegerWidth () const
float Height () const
int32 IntegerHeight () const
bool Contains (BPoint) const
bool Contains (BRect) const
BInsets InsetOf (const BRect &interior) const
BRect operator * (const float f) const
BRect operator+ (const BPoint &p) const
BRect operator+ (const BInsets &i) const
BRect operator- (const BPoint &p) const
BRect operator- (const BInsets &i) const
BRect operator/ (const float f) const
BRectoperator *= (const float f)
BRectoperator+= (const BPoint &p)
BRectoperator+= (const BInsets &i)
BRectoperator-= (const BPoint &p)
BRectoperator-= (const BInsets &i)
BRectoperator/= (const float f)

Public Attributes

float left
float top
float right
float bottom


Constructor & Destructor Documentation

BRect  )  [inline]
 

BRect const BRect  )  [inline]
 

BRect float  l,
float  t,
float  r,
float  b
[inline]
 

BRect BPoint  leftTop,
BPoint  rightBottom
[inline]
 


Member Function Documentation

bool Contains BRect  r  )  const
 

Returns true if rect lies entirely within the BRect's rectangle (and false if not). A rectangle contains the points that lie along its edges; for example, two identical rectangles contain each other.

Parameters:
r Rectangle to test
Note:
This function's result are unpredictable if either rectangle is invalid.
See also:
& (intersection), | (union), BPoint::ConstrainTo()

bool Contains BPoint  pt  )  const
 

Returns true if point lies entirely within the BRect's rectangle (and false if not). A rectangle contains the points that lie along its edges; for example, two identical rectangles contain each other.

Parameters:
pt Point to test
Note:
This function's result are unpredictable if either rectangle is invalid.
See also:
& (intersection), | (union), BPoint::ConstrainTo()

float Height  )  const [inline]
 

void InsetBy const BInsets d  ) 
 

void InsetBy float  dx,
float  dy
 

Insets the sides of the BRect's rectangle by x units (left and right sides) and y units (top and bottom). Positive inset values shrink the rectangle; negative values expand it. Note that both sides of each pair moves the full amount. For example, if you inset a BRect by (4,4), the left side moves (to the right) four units and the right side moves (to the left) four units (and similarly with the top and bottom).

Parameters:
dx x inset
dy y inset

void InsetBy BPoint  delta  ) 
 

Insets the sides of the BRect's rectangle by x units (left and right sides) and y units (top and bottom). Positive inset values shrink the rectangle; negative values expand it. Note that both sides of each pair moves the full amount. For example, if you inset a BRect by (4,4), the left side moves (to the right) four units and the right side moves (to the left) four units (and similarly with the top and bottom).

Parameters:
delta The BPoint's x and y values are used as the x and y arguments

BRect InsetByCopy const BInsets d  )  const
 

BRect InsetByCopy float  dx,
float  dy
const
 

Insets the sides of the BRect's rectangle by x units (left and right sides) and y units (top and bottom). Positive inset values shrink the rectangle; negative values expand it. Note that both sides of each pair moves the full amount. For example, if you inset a BRect by (4,4), the left side moves (to the right) four units and the right side moves (to the left) four units (and similarly with the top and bottom).

Parameters:
dx x inset
dy y inset
The ...Copy() versions copy the BRect, and then modify and return the copy (without changing the original).

BRect InsetByCopy BPoint  pt  )  const
 

Insets the sides of the BRect's rectangle by x units (left and right sides) and y units (top and bottom). Positive inset values shrink the rectangle; negative values expand it. Note that both sides of each pair moves the full amount. For example, if you inset a BRect by (4,4), the left side moves (to the right) four units and the right side moves (to the left) four units (and similarly with the top and bottom).

Parameters:
pt The BPoint's x and y values are used as the x and y arguments
The ...Copy() versions copy the BRect, and then modify and return the copy (without changing the original).

BRect & InsetBySelf const BInsets d  ) 
 

BRect & InsetBySelf float  dx,
float  dy
 

Insets the sides of the BRect's rectangle by x units (left and right sides) and y units (top and bottom). Positive inset values shrink the rectangle; negative values expand it. Note that both sides of each pair moves the full amount. For example, if you inset a BRect by (4,4), the left side moves (to the right) four units and the right side moves (to the left) four units (and similarly with the top and bottom).

Parameters:
dx x inset
dy y inset
The ...Self() versions of the functions are the same as the simpler versions, but they conveniently return the modified BRect.

BRect & InsetBySelf BPoint  pt  ) 
 

Insets the sides of the BRect's rectangle by x units (left and right sides) and y units (top and bottom). Positive inset values shrink the rectangle; negative values expand it. Note that both sides of each pair moves the full amount. For example, if you inset a BRect by (4,4), the left side moves (to the right) four units and the right side moves (to the left) four units (and similarly with the top and bottom).

Parameters:
pt The BPoint's x and y values are used as the x and y arguments
The ...Self() versions of the functions are the same as the simpler versions, but they conveniently return the modified BRect.

BInsets InsetOf const BRect interior  )  const
 

int32 IntegerHeight  )  const [inline]
 

int32 IntegerWidth  )  const [inline]
 

bool Intersects BRect  r  )  const
 

Returns true if the BRect has any area - even a corner or part of a side - in common with rect, and false if it doesn't.

Parameters:
r Rectangle to test
Note:
This function's result are unpredictable if either rectangle is invalid.

bool IsValid  )  const [inline]
 

BPoint LeftBottom  )  const [inline]
 

BPoint LeftTop  )  const [inline]
 

void OffsetBy float  dx,
float  dy
 

Moves the BRect horizontally by x units and vertically by y units. The rectangle's size doesn't change.

Parameters:
dx x offset
dy y offset

void OffsetBy BPoint  delta  ) 
 

Moves the BRect horizontally by x units and vertically by y units. The rectangle's size doesn't change.

Parameters:
delta The BPoint's x and y values are used as the x and y arguments

BRect OffsetByCopy float  dx,
float  dy
const
 

Moves the BRect horizontally by x units and vertically by y units. The rectangle's size doesn't change.

Parameters:
dx x offset
dy y offset
The ...Copy() versions copy the BRect, and then modify and return the copy (without changing the original).

BRect OffsetByCopy BPoint  pt  )  const
 

Moves the BRect horizontally by x units and vertically by y units. The rectangle's size doesn't change.

Parameters:
pt The BPoint's x and y values are used as the x and y arguments
The ...Copy() versions copy the BRect, and then modify and return the copy (without changing the original).

BRect & OffsetBySelf float  dx,
float  dy
 

Moves the BRect horizontally by x units and vertically by y units. The rectangle's size doesn't change.

Parameters:
dx x offset
dy y offset
The ...Self() versions of the functions are the same as the simpler versions, but they conveniently return the modified BRect.

BRect & OffsetBySelf BPoint  pt  ) 
 

Moves the BRect horizontally by x units and vertically by y units. The rectangle's size doesn't change.

Parameters:
pt The BPoint's x and y values are used as the x and y arguments
The ...Self() versions of the functions are the same as the simpler versions, but they conveniently return the modified BRect.

void OffsetTo float  x,
float  y
 

Moves the BRect to the location (x,y).

Parameters:
dx x offset
dy y offset

void OffsetTo BPoint  pt  ) 
 

Moves the BRect to the location (x,y).

Parameters:
delta The BPoint's x and y values are used as the x and y arguments

BRect OffsetToCopy float  dx,
float  dy
const
 

Moves the BRect to the location (x,y).

Parameters:
dx x offset
dy y offset
The ...Copy() versions copy the BRect, and then modify and return the copy (without changing the original).

BRect OffsetToCopy BPoint  pt  )  const
 

Moves the BRect to the location (x,y).

Parameters:
pt The BPoint's x and y values are used as the x and y arguments
The ...Copy() versions copy the BRect, and then modify and return the copy (without changing the original).

BRect & OffsetToSelf float  dx,
float  dy
 

Moves the BRect to the location (x,y).

Parameters:
dx x offset
dy y offset
The ...Self() versions of the functions are the same as the simpler versions, but they conveniently return the modified BRect.

BRect & OffsetToSelf BPoint  pt  ) 
 

Moves the BRect to the location (x,y).

Parameters:
pt The BPoint's x and y values are used as the x and y arguments
The ...Self() versions of the functions are the same as the simpler versions, but they conveniently return the modified BRect.

BRect operator & BRect  r  )  const
 

Intersection operator.

Creates and returns a new BRect that's the intersection of the two operands. The new BRect encloses the area that the two operands have in common. If the two operands don't intersect, the new BRect will be invalid.

Parameters:
r Second operand
Returns:
A new rectangle object

BRect operator * const float  f  )  const
 

BRect & operator *= const float  f  ) 
 

bool operator!= BRect  r  )  const
 

Inequality operator.

Returns:
true if the two objects' rectangles don't coincide.
Parameters:
r Rectangle to test

BRect operator+ const BInsets i  )  const
 

BRect operator+ const BPoint p  )  const
 

BRect & operator+= const BInsets i  ) 
 

BRect & operator+= const BPoint p  ) 
 

BRect operator- const BInsets i  )  const
 

BRect operator- const BPoint p  )  const
 

BRect & operator-= const BInsets i  ) 
 

BRect & operator-= const BPoint p  ) 
 

BRect operator/ const float  f  )  const
 

BRect & operator/= const float  f  ) 
 

BRect & operator= const BRect from  )  [inline]
 

bool operator== BRect  r  )  const
 

Equality operator.

Returns:
true if the two objects' rectangles exactly coincide.
Parameters:
r Rectangle to test

BRect operator| BRect  r  )  const
 

Union operator.

Creates and returns a new BRect that minimally but completely encloses the area defined by both of the operands. The shaded area illustrates the union of the two outlined rectangles:

void PrintToStream void   )  const
 

Prints the contents of the BRect object to standard out in the form:

"BRect(left, top, right, bottom)"

BPoint RightBottom  )  const [inline]
 

BPoint RightTop  )  const [inline]
 

void Set float  left,
float  top,
float  right,
float  bottom
[inline]
 

Sets the object's rectangle by defining the coordinates of all four sides.

Parameters:
left Left coordinate
top Top coordinate
right Right coordinate
bottom bottom coordinate

void SetAsSize float  l,
float  t,
float  w,
float  h
 

void SetLeftBottom const BPoint  pt  ) 
 

Move the LeftBottom rectangle' corner to the BPoint argument; the other corners and sides are modified concomittantly. None of these functions prevents you from creating an invalid rectangle.

Parameters:
pt New point for the LeftBottom corner

void SetLeftTop const BPoint  pt  ) 
 

Move the LeftTop rectangle' corner to the BPoint argument; the other corners and sides are modified concomittantly. None of these functions prevents you from creating an invalid rectangle.

Parameters:
pt New point for the LeftTop corner

void SetRightBottom const BPoint  pt  ) 
 

Move the RightBottom rectangle' corner to the BPoint argument; the other corners and sides are modified concomittantly. None of these functions prevents you from creating an invalid rectangle.

Parameters:
pt New point for the RightBottom corner

void SetRightTop const BPoint  pt  ) 
 

Move the Righttop rectangle' corner to the BPoint argument; the other corners and sides are modified concomittantly. None of these functions prevents you from creating an invalid rectangle.

Parameters:
pt New point for the Righttop corner

float Width  )  const [inline]
 


Member Data Documentation

float bottom
 

float left
 

float right
 

float top
 


Copyright 2005 by yellowTAB GmbH, Be Inc., Palm Source Inc. and their respective legal successors
All rights reserved.