AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
rectbutton (Rectangle rect [, double border [, int state]]) typedict.Graphics
rectbutton (Number x, Number y, Number width, Number height [, double border [, int state]])  
 
Transforms rect, or the rectangle that has (x, y) as its upper left corner and width and height as its dimensions, using CTM and then fills the resulting path on drawable by painting its interior using foreground. If the optional border argument is positive then it is used as the width of a border that is drawn along the interior edges of the rectangle with the four pieces of the border shaded so the rectangle looks like a raised button when state is zero (the default) or a lowered (i.e., pressed) button when state is non-zero. Right now the interpretation of "raised" and "lowered" gets muddled in rotated coordinate systems. rectbutton makes no use of or changes to the current path.
 
 Example:   The program,
import yoix.*.*;

JFrame f = {
    Color background = Color.black;

    Rectangle button = {
        double x = 144;
        double y = 144;
        double width = 144;
        double height = 72.0;
    };

    int pressed = 0;

    paint(Rectangle r) {
        graphics {        // "named block"
            gsave();
            setgray(0.8);
            rectbutton(button, 72/16, pressed);
            grestore();
        }
    }

    mousePressed(e) {
        if (pointInRect(e.coordinates, button)) {
            pressed = 1;
            repaint();
         }
    }

    mouseReleased(e) {
        if (pressed) {
            pressed = 0;
            repaint();
        }
    }
};

f.visible = TRUE;
defines a paint function that draws a button with a small border that reacts when you press a mouse button when the cursor is in the button.
 
 Return:   none
 
 See Also:   clip, clippath, drawablebbox, eoclip, eoerase, eofill, erase, erasedrawable, fill, ineofill, infill, instroke, rectclip, rectcopy, recterase, rectfill, rectmove, rectstroke, stroke, strokepath

 

Yoix is a registered trademark of AT&T Inc.