1:/*
   2: * Programming Graphical User Interfaces
   3: * Example: DiagramApp.cpp
   4: * Jarkko Leponiemi 2003
   5: */
   6:
   7:#include "Application.h"
   8:#include "Diagram.h"
   9:#include "DiagramView.h"
  10:
  11:class DiagramApp: public Application
  12:{
  13:protected:
  14:  BOOL InitApplication();
  15:private:
  16:  Diagram diagram;
  17:};
  18:
  19:// the application object must be created somewhere
  20:DiagramApp dApp;
  21:
  22:// create the main window in here
  23:BOOL DiagramApp::InitApplication()
  24:{
  25:  // create the initial diagram
  26:  Node *n1 = diagram.CreateNode("First node", 50, 50);
  27:  Node *n2 = diagram.CreateNode("Second node", 150, 20);
  28:  Node *n3 = diagram.CreateNode("Third node", 100, 100);
  29:  diagram.CreateConnector(n1, n2);
  30:  diagram.CreateConnector(n2, n3);
  31:  diagram.CreateConnector(n3, n1);
  32:
  33:  mainWindow = new DiagramView(&diagram);
  34:  mainWindow->Create("Diagram");
  35:  return true;
  36:}
  37: