OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TPoint Class Reference

TPoint is a support class, derived from tagPOINT. More...

#include <owl/geometry.h>

Inheritance diagram for owl::TPoint:

Public Member Functions

 TPoint ()
 Constructs an uninitialized point.
 
 TPoint (int _x, int _y)
 Creates a TPoint object with the given coordinates.
 
 TPoint (const tagPOINT &point)
 Creates a TPoint object with x = point.x, y = point.y.
 
 TPoint (const TPoint &point)
 Makes a copy of the point.
 
 TPoint (const tagSIZE &size)
 Creates a TPoint object with x = size.cx and y = size.cy.
 
 TPoint (LPARAM packedPoint)
 Creates a TPoint object from a packed point.
 
bool operator== (const TPoint &other) const
 Returns true if this point is equal to the other point; otherwise returns false.
 
bool operator!= (const TPoint &other) const
 Returns false if this point is equal to the other point; otherwise returns true.
 
int X () const
 Returns the x coordinate of the point.
 
int Y () const
 Returns the Y coordinate of the point.
 
int Magnitude () const
 Returns the distance between the origin and the point.
 
TPoint OffsetBy (int dx, int dy) const
 Calculates an offset to this point using the given displacement arguments.
 
TPoint operator+ (const TSize &size) const
 Calculates an offset to this point using the given size argument as the displacement.
 
TSize operator- (const TPoint &point) const
 Calculates a distance from this point to the point argument.
 
TPoint operator- (const TSize &size) const
 Calculates a negative offset to this point using the given size argument as the displacement.
 
TPoint operator- () const
 Returns the point (-x, -y). This point is not changed.
 
TPointOffset (int dx, int dy)
 Offsets this point by the given delta arguments.
 
TPointoperator+= (const TSize &size)
 Offsets this point by the given size argument.
 
TPointoperator-= (const TSize &size)
 Negatively offsets this point by the given size argument.
 

Detailed Description

TPoint is a support class, derived from tagPOINT.

The tagPOINT struct is defined as

struct tagPOINT {
int x;
int y;
};

TPoint encapsulates the notion of a two-dimensional point that usually represents a screen position. TPoint inherits two data members, the coordinates x and y, from tagPOINT. Member functions and operators are provided for comparing, assigning, and manipulating points. Overloaded << and >> operators allow chained insertion and extraction of TPoint objects with streams.

Definition at line 87 of file geometry.h.

Constructor & Destructor Documentation

◆ TPoint() [1/6]

owl::TPoint::TPoint ( )
inline

Constructs an uninitialized point.

Definition at line 413 of file geometry.h.

◆ TPoint() [2/6]

owl::TPoint::TPoint ( int _x,
int _y )
inline

Creates a TPoint object with the given coordinates.

Definition at line 423 of file geometry.h.

◆ TPoint() [3/6]

owl::TPoint::TPoint ( const tagPOINT & point)
inline

Creates a TPoint object with x = point.x, y = point.y.

Definition at line 433 of file geometry.h.

◆ TPoint() [4/6]

owl::TPoint::TPoint ( const TPoint & point)
inline

Makes a copy of the point.

Definition at line 443 of file geometry.h.

◆ TPoint() [5/6]

owl::TPoint::TPoint ( const tagSIZE & size)
inline

Creates a TPoint object with x = size.cx and y = size.cy.

Definition at line 453 of file geometry.h.

◆ TPoint() [6/6]

owl::TPoint::TPoint ( LPARAM packedPoint)
explicit

Creates a TPoint object from a packed point.

The given point must be encoded as in the LPARAM argument of a Windows message such as the WM_CONTEXTMENU message.

Definition at line 61 of file geometry.cpp.

Member Function Documentation

◆ Magnitude()

int owl::TPoint::Magnitude ( ) const

Returns the distance between the origin and the point.

Definition at line 70 of file geometry.cpp.

References owl::Sqrt().

◆ Offset()

TPoint & owl::TPoint::Offset ( int dx,
int dy )
inline

Offsets this point by the given delta arguments.

This point is changed to (x + dx, y + dy). Returns a reference to this point.

Definition at line 551 of file geometry.h.

◆ OffsetBy()

TPoint owl::TPoint::OffsetBy ( int dx,
int dy ) const
inline

Calculates an offset to this point using the given displacement arguments.

Returns the point (x + dx, y + dy). This point is not changed.

Definition at line 482 of file geometry.h.

References TPoint().

◆ operator!=()

bool owl::TPoint::operator!= ( const TPoint & other) const
inline

Returns false if this point is equal to the other point; otherwise returns true.

Definition at line 509 of file geometry.h.

References owl::ToBool().

◆ operator+()

TPoint owl::TPoint::operator+ ( const TSize & size) const
inline

Calculates an offset to this point using the given size argument as the displacement.

Returns the point (x + size.cx, y + size.cy). This point is not changed.

Definition at line 520 of file geometry.h.

References TPoint().

◆ operator+=()

TPoint & owl::TPoint::operator+= ( const TSize & size)
inline

Offsets this point by the given size argument.

This point is changed to(x + size.cx, y + size.cy). Returns a reference to this point.

Definition at line 563 of file geometry.h.

◆ operator-() [1/3]

TPoint owl::TPoint::operator- ( ) const
inline

Returns the point (-x, -y). This point is not changed.

Definition at line 491 of file geometry.h.

References TPoint().

◆ operator-() [2/3]

TSize owl::TPoint::operator- ( const TPoint & point) const
inline

Calculates a distance from this point to the point argument.

Returns the TSize object (x - point.x, y - point.y). This point is not changed.

Definition at line 530 of file geometry.h.

◆ operator-() [3/3]

TPoint owl::TPoint::operator- ( const TSize & size) const
inline

Calculates a negative offset to this point using the given size argument as the displacement.

Returns the point (x - size.cx, y - size.cy). This point is not changed.

Definition at line 541 of file geometry.h.

References TPoint().

◆ operator-=()

TPoint & owl::TPoint::operator-= ( const TSize & size)
inline

Negatively offsets this point by the given size argument.

This point is changed to (x - size.cx, y - size.cy). Returns a reference to this point.

Definition at line 575 of file geometry.h.

◆ operator==()

bool owl::TPoint::operator== ( const TPoint & other) const
inline

Returns true if this point is equal to the other point; otherwise returns false.

Definition at line 500 of file geometry.h.

References owl::ToBool().

◆ X()

int owl::TPoint::X ( ) const
inline

Returns the x coordinate of the point.

Definition at line 463 of file geometry.h.

◆ Y()

int owl::TPoint::Y ( ) const
inline

Returns the Y coordinate of the point.

Definition at line 472 of file geometry.h.


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