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 / STATE.H < prev    next >
C/C++ Source or Header  |  1980-01-05  |  5KB  |  133 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: state.h,v 1.11 90/01/25 16:27:29 interran Exp $
  24. // declares class State.
  25.  
  26. #ifndef state_h
  27. #define state_h
  28.  
  29. #include <InterViews/defs.h>
  30.  
  31. // Declare imported types.
  32.  
  33. class Graphic;
  34. class IBrush;
  35. class IColor;
  36. class IFont;
  37. class IPattern;
  38. class Interactor;
  39. class InteractorList;
  40. class MapIBrush;
  41. class MapIColor;
  42. class MapIFont;
  43. class MapIPattern;
  44. class Page;
  45. class Transformer;
  46.  
  47. // A State stores state information about the user's drawing and paint
  48. // attributes to be used when creating new Selections.
  49.  
  50. enum ModifStatus {
  51.     ReadOnly,            // no modifications to drawing allowed
  52.     Unmodified,            // no modifications have been made yet
  53.     Modified            // at least one modification has been made
  54. };
  55.  
  56. class State {
  57. public:
  58.  
  59.     State(Interactor*, Page*);
  60.     ~State();
  61.  
  62.     void Constrain(Coord&, Coord&);
  63.     void ToggleOrientation();
  64.  
  65.     IBrush* GetBrush();
  66.     IColor* GetFgColor();
  67.     IColor* GetBgColor();
  68.     const char* GetDrawingName();
  69.     boolean GetFillBg();
  70.     IFont* GetFont();
  71.     Graphic* GetGraphicGS();
  72.     boolean GetGridGravity();
  73.     double GetGridSpacing(boolean = false);
  74.     boolean GetGridVisibility();
  75.     int GetLineHt();
  76.     float GetMagnif();
  77.     MapIBrush* GetMapIBrush();
  78.     MapIColor* GetMapIFgColor();
  79.     MapIColor* GetMapIBgColor();
  80.     MapIFont* GetMapIFont();
  81.     MapIPattern* GetMapIPattern();
  82.     ModifStatus GetModifStatus();
  83.     IPattern* GetPattern();
  84.     Graphic* GetTextGS();
  85.     Painter* GetTextPainter();
  86.  
  87.     void SetBrush(IBrush*);
  88.     void SetFgColor(IColor*);
  89.     void SetBgColor(IColor*);
  90.     void SetDrawingName(const char*);
  91.     void SetFillBg(boolean);
  92.     void SetFont(IFont*);
  93.     void SetGraphicT(Transformer&);
  94.     void SetGridGravity(boolean);
  95.     void SetGridSpacing(double, boolean = false);
  96.     void SetGridVisibility(boolean);
  97.     void SetMagnif(float);
  98.     void SetModifStatus(ModifStatus);
  99.     void SetPattern(IPattern*);
  100.     void SetTextGS(Coord, Coord, Painter*);
  101.     void SetTextGS(Graphic*, Painter*);
  102.  
  103.     void Attach(Interactor*);
  104.     void Detach(Interactor*);
  105.     void UpdateViews();
  106.  
  107. protected:
  108.  
  109.     char* drawingname;        // stores drawing's filename
  110.     Graphic* graphicstate;    // stores all attributes for creating graphics
  111.     Transformer* graphicstate_t;// stores matrix for creating graphics
  112.     boolean gridding;        // stores true if grid will constrain points
  113.     float magnif;        // stores drawing view's magnification factor
  114.     MapIBrush* mapibrush;    // stores list of possible brushes
  115.     MapIColor* mapifgcolor;    // stores list of possible fg colors
  116.     MapIColor* mapibgcolor;    // stores list of possible bg colors
  117.     MapIFont* mapifont;        // stores list of possible fonts
  118.     MapIPattern* mapipattern;    // stores list of possible patterns
  119.     ModifStatus modifstatus;    // stores drawing's modification status
  120.     Page* page;            // stores all grid attributes
  121.     Graphic* textgs;        // stores all attributes for creating text
  122.     Transformer* textgs_t;    // stores matrix for creating text
  123.     Painter* textpainter;    // stores all attributes for editing text
  124.     Transformer* textpainter_t;    // stores matrix for editing text
  125.     float textx;        // stores last place text was being edited
  126.     float texty;        // stores last place text was being edited
  127.     int lineHt;            // stores spacing between lines of text
  128.     InteractorList* viewlist;    // stores list of views to notify
  129.  
  130. };
  131.  
  132. #endif
  133.