72 lines
1.9 KiB
Plaintext
72 lines
1.9 KiB
Plaintext
unit Point;
|
|
|
|
interface
|
|
|
|
uses
|
|
beobj, rect;
|
|
|
|
type
|
|
// TRect = class;
|
|
TPoint = class(TBeObject)
|
|
public
|
|
constructor Create(x, y : single); virtual;
|
|
constructor Create(point : TPoint); virtual;
|
|
constructor Create; override;
|
|
destructor Destroy; override;
|
|
procedure ConstrainTo(Rect : TRect);
|
|
procedure PrintToStream;
|
|
procedure Sept(x, y : single);
|
|
end;
|
|
|
|
function BPoint_Create(AObject : TBeObject; x, y : single) : TCPlusObject; cdecl; external BePascalLibName name 'BPoint_Create_1';
|
|
function BPoint_Create(AObject : TBeObject; point : TCPlusObject) : TCPlusObject; cdecl; external BePascalLibName name 'BPoint_Create_2';
|
|
function BPoint_Create(AObject : TBeObject) : TCPlusObject; cdecl; external BePascalLibName name 'BPoint_Create_3';
|
|
procedure BPoint_Free(Point : TCPlusObject); cdecl; external BePascalLibName name 'BPoint_Free';
|
|
procedure BPoint_ConstrainTo(Point : TCPlusObject; Rect : TCPlusObject); cdecl; external BePascalLibName name 'BPoint_ConstrainTo';
|
|
procedure BPoint_PrintToStream(Point : TCPlusObject); cdecl; external bePascalLibName name 'BPoint_PrintToStream';
|
|
procedure BPoint_Set(Point : TCPlusObject; x, y : single); cdecl; external BePascalLibName name 'BPoint_Set';
|
|
|
|
implementation
|
|
|
|
constructor TPoint.Create(x, y : single);
|
|
begin
|
|
inherited Create;
|
|
CPlusObject := BPoint_Create(Self, x, y);
|
|
end;
|
|
|
|
constructor TPoint.Create(point : TPoint);
|
|
begin
|
|
inherited Create;
|
|
CPlusObject := BPoint_Create(Self, point.CPlusObject)
|
|
end;
|
|
|
|
constructor TPoint.Create;
|
|
begin
|
|
inherited Create;
|
|
CPlusObject := BPoint_Create(Self);
|
|
end;
|
|
|
|
destructor TPoint.Destroy;
|
|
begin
|
|
BPoint_Free(CPlusObject);
|
|
inherited;
|
|
end;
|
|
|
|
procedure TPoint.ConstrainTo(Rect : TRect);
|
|
begin
|
|
BPoint_ConstrainTo(CPlusObject, Rect.CPlusObject);
|
|
end;
|
|
|
|
procedure TPoint.PrintToStream;
|
|
begin
|
|
BPoint_PrintToStream(CPlusObject);
|
|
end;
|
|
|
|
procedure TPoint.Sept(x, y : single);
|
|
begin
|
|
BPoint_Set(CPlusObject, x, y);
|
|
end;
|
|
|
|
initialization
|
|
|
|
end. |