KSD_EXPORT_CLASSclass TRect

A rectangle shape object.

Inheritance:


Public Methods

[more] TRect()
[more] TRect(int X1, int Y1, int X2, int Y2)
Create a TRect object with the given dimensions
[more] TRect(const TPoint2D& point1, const TPoint2D& point2)
Create a rect formed by these two point
[more] TRect(const TPoint2D& point, const Dimension& dim)
Create a rect at the given point with the given dimensions
[more] TRect(const TRect& copy)
Initia;ize this rect to the value of another
[more]int GetLeft() const
Returns the distance from the left edge of the screen to the left edge of the rectangle.
[more]int GetTop() const
Returns the distance from the top edge of the screen to the top edge of the rectangle
[more]int GetRight() const
Returns the distance from the left edge of the screen to the right edge of the rectangle
[more]int GetBottom() const
Returns the distance from the top edge of the screen to the bottom edge of the rectangle
[more]void SetLeft(int l)
Sets the rectangles left value.
[more]void SetTop(int t)
Sets the rectangles top value.
[more]void SetRight(int r)
Sets the rectangles right value.
[more]void SetBottom(int b)
Sets tge rectangles bottom value.
[more]TPoint2D GetPosition() const
Return the position of the upper-left corner of the rectangle
[more]int GetWidth() const
Returns the width of the rectangle
[more]int GetHeight() const
Returns the height of the rectangle
[more]void Clear()
Clears the rectangle
[more]void SetPosition(const TPoint2D& point)
Sets the position of the rectangle.
[more]void SetWidth(int Width)
Sets the width of the rectangle
[more]void SetHeight(int Height)
Sets the height of the rectangle
[more]void Set(int X1, int Y1, int X2, int Y2)
Sets all the properties the rectangle
[more]Dimension GetDimensions() const
Retruns the rectangle dimensions in a Dimension object
[more]bool IsValid() const
Returns true if this a valid rectangle
[more]bool ClipLine(int& x1, int& y1, int& x2, int& y2) const
Clips a line defined by these endpoints to this rectangle
[more]bool ClipRect(TRect& rect) const
Clips an other rectangle to this rectangle
[more]bool ClipRect(int& left, int& top, int& right, int& bottom) const
Clips a rectangle defined by the given properties to this rectangle
[more]void ClipPoint(TPoint2D& point) const
Clips a point to this rectagnle
[more]void ClipPoint(int& X, int& Y) const
Clips a point to this rectagnle


Inherited from TShape2D:

Public Methods

ovirtual bool IsInside(const TPoint2D& V) const
ovirtual void Move(int X, int Y)
ovirtual void MoveTo(int X, int Y)
ovoid Move(const TPoint2D& p)
ovoid MoveTo(const TPoint2D& p)
ovirtual void Visit(Visitor*)

Public Members

class Visitor
Used to add new operations to a shape without modifying the source


Documentation

A rectangle shape object. Used to describe rectangular regions in screen space. It is not advised that you use it for anything more complex because TRect is optimized for speed and size, not precision.

TRect uses a non-standard way to represent a screen rectangle. It holds the distance that is edges are from the screen edges. For example, the Left value is the distance from the left edge of the screen to the left edge of the rectangle. In this way the position of the rectangle is (Left, Top) and its is defined by Right - Left. Keep this in mind when using TRect.

o TRect()

o TRect(int X1, int Y1, int X2, int Y2)
Create a TRect object with the given dimensions

o TRect(const TPoint2D& point1, const TPoint2D& point2)
Create a rect formed by these two point

o TRect(const TPoint2D& point, const Dimension& dim)
Create a rect at the given point with the given dimensions

o TRect(const TRect& copy)
Initia;ize this rect to the value of another

oint GetLeft() const
Returns the distance from the left edge of the screen to the left edge of the rectangle.

oint GetTop() const
Returns the distance from the top edge of the screen to the top edge of the rectangle

oint GetRight() const
Returns the distance from the left edge of the screen to the right edge of the rectangle

oint GetBottom() const
Returns the distance from the top edge of the screen to the bottom edge of the rectangle

ovoid SetLeft(int l)
Sets the rectangles left value.
See Also:
GetLeft

ovoid SetTop(int t)
Sets the rectangles top value.
See Also:
GetTop

ovoid SetRight(int r)
Sets the rectangles right value.
See Also:
GetRight

ovoid SetBottom(int b)
Sets tge rectangles bottom value.
See Also:
GetBottom

oTPoint2D GetPosition() const
Return the position of the upper-left corner of the rectangle

oint GetWidth() const
Returns the width of the rectangle

oint GetHeight() const
Returns the height of the rectangle

ovoid Clear()
Clears the rectangle

ovoid SetPosition(const TPoint2D& point)
Sets the position of the rectangle. This is actually a slower operation than it would seem given the internal representation of the rectangle.

ovoid SetWidth(int Width)
Sets the width of the rectangle

ovoid SetHeight(int Height)
Sets the height of the rectangle

ovoid Set(int X1, int Y1, int X2, int Y2)
Sets all the properties the rectangle

oDimension GetDimensions() const
Retruns the rectangle dimensions in a Dimension object

obool IsValid() const
Returns true if this a valid rectangle

obool ClipLine(int& x1, int& y1, int& x2, int& y2) const
Clips a line defined by these endpoints to this rectangle

obool ClipRect(TRect& rect) const
Clips an other rectangle to this rectangle

obool ClipRect(int& left, int& top, int& right, int& bottom) const
Clips a rectangle defined by the given properties to this rectangle

ovoid ClipPoint(TPoint2D& point) const
Clips a point to this rectagnle

ovoid ClipPoint(int& X, int& Y) const
Clips a point to this rectagnle


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.