{ { INTERACTOR(2I) InterViews Programmer's Manual < < } ^ . ! \b { NAME \u { { Interactor - base class for interactive objects } ^ . ! < } * < } 5 # ! { SYNOPSIS \u { { `#include ' } ^ . ! < } * < } 5 # ! { DESCRIPTION \u { { { { Interactor is the base class for all interactive objects. } ^ . ! { Every interactor has a shape member variable that defines the desired characteristics of screen space in terms of size, shrinkability, and stretchability. } ^ . ! { This information is used to allocate display space for the interactor and the interactor's canvas member variable is set to the actual space obtained. } ^ . ! { The lower left corner of the canvas is addressed by `(0, 0);' ! the upper right by the member variables `(xmax, ymax).' ! } ^ . ! < } 2 + . } _ 0 0 ~ ! { { { The input member variable is the normal sensor for reading events. } ^ . ! { The output member variable is the standard painter for performing graphics operations. } ^ . ! { The cursor member variable controls the format and interpretation of the input pointing device (e.g., mouse cursor) when it is inside the interactor's canvas. } ^ . ! < } 2 + . } _ 0 0 ~ ! { { { An interactor may optionally define the perspective member variable to represent the portion of total area that the interactor is displaying. } ^ . ! { Perspectives allow interactors to coordinate with other interactors, such as scrollers, that want to control the display area. } ^ . ! < } 2 + . } _ 0 0 ~ ! { { { To access the workstation, an interactor must be inserted into a scene, called its parent. } ^ . ! { The root scene is the instance of the World class that must be created at the start of your program. } ^ . ! < } 2 + . } _ 0 0 ~ ! } < ^ _ _ ; < } 5 # ! { { { `/* ' { { Base class for interactive objects. } ^ . ! ^ } * `*/' } 4 # ! < { `#include ' `' ! } * ! < { `extern class Sensor* stdsensor;' } * ! { `extern class Painter* stdpaint;' } * ! < { `struct Event;' } * ! < { `class Interactor {' { _ { { `friend class Scene;' } * ! { `friend class Image;' } * ! < { `const char* name;' } * ! { `Interactor* icon;' } * ! { `Scene* parent;' } * ! { `Coord left;' } * ! { `Coord bottom;' } * ! { `Sensor* cursensor;' } * ! { `unsigned prevmask;' } * ! < { `boolean OtherEvent(' `Event&' ! `);' } 4 # ! { `boolean Select(' `Event&' ! `);' } 4 # ! { `boolean GetEvent(' { `Event&' ! `boolean' ! } `, ' ^ _ _ ; ! `);' } 4 # ! { `void FlushRedraws();' } * ! { `void SendRedraw(' { `Coord x' ! `Coord y' ! `int width' ! `int height' ! } `, ' ^ _ _ ; ! `);' } 4 # ! { `void SendResize(' { `int width' ! `int height' ! } `, ' ^ _ _ ; ! `);' } 4 # ! { `void CheckPending(' { `Coord x' ! `Coord y' ! `int width' ! `int height' ! } `, ' ^ _ _ ; ! `);' } 4 # ! } < ^ _ _ ; } 4 # { `protected:' { { `class Shape* shape;' } * ! { `class Canvas* canvas;' } * ! { `class Perspective* perspective;' } * ! { `Coord xmax;' } * ! { `Coord ymax;' } * ! { `Sensor* input;' } * ! { `Painter* output;' } * ! { `class Cursor* cursor;' } * ! } < ^ _ _ ; } 4 # { `public:' { { `Interactor(' { `Sensor* in = stdsensor' ! `Painter* out = stdpaint' ! } `, ' ^ _ _ ; ! `);' } 4 # ! { `~Interactor();' } * ! { `Scene* Parent () {' `return parent;' ! `}' } 4 # ! { `Coord MapX (' `Coord x' ! { `) {' `return x + left;' ! `}' } 4 # } 4 # ! { `Coord MapY (' `Coord y' ! { `) {' `return y + bottom;' ! `}' } 4 # } 4 # ! { `Perspective* GetPerspective () {' `return perspective;' ! `}' } 4 # ! { `void Listen(' `Sensor*' ! `);' } 4 # ! { `void SetCursor(' `Cursor*' ! `);' } 4 # ! { `void SetName(' `const char*' ! `);' } 4 # ! { `void SetIcon(' `Interactor*' ! `);' } 4 # ! { `void Iconify();' } * ! { `void DeIconify();' } * ! { `void Read(' `Event&' ! `);' } 4 # ! { `boolean Check();' } * ! { `boolean CheckQueue();' } * ! { `void Poll(' `Event&' ! `);' } 4 # ! { `void Sync();' } * ! { `virtual void Delete();' } * ! { `virtual void Resize();' } * ! { `virtual void Draw();' } * ! { `virtual void Redraw(' { `Coord left' ! `Coord bottom' ! `Coord right' ! `Coord top' ! } `, ' ^ _ _ ; ! `);' } 4 # ! { `virtual void Handle(' `Event&' ! `);' } 4 # ! { `virtual void Adjust(' `Perspective&' ! `);' } 4 # ! { `virtual void Update();' } * ! { `virtual void Orphan();' } * ! } < ^ _ _ ; } 4 # `};' } < ^ _ _ ; ! } < ^ _ _ ; ! } < 0 0 ~ } < ^ _ _ ;