1:/*
   2: * Programming graphical user interfaces
   3: * Example: DiagramView.h
   4: * Jarkko Leponiemi 2003
   5: */
   6:#pragma once
   7:
   8:#include "Window.h"
   9:#include "Observer.h"
  10:#include "Diagram.h"
  11:
  12:class DiagramView : public Window, public Observer
  13:{
  14:public:
  15:  DiagramView(Diagram *diagram);
  16:  ~DiagramView();
  17:
  18:  void Update(Observable *o, int type, void *args);
  19:
  20:protected:
  21:  void OnPaint(HDC hdc);
  22:  void OnMouse(UINT message, int x, int y, long modifiers);
  23:  void OnKeyStroke(int vkey);
  24:
  25:  void GetNodeRect(HDC hdc, Node *n, RECT *r);
  26:  Node *FindNodeInPoint(HDC hdc, int x, int y);
  27:  void DrawTempConnector(HDC hdc);
  28:
  29:private:
  30:  Diagram *diagram;
  31:  int mode;
  32:  Node *moving;
  33:  int ox, oy;
  34:};