home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vos2-121.zip / v / contrib / graph.h < prev    next >
C/C++ Source or Header  |  1998-10-16  |  4KB  |  112 lines

  1. /*******************************************************************************
  2.   Module : Graph.h
  3.   Contents : Class declarations for classes that display a graph window.
  4.   grphWin is the window itself, GraphPane is the drawing surface.
  5. *******************************************************************************/
  6.  
  7. #ifndef GRAPH_H
  8. #define GRAPH_H
  9. #include <v/vcanvas.h>
  10.  
  11. /*******************************************************************************
  12.   Class : GraphPane
  13.   Purpose : Encapsulates the drawing surface of a graph window.
  14. *******************************************************************************/
  15.  
  16. class GraphPane : public vCanvasPane
  17. {
  18.   //Variables used in computing screen positions of graph elements
  19.       int LeftMargin; //The margins of the graphing box
  20.   int TopMargin;
  21.   int FontHeight;
  22.   int FontWidth;
  23.   int BottomMargin;
  24.   int RightMargin;
  25.   int Height; //The actually size of the graphing window
  26.   int Width;
  27.   double Xextent;  //The maxium domain and range of the graph
  28.   double Yextent;
  29.   double Xint; //How far each x and y step are apart (in pixels)
  30.   double Yint;
  31.   double Mark; //Where the intensity mark is placed
  32.   
  33.   int data1; //The data being plotted
  34.   int data2;
  35.   
  36.   void PlotLine(int); //Function that actually draws the screen
  37.               
  38. public :
  39.     GraphPane(void);
  40.   
  41.   void Redraw(int,int,int,int); //Called whenever the screen needs updating
  42.   void Resize(int,int); //Handels resizing events
  43.   void SetDataSet(int,int); //Sets which data sets are displayed
  44.   void VScroll(int); //Hscroll controls zoom, Vxxx functions handle
  45.   void HScroll(int); //intensity mark
  46.   void VPage(int,int);
  47. };
  48.  
  49. class GraphMuPane : public vCanvasPane
  50. {
  51.   //Variables used in computing screen positions of graph elements
  52.       int LeftMargin; //The margins of the graphing box
  53.   int TopMargin;
  54.   int FontHeight;
  55.   int FontWidth;
  56.   int BottomMargin;
  57.   int RightMargin;
  58.   int Height; //The actually size of the graphing window
  59.   int Width;
  60.   double Xextent;  //The maxium domain and range of the graph
  61.   double Yextent;
  62.   double Xint; //How far each x and y step are apart (in pixels)
  63.   double Yint;
  64.   double Mark; //Where the intensity mark is placed
  65.   
  66.   int data1; //The data being plotted
  67.   int data2;
  68.   
  69.   void PlotLine(int); //Function that actually draws the screen
  70.               
  71. public :
  72.     GraphMuPane(void);
  73.   
  74.   void Redraw(int,int,int,int); //Called whenever the screen needs updating
  75.   void Resize(int,int); //Handels resizing events
  76.   void SetDataSet(int,int); //Sets which data sets are displayed
  77.   void VScroll(int); //Hscroll controls zoom, Vxxx functions handle
  78.   void HScroll(int); //intensity mark
  79.   void VPage(int,int);
  80. };
  81.  
  82. /*******************************************************************************
  83.   Class: grphWin
  84.   Purpose : grphWin is the window type that holds a graph pane, and handles
  85.   any command orginating in the graph window
  86. *******************************************************************************/
  87.  
  88. class grphWin : public vCmdWindow
  89. {
  90.   GraphPane* gp; //Pointer to instance of graphing pane (drawing surface)
  91.   vMenuPane* mp; //The menu
  92.   public :
  93.     grphWin(void); //Constructor
  94.   ~grphWin(void); //Destructor
  95.   //Sets which data sets are displayed              
  96.   void SetDataSet(int,int);
  97.   virtual void CloseWin(void); //Notify robust that the window is closed
  98. };
  99.  
  100. class grphMuWin : public vCmdWindow
  101. {
  102.   GraphMuPane* gp; //Pointer to instance of graphing pane (drawing surface)
  103.   vMenuPane* mp; //The menu
  104.   public :
  105.     grphMuWin(void); //Constructor
  106.   ~grphMuWin(void); //Destructor
  107.   //Sets which data sets are displayed              
  108.   void SetDataSet(int,int);
  109.   virtual void CloseWin(void); //Notify robust that the window is closed
  110. };
  111. #endif
  112.