20.5 Figureitems Interface

ORIGIN 'guienv';
LIB_DEF 'guienvfigureitems' '../lib';
BODY 'private/figureitemsbody'
(*
 * COPYRIGHT
 *       Copyright (C) Mjolner Informatics, 1991-96
 *       All rights reserved.
 *)
-- windowLib: attributes --
figureItem: windowitem
  (* superclass for all vector graphics *)
  (# <<SLOT figureItemLib: attributes>>;
     pen: @
       (* this item models the properties of the pen used to draw the
        * outline of THIS(figureItem)
        *)
       (# foregroundColor: 
            (* sets the foreground color of the pen used to draw
             * THIS(figureItem)
             *)
            (# theColor: @color;
            enter (# enter theColor do ... #)
            exit (# do ... exit theColor #)
            #);
          backgroundColor: 
            (* sets the background color of the pen used to draw
             * THIS(figureItem)
             *)
            (# theColor: @color;
            enter (# enter theColor do ... #)
            exit (# do ... exit theColor #)
            #);
          stipple:
            (* The pattern used for stippling when drawing with the
             * pen
             *)
            (# p: ^pixmap;
            enter (# enter p[] do ... #)
            exit (# do ... exit p[] #)
            #);
          size: 
            (* sets the size of the pen used to draw THIS(figureItem)
             *)
            (# value: @integer;
            enter (# enter value do ... #)
            exit (# do ... exit value #)
            #);
       #) (* pen *);
     open::< 
       (* The initialy pen characteristics of THIS(figureItem) are 
        *   stiple          = patterns.black
        *   foreGroundColor = colors.black
        *   backGroundColor = colors.white
        *   size      = 1
        *)
       (# create::< (# do ... #);
       do ... 
       #);
     eventhandler::<
       (# onRefresh::<
            (# do ...; #);
       #);
     private: @...;
  #) (* figureItem *);
line: figureItem
  (* straight line defined by a startPt and a endPt *)
  (# <<SLOT lineLib: attributes>>;
     start: 
       (# theStart: @point;
       enter (# enter theStart do ... #)
       exit (# do ... exit theStart #)
       #);
     end: 
       (# theEnd: @point;
       enter (# enter theEnd do ... #)
       exit (# do ... exit theEnd #)
       #);
     open::< 
       (# do ... #);
     eventhandler::<
       (# onRefresh::<
            (# do ... #);
          onFrameChanged::<
            (# do ... #);
          onHiliteChanged::<
            (#  do ... #);
       #);
     private: @...;
  #) (* line *);
shape: figureItem
  (* figures that can be filled *)
  (# <<SLOT shapeLib: attributes>>;
     fill: @
       (* This item models the properties of the fill of THIS(shape)
        *)
       (# tile: 
            (* Sets the tile raster used to fill THIS(figureItem) *)
            (# p: ^pixmap;
            enter (# enter p[] do ... #)
            exit (# do ... exit p[] #)
            #);
          foregroundColor: 
            (* Sets the foreground color of the pen used to draw
             * THIS(figureItem).
             *)
            (# theColor: @color;
            enter (# enter theColor do ... #)
            exit (# do ... exit theColor #)
            #);
          backgroundColor: 
            (* Sets the background color of the pen used to draw
             * THIS(figureItem).
             *)
            (# theColor: @color;
            enter (# enter theColor do ... #)
            exit (# do ... exit theColor #)
            #);
       #);
     open::< 
       (* The fill of THIS(shape) is initially: 
        *   colorForeground = black
        *   colorBackground = white
        *)
       (# do ... #);
     eventhandler::<
       (# onRefresh::<
            (# do ... #);
          onHiliteChanged::<
            (#  do ... #);
       #);
     private: @...;
  #) (* shape *);
oval: shape
  (* the oval is defined by a rectangle *)
  (# <<SLOT ovalLib: attributes>>;
     open::< (# do ... #);
     eventhandler::<
       (# onRefresh::<
            (# do ... #);
       #);
  #) (* oval *);
rect: shape
  (# <<SLOT rectLib: attributes>>;
     open::< (# do ... #);
     eventhandler::<
       (# onRefresh::<
            (# do ... #);
       #);
  #) (* rect *);
roundRect: shape
  (* rectangular shape with rounded corners *)
  (# <<SLOT roundRectLib: attributes>>;
     open::< 
       (# do ... #);
     roundness: 
       (* the corner roundness is specified by means of an Oval *)
       (# theOvalHeight,theOvalWidth: @integer;
       enter (# enter (theOvalHeight,theOvalWidth) do ... #)
       exit (# do ... exit (theOvalHeight,theOvalWidth) #)
       #);
     eventhandler::<
       (# onRefresh::<
            (# do ... #);
       #);
     private: @...;
  #) (* roundRect *);
wedge: shape
  (* a piece of cake *)
  (# <<SLOT wedgeLib: attributes>>;
     open::< 
       (# do ... #);
     startAngle: 
       (* evaluate the enter part to set the angle, where THIS(wedge)
        * starts.  Evaluate the exit part to get it
        *)
       (# angle: @integer;
       enter (# enter angle do ... #)
       exit (# do ... exit angle #)
       #);
     endAngle: 
       (* evaluate the enter part to set the angle, where THIS(wedge)
        * ends.  Evaluate the exit part to get it
        *)
       (# angle: @integer;
       enter (# enter angle do ... #)
       exit (# do ... exit angle #)
       #);
     eventhandler::<
       (# onRefresh::<
            (# do ... #);
       #);
     private: @...;
  #) (* wedge *);
polygon: shape
  (# <<SLOT polygonLib: attributes>>;
     points: 
       (* set or get the points that represents THIS(polygon).  There
        * must be at least 3 points
        *)
       (# thePoints: [3] ^point;
       enter (# enter thePoints do ... #)
       exit (# do ... exit thePoints #)
       #);
     open::<
       (#  
       do ...;
       #);
     eventhandler::<
       (# onRefresh::<
            (# do ... #);
          onFrameChanged::<
            (# do ... #);
       #);
     private: @...;
  #)


20.5 Figureitems Interface
© 1994-2004 Mjølner Informatics
[Modified: Monday August 24th 1998 at 13:50]