Statistics
| Branch: | Revision:

root / src / tkenv / layouterenv.h @ fbe00e73

History | View | Annotate | Download (2.24 KB)

1
//==========================================================================
2
//  LAYOUTERENV.H - part of
3
//
4
//                     OMNeT++/OMNEST
5
//            Discrete System Simulation in C++
6
//
7
//==========================================================================
8

    
9
/*--------------------------------------------------------------*
10
  Copyright (C) 1992-2008 Andras Varga
11
  Copyright (C) 2006-2008 OpenSim Ltd.
12

13
  This file is distributed WITHOUT ANY WARRANTY. See the file
14
  `license' for details on this and other legal matters.
15
*--------------------------------------------------------------*/
16

    
17
#ifndef __LAYOUTERENV_H
18
#define __LAYOUTERENV_H
19

    
20
#include "timeutil.h"   // must precede <tk.h>, due to collision with <windows.h>
21
#include <tk.h>
22
#include "graphlayouter.h"
23

    
24
NAMESPACE_BEGIN
25

    
26
class cModule;
27
class cDisplayString;
28

    
29

    
30
class TGraphLayouterEnvironment : public GraphLayouterEnvironment
31
{
32
   protected:
33
      // configuration
34
      const char *widgetToGrab;
35
      const char *canvas;
36
      Tcl_Interp *interp;
37
      cModule *parentModule;
38
      const cDisplayString& displayString;
39

    
40
      // state
41
      struct timeval beginTime;
42
      struct timeval lastCheck;
43
      bool grabActive;
44

    
45
   public:
46
      TGraphLayouterEnvironment(Tcl_Interp *interp, cModule *parentModule, const cDisplayString& displayString);
47

    
48
      void setWidgetToGrab(const char *w) { this->widgetToGrab = w; }
49
      void setCanvas(const char *canvas) { this->canvas = canvas; }
50

    
51
      void cleanup();
52

    
53
      virtual bool inspected() { return canvas && interp; }
54
      virtual bool okToProceed();
55

    
56
      virtual bool getBoolParameter(const char *tagName, int index, bool defaultValue);
57
      virtual long getLongParameter(const char *tagName, int index, long defaultValue);
58
      virtual double getDoubleParameter(const char *tagName, int index, double defaultValue);
59

    
60
      virtual void clearGraphics();
61
      virtual void showGraphics(const char *text);
62
      virtual void drawText(double x, double y, const char *text, const char *tags, const char *color);
63
      virtual void drawLine(double x1, double y1, double x2, double y2, const char *tags, const char *color);
64
      virtual void drawRectangle(double x1, double y1, double x2, double y2, const char *tags, const char *color);
65
};
66

    
67
NAMESPACE_END
68

    
69

    
70
#endif