summaryrefslogtreecommitdiffstats
path: root/tksao/util/gridbase.h
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2016-10-27 18:59:29 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2016-10-27 18:59:29 (GMT)
commitd4d595fa7fb12903db9227d33d48b2b00120dbd1 (patch)
tree7d18365de0d6d1b29399b6a17c7eb01c2eb3ed49 /tksao/util/gridbase.h
parent949f96e29bfe0bd8710d775ce220e597064e2589 (diff)
downloadblt-d4d595fa7fb12903db9227d33d48b2b00120dbd1.zip
blt-d4d595fa7fb12903db9227d33d48b2b00120dbd1.tar.gz
blt-d4d595fa7fb12903db9227d33d48b2b00120dbd1.tar.bz2
Initial commit
Diffstat (limited to 'tksao/util/gridbase.h')
-rw-r--r--tksao/util/gridbase.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/tksao/util/gridbase.h b/tksao/util/gridbase.h
new file mode 100644
index 0000000..fec7705
--- /dev/null
+++ b/tksao/util/gridbase.h
@@ -0,0 +1,67 @@
+// Copyright (C) 1999-2016
+// 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 "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_;
+ int 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