home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / iv_pm.zip / iv / src / InterViews / viewport.h < prev    next >
C/C++ Source or Header  |  1990-12-20  |  3KB  |  96 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /****
  24.  
  25.  Copyright (C) 1990 Texas Instruments Incorporated.
  26.  
  27.  Permission is granted to any individual or institution to use, copy, modify,
  28.  and distribute this software, provided that this complete copyright and
  29.  permission notice is maintained, intact, in all copies and supporting
  30.  documentation.
  31.  
  32.  Texas Instruments Incorporated provides this software "as is" without express
  33.  or implied warranty.
  34.  
  35. ****/
  36.  
  37. /*
  38.  * A viewport contains another interactor.  Unlike a MonoScene or Frame,
  39.  * a viewport always gives the interactor its desired shape.  However,
  40.  * the interactor may not be entirely viewable through the viewport.
  41.  * The viewport's perspective can be used to adjust what portion is visible.
  42.  */
  43.  
  44. #ifndef viewport_h
  45. #define viewport_h
  46.  
  47. #include <InterViews/scene.h>
  48.  
  49. class Viewport : public MonoScene {
  50. public:
  51.     Viewport(Interactor* = nil, Alignment = Center);
  52.     Viewport(const char*, Interactor* = nil, Alignment = Center);
  53.     Viewport(Sensor*, Painter*, Interactor* = nil, Alignment = Center);
  54.     ~Viewport();
  55.  
  56.     virtual void Adjust(Perspective&);
  57.     virtual void Resize();
  58.  
  59.     void AdjustTo(float px, float py, float zx, float zy);
  60.     void AdjustBy(float dpx, float dpy, float dzx, float dzy);
  61.  
  62.     void ScrollTo(float px, float py);
  63.     void ScrollXTo(float px);
  64.     void ScrollYTo(float py);
  65.     void ScrollBy(float dpx, float dpy);
  66.     void ScrollXBy(float dpx);
  67.     void ScrollYBy(float dpy);
  68.  
  69.     void ZoomTo(float zx, float zy);
  70.     void ZoomXTo(float zx);
  71.     void ZoomYTo(float zy);
  72.     void ZoomBy(float dzx, float dzy);
  73.     void ZoomXBy(float dzx);
  74.     void ZoomYBy(float dzy);
  75.  
  76.     float XPos();
  77.     float YPos();
  78.     float XMag();
  79.     float YMag();
  80. protected:
  81.     Alignment align;
  82.     Painter* background;
  83.  
  84.     virtual void Reconfig();
  85.     virtual void Redraw(Coord, Coord, Coord, Coord);
  86.     virtual void DoMove(Interactor*, Coord& x, Coord& y);
  87. private:
  88.     long cwidth;
  89.     long cheight;
  90.  
  91.     void Init(Interactor*, Alignment);
  92.     void DoAdjust(float px, float py, float zx, float zy);
  93. };
  94.  
  95. #endif
  96.