//
// Objects of class DRAWING add visualization capabilities to an object of class GRAPH (see graph.h), 
// under the assumption to get a device context from somewhere.
// We want to embed the DRAWING object into an ActiveX control (using ATL).
// Since there are wizards to generate the code for the control (see SpringCtl.h, SpringCtl.cpp), 
// the only thing left to do are some more lines to brigde the gap to our implementation of DRAWING: 
// class BRIDGE is here for this purpose. 
//

class GRAPH;
class NODE;  
class CSpringCtl;

class DRAWING
{
  public:
          DRAWING(double, double, double, double);

          void Draw(HDC hdc);
          
          inline void SetGraph(GRAPH *_graph)
          {
             graph = _graph;
          }
          inline GRAPH *Graph(void)
          {
             return graph;
          }

          void SetBounds(RECT &);
          void NextStep(void);

           
  private:
          int TransformX(double); 
          int TransformY(double); 

          void DrawNode(HDC, NODE *);
          void DrawEdges(HDC, NODE *); 

          double xMin, yMin, xMax, yMax;  // world coordinates 
          RECT rect;                      // viewport 

          GRAPH *graph;                   // the graph
};


class BRIDGE
{
  public:
        BRIDGE(CSpringCtl *);
        ~BRIDGE();

        void Draw(HDC, RECT &);
        void NextStep(void);

 protected:
       DRAWING drawing;      // graph with capabilities to draw its layout
       CSpringCtl *control;  // the ActiveX control
};
