summaryrefslogtreecommitdiffstats
path: root/tksao/util/gridbase.h
blob: 51d7384bf6e06c1ca9afc6f0673cbaf9b1887e86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (C) 1999-2018
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"

#ifndef __gridbase_h__
#define __gridbase_h__

#include <tk.h>

#include "widget.h"
#include "vector.h"

class Widget;
class Attribute;

class GridBase {
 public:
  enum RenderMode {X11, PS, MACOSX, GWIN32};

 protected:
  Widget* parent_;
  char* option_;

  RenderMode renderMode_;
  Attribute* line_;
  Attribute* text_;

  GC gridGC_;
  Pixmap pixmap_;

  Matrix matrix_;
  PSColorSpace mode_;

 protected:
  int x11Line(int n, float* x, float* y);
  int x11Text(const char*, float, float, const char*, Vector);

  int psLine(int n, float* x, float* y);
  int psText(const char*, float, float, const char*, Vector);
  void psColor(Attribute*);

#ifdef MAC_OSX_TK
  int macosxLine(int n, float* x, float* y);
  int macosxText(const char*, float, float, const char*, Vector);
#endif

#ifdef __WIN32
  int win32Line(int n, float* x, float* y);
  int win32Text(const char*, float, float, const char*, Vector);
#endif

  double calcTextAngle(const char*, Vector);
  Matrix calcTextPos(const Vector&, double, const char*, 
		     const char*, Vector, Tk_Font);

 public:  
  GridBase(Widget*);
  GridBase(Widget*, const char*);
  virtual ~GridBase();

  int gAttr(int attr, double value, double* old, int prim);
  int gCap(int, int);
  int gFlush() {return 1;}

  const char* option() {return option_;}
};

#endif