query
PW_CANVAS_XORIGIN
Get the current value of the x origin. This value can be in any metric, as determined by the person who set the origin. The origin can only be modified by setting it, or by scrolling (which can be done either directly or by a scroll object). The origin of a canvas is the position at the top left corner of the visible part of the canvas.
PW_CANVAS_YORIGIN
Get the current value of the y origin. This value can be in any metric, as determined by the person who set the origin. The origin can only be modified by setting it, or by scrolling (which can be done either directly or by a scroll object). The origin of a canvas is the position at the top left corner of the visible part of the canvas.
PW_CANVAS_XSIZE
Get the current width of the visible part of the canvas. This is the width in PROforma coordinates (pt).
PW_CANVAS_YSIZE
Get the current height of the visible part of the canvas. This is the heigth in PROforma coordinates (pt).
PW_CANVAS_XSIZE_PIX
Get the current width of the visible part of the canvas. This is the width in pixel coordinates (pt).
PW_CANVAS_YSIZE_PIX
Get the current height of the visible part of the canvas. This is the heigth in pixel coordinates (pt).
change
PW_CANVAS_POINTER
Set the pointer which should be used inside the canvas. The parameter is of type "Sprite *", as defined in "win_h".
PW_CANVAS_ACTION_REDRAW
Set the routine which is used to redraw the canvas. The parameter should be of type "Error (*)(PWObject, CanvasInfo *)". The WindowSub will be set when the redraw routine is called. All the necessary information for redrawing the canvas is supplied in the CanvasInfo parameter.
PW_CANVAS_ACTION_EXIT
Set the exit routine for the canvas. The parameter should be of type "Error (*)(PWObject, CanvasInfo *)". This routine is called when the pointer exits the area covered by the canvas. It can for example be used to remove the border around something in the canvas.
PW_CANVAS_ACTION_HIT
Set the routine which should be called when a PW_EVENT_HIT occurs inside the canvas. The parameter has type "Error (*)(PWObject, CanvasInfo *)".
PW_CANVAS_ACTION_DO
Set the routine which should be called when a PW_EVENT_DO occurs inside the canvas. The parameter has type "Error (*)(PWObject, CanvasInfo *)".
PW_CANVAS_ACTION_MOVE
Set the routine which should be called when a PW_EVENT_MOVE occurs inside the canvas. The parameter has type "Error (*)(PWObject, CanvasInfo *)".
PW_CANVAS_ACTION_SCALE
Set the routine which should be called when a the canvas object is scaled. This can be used to extract some information from the size of the canvas. The parameter has type "Error (*)(PWObject, CanvasInfo *)".
PW_CANVAS_TIMEOUT
Set the timeout value for reading the pointer inside the canvs. The parameter should be of type "TimeOut" as defined in "io_h". The timeout can be used for example to draw a preview of an action. The PW_EVENT_TIMEOUT is only triggered when no other event has occured during the duration set with this tag.
PW_CANVAS_ACTION_TIMEOUT
Set the routine which should be called when a timeout occurs inside the canvas. Obviously, this only works when a timeout is set for the canvas. The parameter has type "Error (*)(PWObject, CanvasInfo *)".
PW_CANVAS_SIZE_PIX
Set the size of the canvas on screen. Two parameters are required, the x and y size, both positive integers in pixels.
PW_CANVAS_XSIZE_PIX
Set the width of the canvas on screen. One parameters is required, the width, a positive integer in pixels.
PW_CANVAS_YSIZE_PIX
Set the height of the canvas on screen. One parameters is required, the height, a positive integer in pixels.
PW_CANVAS_SIZE
Set the size of the canvas on screen. Two parameters are required, the x and y size, both PROforma coordinates in "pt".
PW_CANVAS_XSIZE
Set the width of the canvas on screen. One parameters is required, the width, a PROforma coordinate in "pt".
PW_CANVAS_YSIZE
Set the height of the canvas on screen. One parameters is required, the height, a PROforma coordinate in "pt".
PW_CANVAS_ORIGIN
Set the current value of the x and y origin. The two parameter values can be in any metric. The origin of a canvas is the position at the top left corner of the visible part of the canvas. It could be in PROforma coordinates, lines, pixels, or anything else. The origin is directly passed on to application programmer via the CanvasInfo structure in the action handlers. The default origin is (0,0).
PW_CANVAS_XORIGIN
Set the current value of the x origin. The parameter value can be in any metric. The origin of a canvas is the position at the top left corner of the visible part of the canvas. It could be in PROforma coordinates, lines, pixels, or anything else. Th origin is directly passed on to application programmer via the CanvasInfo structure in the action handlers.
PW_CANVAS_YORIGIN
Set the current value of the y origin. The parameter value can be in any metric. The origin of a canvas is the position at the top left corner of the visible part of the canvas. It could be in PROforma coordinates, lines, pixels, or anything else. Th origin is directly passed on to application programmer via the CanvasInfo structure in the action handlers.
PW_CANVAS_XSCROLL
Increment the x origin of the canvas with the parameter. The canvas will automatically be redrawn when control is next handed back to ProWesS.
PW_CANVAS_YSCROLL
Increment the y origin of the canvas with the parameter. The canvas will automatically be redrawn when control is next handed back to ProWesS.
PW_CANVAS_REDRAW
Tell ProWesS that the canvas object should be redrawn when control is next handed back to ProWesS.
PW_CANVAS_ACTION_HITDRAG
Set the action routine which should be called when the user starts dragging with a hit. The parameter is of type "Error (*)(PWObject, CanvasInfo *)".
PW_CANVAS_ACTION_DODRAG
Set the action routine which should be called when the user starts dragging with a do. The parameter is of type "Error (*)(PWObject, CanvasInfo *)".
PW_CANVAS_ACTION_DRAGEND
Set the action routine which should be called when the user stops dragging. The parameter is of type "Error (*)(PWObject, CanvasInfo *)".
PW_CANVAS_ACTION_DRAGADJUST
When the user is dragging, ProWesS makes sure that the pointer will not move out of the current region (it won't even pass control to children). To prevent the pointer from exiting, the pointer position may be adjusted. Such an event can be trapped by the canvas with this tag. The parameter is of type "Error (*)(PWObject, CanvasInfo *, pt xdist, ydist)".
PW_CANVAS_ACTION_CATCH
Set the action routine which should be called when the canvas has to catch a keypress. The parameter is of type "Error (*)(PWObject, CanvasInfo *, char)". The last parameter is the key which was pressed.
PW_CANVAS_ACTION_CATCHSTART
Set the action routine which should be called when the canvas receives a catchstart event. The parameter is of type "Error (*)(PWObject, CanvasInfo *)".
PW_CANVAS_ACTION_CATCHEND
Set the action routine which should be called when the canvas receives a catchend event. The parameter is of type "Error (*)(PWObject, CanvasInfo *)".

CanvasInfo

All the client routines which can be called by the canvas type are passed a special structure, which contains a lot of relevant information about the canvas. This structure is known when {\tt ProWesS_h} is included, and is defined as follows :

typedef struct {
    pt xorg, yorg;          /* coordinate at topleft in canvas */
                            /* could be any type of size sizeof(int) */
                            /* PROforma coordinates */
    pt xsiz, ysiz;          /* size of area */
    pt xpos, ypos;          /* pointer position in area */
    Gstate gstate;          /* Gstate to draw in */
                            /* window coordinates */
    short xpixsiz, ypixsiz; /* size of area */
    short xpixorg, ypixorg; /* origin of area in window */
    short xpixpos, ypixpos; /* pointer position in area */
    Window window;          /* window to draw in */
                            /* conversion factors */
    pt Xpix2pt, Ypix2pt;    /* pixel to point conversion */
    pt Xpt2pix, Ypt2pix;    /* point to pixel conversion */
    short zero;             /* always zero */
    } CanvasInfo;
To allow redrawing (part of) the canvas, the WindowSub is always set to cover the area of the canvas when this structure is passed to a routine.
PROGS, Professional & Graphical Software
last edited 15 January, 1998