Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
None.
Inherited By:
None.
Purpose:
TLongRect represents discrete coordinate-aligned rectangles. TLongRect is used to specify bounds of a discrete area, such as the size of an array of pixels. TLongRect rectangles are defined with four long integers: fLeft, fTop, fRight, and fBottom, all of which are declared public.
TLongRects are defined over a half-open interval, so a point is considered to be contained in the rectangle if it falls within fLeft <= X < fRight and fTop <= Y < fBottom.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
Do not derive from TLongRect: All its data is public and the destructor is not virtual.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
- TLongRect ()
- TLongRect (const TGPoint & p0, const TGPoint & p1)
- TLongRect (long left, long top, long right, long bottom)
- TLongRect (const TLongRect &)
- TLongRect (const TGRect &)
Interface Category:
API.
Purpose:
- Default constructor. Does not initialize data members.
- Creates a TLongRect and initializes it from the two specified points. fLeft gets the smallest x component in the two points; fRight gets the largest. fTop gets the smallest y component in the two points; fBottom gets the largest.
- Creates a TLongRect and initializes it from the four specified coordinates.
- Copy constructor.
- Creates a TLongRect and initializes it from the specified TGRect.
Calling Context:
- Called by the stream-in operators.
- Call this function directly.
- Call this function directly.
- Called to copy an object.
- Call this function directly.
Parameters:
- Takes no parameters.
- const TGPoint & p0 -One of the points from which the TLongRect is initialized.
- const TGPoint & p1 -One of the points from which the TLongRect is initialized.
- long left -The left edge of the rectangle.
- long top -The top edge of the rectangle.
- long right -The right edge of the rectangle.
- long bottom -The bottom edge of the rectangle.
- const TLongRect & -The object to be copied.
- const TGRect & -The TGRect from which this TLongRect is initialized.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
- This function is defined inline.
- This function is defined inline.
- This function is defined inline.
~ TLongRect ()
Interface Category:
API.
Purpose:
Destructor.
Calling Context:
Called to destroy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is defined inline.
Member Function: TLongRect::IsEmpty
bool IsEmpty () const
Interface Category:
API.
Purpose:
Determines if the TLongRect is empty. The rectangle is considered empty if the right edge is less than the left edge and the bottom edge is less than the top edge.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns true if (fLeft >=fRight) ||(fTop >=fBottom). Returns false otherwise.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is defined inline.
Member Function: TLongRect::GetWidth
unsigned long GetWidth () const
Interface Category:
API.
Purpose:
Computes the width of this rectangle using fRight -fLeft.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the width of the rectangle as an unsigned long integer.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is defined inline.
Member Function: TLongRect::GetHeight
unsigned long GetHeight () const
Interface Category:
API.
Purpose:
Computes the height of this rectangle using fBottom -fTop.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the height of the rectangle as an unsigned long integer.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is defined inline.
Member Function: TLongRect::EqualSize
bool EqualSize (const TLongRect & g) const
Interface Category:
API.
Purpose:
Determines whether this rectangle has the same height and width as the specified rectangle.
Calling Context:
Call this function directly.
Parameters:
- const TLongRect & g -The rectangle whose height and width are compared to this rectangle's height and width.
Return Value:
Returns true if this rectangle has the same height and width as the specified rectangle. Returns false otherwise.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLongRect::SetToPoint
void SetToPoint (long x, long y)
Interface Category:
API.
Purpose:
Sets the rectangle to equal a single point. fLeft and fRight get the specified x-coordinate. fBottom and fTop get the specified y-coordinate.
Calling Context:
Call this function directly.
Parameters:
- long x -The x location to which to set the vertical edges of rectangle.
- long y -The y location to which to set the horizontal edges of the rectangle.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLongRect::ExtendTo
- void ExtendTo (const TLongRect & g)
- void ExtendTo (long x, long y)
Interface Category:
API.
Purpose:
- Individually extends this rectangle's coordinates to the corresponding coordinate in the specified rectangle. The change to any coordinate does not occur if the result does not extend the bounds of the current rectangle.
- Individually extends this rectangle's coordinates to the corresponding x or y parameter. fLeft and fRight are extended to the x parameter and fBottom and fTop are extended to the y parameter. The change to any coordinate does not occur if the result does not extend the bounds of the current rectangle.
Calling Context:
- Call this function directly.
- Call this function directly.
Parameters:
- const TLongRect & g -The rectangle to which to extend the bounds of this rectangle.
- long x -The x-coordinate to which to extend fLeft and fRight.
- long y -The y-coordinate to which to extend fBottom and fTop.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLongRect::IntersectWith
void IntersectWith (const TLongRect & g)
Interface Category:
API.
Purpose:
Forces the current rectangle to intersect the specified rectangle. If fLeft (fTop) is less than fLeft (fTop) of the specified rectangle, then fLeft (fTop) is adjusted to equal fLeft (fTop) of the specified rectangle. If fRight (fBottom) is greater than fRight (fBottom) of the specified rectangle, then fRight (fBottom) is adjusted to equal fRight (fBottom) of the specified rectangle.
Calling Context:
Call this function directly.
Parameters:
- const TLongRect & g -The rectangle with which to force intersection.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLongRect::Offset
void Offset (long dx, long dy)
Interface Category:
API.
Purpose:
Translates this rectangle by the specified delta x and delta y values. The width and the height of the rectangle remain the same.
Calling Context:
Call this function directly.
Parameters:
- long dx -The amount by which to move the rectangle along the horizontal axis.
- long dy -The amount by which to move the rectangle along the vertical axis.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLongRect::Inset
void Inset (long dx, long dy)
Interface Category:
API.
Purpose:
Adjusts the horizontal edges in opposite directions by the specified delta x value and adjusts the vertical edges in opposite directions by the specified delta y value. If delta x (or delta y) is positive, the horizontal (or vertical) edges are moved together; if delta x (or delta y) is negative, the horizontal (or vertical) edges are moved apart.
Calling Context:
Call this function directly.
Parameters:
- long dx -The amount by which to adjust the horizontal edges of the rectangle.
- long dy -The amount by which to adjust the vertical edges of the rectangle.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLongRect::OrderPoints
void OrderPoints ()
Interface Category:
API.
Purpose:
Forces (fTop, fLeft) to be less than (fBottom, fRight).
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLongRect::Intersects
bool Intersects (const TLongRect & g) const
Interface Category:
API.
Purpose:
Tests whether this rectangle intersects the specified rectangle.
Calling Context:
Call this function directly.
Parameters:
- const TLongRect & g -The rectangle against which to test this rectangle for intersection.
Return Value:
Returns true if this rectangle intersects the specified rectangle.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is defined inline.
Member Function: TLongRect::Contains
- bool Contains (const TLongRect & g) const
- bool Contains (long x, long y) const
Interface Category:
API.
Purpose:
- Tests whether the specified rectangle lies within this rectangle.
- Tests whether the specified point lies within this rectangle.
Calling Context:
- Call this function directly.
- Call this function directly.
Parameters:
- const TLongRect & g -The rectangle to test for containment.
- long x -The x-coordinate of the point to test for containment.
- long y -The y-coordinate of the point to test for containment.
Return Value:
Returns true if the specified rectangle (or point) lies within this rectangle.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLongRect::operator>>=
TStream & operator >>=(TStream & towhere) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & towhere -The stream to which the object streams itself out.
Return Value:
Returns a reference to the stream the object streams itself out to.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLongRect::operator<<=
TStream & operator <<= (TStream & fromwhere)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & fromwhere -The stream from which the object streams itself in.
Return Value:
Returns a reference to the stream the object streams itself in from.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLongRect::operator=
TLongRect & operator =(const TLongRect & a)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Call this function by using the operator in an assignment statement.
Parameters:
- const TLongRect & a -The object to be copied.
Return Value:
A non-const reference to the left-hand side object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is defined inline.
Member Function: TLongRect::operator==
bool operator ==(const TLongRect & a) const
Interface Category:
API.
Purpose:
Tests whether two objects are equal.
Calling Context:
Call this function by using the operator in an expression.
Parameters:
- const TLongRect & a -The object to be compared to this object.
Return Value:
Returns true if the two objects are equal.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLongRect::operator!=
bool operator != (const TLongRect & a) const
Interface Category:
API.
Purpose:
Tests whether two objects are equal.
Calling Context:
Call this function by using the operator in an expression.
Parameters:
- const TLongRect & a -The object to be compared to this object.
Return Value:
Returns true if the two objects are not equal.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLongRect::Set
void Set (long left, long top, long right, long bottom)
Interface Category:
API.
Purpose:
Sets the horizontal and vertical edges to the specified values.
Calling Context:
Call this function directly.
Parameters:
- long left -The value to which to set fLeft.
- long top -The value to which to set fTop.
- long right -The value to which to set fRight.
- long bottom -The value to which to set fBottom.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
This function is defined inline.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.