home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dokpr1.zip / graphel.h < prev    next >
C/C++ Source or Header  |  1994-12-23  |  3KB  |  80 lines

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *                                                                        *
  4.  *          This code is copyright (c) 1994                               *
  5.  *                     Athena Design, Inc.                                *
  6.  *                                                                        *
  7.  *                                                                        *
  8.  *                ALL RIGHTS RESERVED                                     *
  9.  *                                                                        *
  10.  *                                                                        *
  11.  *                                                                        *
  12.  *                                                                        *
  13.  *                                                                        *
  14.  **************************************************************************/
  15.  
  16. // 94-09-05 dpp
  17. // Each element in a graph has certain attributes, i.e., color, font, etc.
  18. // this class keeps track of these items.  There is an instance of this
  19. // class for each element in a graph
  20.  
  21. // make sure we're only included once
  22. #ifndef _MH_graphElement
  23.  
  24. #define _MH_graphElement
  25.  
  26. #include "color.h"
  27. #include "font.h"
  28.  
  29. class MModel;
  30. class MStream;
  31.  
  32. class MGraphElement
  33. {
  34.     public:
  35.     // put in default values
  36.     void init();
  37.     
  38.     // put in default values for the n-th element in a graph
  39.     void init(int);
  40.     
  41.     void init(const MGraphElement *);
  42.     
  43.     // read from a stream
  44.     void init(MStream *);
  45.     
  46.     // free me
  47.     void free() {theColor.free(); borderColor.free(); font.free();};
  48.     
  49.     // write to a stream
  50.     void write(MStream *) const;
  51.     
  52.     // get the information about the graph element
  53.     MColor getColor() const {return theColor;};
  54.     MColor getBorderColor() const {return borderColor;};
  55.     const MFont *getFont() const {return &font;};
  56.     void setFontSize(int s) {font.setSize(s);};
  57.     int getBorderSize() const {return borderSize;};
  58.     
  59.     // set information
  60.     void setColor(MColor c) {theColor = c;};
  61.     void setColor(int c) {theColor.set(c);};
  62.     void setBorderColor(MColor c) {borderColor = c;};
  63.     void setFont(const MFont *fp) {font = *fp;};
  64.     void setBorderSize(int bs) {borderSize = bs;};
  65.     
  66. //    MGraphElement &operator=(const MGraphElement &ge) {free(); init(&ge); return *this;};
  67.     
  68.     private:
  69.     MColor theColor,borderColor;    // the color of the element and of the border
  70.     MFont font;                        // the font that info will be displayed in
  71.     int attributes;                    // what kind of info to display
  72.     int pulled;                        // how far is a pie piece pulled out
  73.     int borderSize;                    // how big is the border
  74.     
  75.     void operator=(const MGraphElement &);
  76. };
  77.  
  78. // ifndef _MH_graphElement
  79. #endif
  80.