home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / i / iv26_w_3.zip / EXAMPLES / IDRAW / RUBBANDS.H < prev    next >
C/C++ Source or Header  |  1980-01-05  |  3KB  |  78 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. // $Header: rubbands.h,v 1.9 89/10/09 14:49:20 linton Exp $
  24. // defines classes IStretchingRect, RubberMultiLine, and RubberPolygon.
  25.  
  26. #ifndef rubbands_h
  27. #define rubbands_h
  28.  
  29. #include <InterViews/rubcurve.h>
  30. #include <InterViews/rubline.h>
  31. #include <InterViews/rubrect.h>
  32.  
  33. // An IStretchingRect uses its first few Track calls to decide which
  34. // side it will let the user drag.
  35.  
  36. class IStretchingRect : public StretchingRect {
  37. public:
  38.  
  39.     IStretchingRect(Painter*, Canvas*, Coord, Coord, Coord, Coord,
  40.             Coord = 0, Coord = 0);
  41.  
  42.     void Track(Coord, Coord);
  43.     void DefineSide(Coord, Coord);
  44.     Alignment CurrentSide(boolean landscape);
  45.  
  46. protected:
  47.  
  48.     boolean firsttime;        // stores true until after first call of Track
  49.     boolean undefinedside;    // stores true until side has been determined
  50.     Coord cx, cy;        // stores original center of rectangle
  51.     Coord origx, origy;        // stores point passed by first call of Track
  52.  
  53. };
  54.  
  55. // A RubberMultiLine lets the user drag one of its vertices.
  56.  
  57. class RubberMultiLine : public RubberVertex {
  58. public:
  59.     RubberMultiLine(
  60.         Painter*, Canvas*, Coord px[], Coord py[], int n, int pt,
  61.     Coord offx = 0, Coord offy = 0
  62.     );
  63.     void Draw();
  64. };
  65.  
  66. // A RubberPolygon lets the user drag one of its vertices.
  67.  
  68. class RubberPolygon : public RubberVertex {
  69. public:
  70.     RubberPolygon(
  71.         Painter*, Canvas*, Coord px[], Coord py[], int n, int pt,
  72.     Coord offx = 0, Coord offy = 0
  73.     );
  74.     void Draw();
  75. };
  76.  
  77. #endif
  78.