PtRect

PtRect — A rectangle defined by two points.

Synopsis

class PtRect PtGraphic
{
    rect_roundness;    // unsigned short  (Pt_ARG_RECT_ROUNDNESS)    
}
		

Base Classes

PtWidget <-- PtBasic <-- PtGraphic <-- PtRect

Description

This widget is a rectangle defined by a two points that are the upper-left and lower-right hand corners. It is located with respect to an origin point.

The origin is a PhPoint, assigned to the origin variable (inherited from PtGraphic). The two points are defined by an array of PhPoints assigned to the points variable (also inherited from PtGraphic).

[Note]

For detailed information, please refer to PtRect in the Photon documentation.

Instance Variables

rect_roundness

A number of pixels specifying the radius for the corners of the rectangle. Default is 0 (not rounded at all).

Example

This example, ex_PtRect.g, is included in the product distribution.

#!/usr/cogent/bin/phgamma

/*
 * This example puts a PtRect widget into a window,
 * and prints its two corner points.
 */

require_lisp("PhotonWidgets.lsp");
PtInit(nil);

win = new(PtWindow);
win.SetDim (150,150);
win.fill_color = 0xffffbb;

p1 = new(PhPoint);
p1.x = 0;
p1.y = 0;

p2 = new(PhPoint);
p2.x = 90;
p2.y = 50;

o = new(PhPoint);
o.x = 25;
o.y = 25;

rect = new(PtRect);
rect.points = array(p1,p2);
rect.origin = o;
rect.rect_roundness = 10;

pretty_princ("PtRect points:\n",rect.points,"\n");

PtRealizeWidget(win);
PtMainLoop();