PtLine

Gamma/Photon: Using Gamma™ with the Photon microGUIŽ, Version 4.0
Prev |  | Next

# `PtLine`

`PtLine` -- A line defined by two points and an origin.

## Synopsis

    class PtLine PtGraphic
    {
    }

## Base Classes

`PtWidget` <-- `PtBasic` <-- `PtGraphic` <-- `PtLine`

## Description

This widget is a line defined by a two-element array of start and end points, with respect to a location reference, or origin.

The origin is a `PhPoint` point, assigned to the widget's inherited `origin` variable, and the line is positioned relative to it. The start and end points of the line are defined by an array of two `PhPoints`, assigned to the inherited `points` variable. Both the `origin` and the `points` variables are inherited from the widget's parent, `PtGraphic`.

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

## Example

This example, `ex_PtLine.g`, is included in the `gamma_ph_`#`_examples_1_QNX4.tgz` file available on the Cogent Web Site.

    #!/usr/cogent/bin/phgamma

    /*
     * This example puts two PtLines with a common origin
     * in a window and prints the origin point and their
     * start and end points.
     */

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

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

    o = new(PhPoint);
    o.x = 50;
    o.y = 75;

    s1 = new(PhPoint);
    s1.x = 0;
    s1.y = 0;
    e1 = new(PhPoint);
    e1.x = -15;
    e1.y = -25;

    s2 = new(PhPoint);
    s2.x = 10;
    s2.y = 0;
    e2 = new(PhPoint);
    e2.x = 70;
    e2.y = -20;

    ln1 = new(PtLine);
    ln1.origin = o;
    ln1.points = array(s1,e1);

    ln2 = new(PtLine);
    ln2.origin = o;
    ln2.points = array(s2,e2);

    pretty_princ("Line origin: ",ln1.origin,"\n");
    pretty_princ("Line1 points: ",ln1.points,"\n");
    pretty_princ("Line2 points: ",ln2.points,"\n");

    PtRealizeWidget(win);
    PtMainLoop();

Prev | Home | Next
`PtLedPanel` | Up | `PtList`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.