/* * PlainScene is a subclass of Scene with the minimal specialization necessary * to create Scene objects. Since Scene is a virtual class, objects of type * Scene cannot be constructed directly. To enable construction, PlainScene * provides a public constructor and fundamental implementations for the pure * virtual member functions of Scene. With these implmentations, a PlainScene * interactor has the following properties: * * 1. Scene elements can be inserted at any positive x,y coordinates * within the scene. The operation is Insert(Interactor*, Coord x=0, * Coord y=0). * * 2. Scene elements can be moved after placement to any postive x,y * postion within the scene. If an element is moved beyond the current * scene boundaries, the scene is reshaped accordingly after the move. * The operation is Move(Interactor*, Coord x, Coord y). * * 3. Scene elements can be removed from the scene. The scene is reshaped * accordingly after the removal. The operation is * Remove(Interactor*). * * 4. Scene elements can be raised and lowered relative to other scene * elements. Raising moves an element all the way to the front, * lowering moves an element all the way to the back. The operations * are Raise(Interactor*) and Lower(Interactor*). * * 5. The scene itself has infinite strechability and shrinkability, even * if no glue is present within it. * * 6. When the scene is reshaped, its elements remain in place and do not * themselves change shape. Hence, glue between scene elements is * effectively useless for its normal purpose. * * 7. The scene coordinate space is positive only. Any element inserted * at or moved to a negative coordinate position is not visible. * * 8. The scene has a transparent background. Actually, it has no * background, which means it appears transparent. * */ #ifndef plainsceneIncluded #define plainsceneIncluded #include class Interactor; class PlainSceneElement; class PlainScene : public Scene { public: /* * The following four public functions are necessary for a PlainScene to * function properly within the InterViews environment. These functions * are called from elsewhere within InterViews to make things happen. See, * in particular, scene.c, interactor.c, X11-scene.c, and X11-inter.c. */ void Draw (); void GetComponents(Interactor**, int, Interactor**&, int&); void Resize(); void Reconfig(); protected: /* * The following protected funtions are necessary to provide functionality * for the public Scene functions of the same names without the "Do" * prefix. Users of PlainScene call Insert, Change, etc. The specialized * implementations of these functions are DoInsert, DoChange, etc. See * scene.{h,c} for further details. */ virtual void DoInsert(Interactor* i, boolean, Coord &x, Coord &y); virtual void DoChange(Interactor* i); virtual void DoMove(Interactor *i, Coord& x, Coord& y); virtual void DoRemove(Interactor* i); virtual void DoRaise(Interactor* i); virtual void DoLower(Interactor* i); /* * The following data members are used to record scene elements locally. * Class Scene does not provide for this storage (which is pretty stupid, * but heh). The elements are stored in a simple linked list, with head * and tail pointers. */ int nelements; PlainSceneElement* head; PlainSceneElement* tail; }; class PlainSceneElement { public: Coord x,y,h,w; Interactor* child; boolean visible; PlainSceneElement* next; }; #endif