00001
00002
00003
00004
00005
00006 #ifdef _VMS__
00007
00008 extern "C" {
00009 char* strdup (char* str);
00010 }
00011 #endif
00012
00013 #ifndef __XYTEXT_H
00014 #define __XYTEXT_H
00015
00016 #include <stdlib.h>
00017 #include <string.h>
00018
00019 #include "xyobj.h"
00020 #include <cd.h>
00021 #include <wd.h>
00022
00023 class XYGraph;
00024
00025
00026
00027
00028
00029
00030 class XYText : public XYObject
00031 {
00032 public:
00033
00034
00035
00036 enum Orientation {
00037 vertTopBot = -1,
00038 horizontal,
00039 vertBotTop
00040 };
00041
00042
00043
00044 enum Alignment {
00045 north,
00046 south,
00047 east,
00048 west,
00049 northEast,
00050 northWest,
00051 southEast,
00052 southWest,
00053 center,
00054 baseLeft,
00055 baseCenter,
00056 baseRight,
00057 leftBase = baseLeft,
00058 centerBase = baseCenter,
00059 rightBase = baseRight
00060 };
00061
00062
00063
00064 enum Typeface {
00065 common,
00066 timesRoman,
00067 courier,
00068 helvetica
00069 };
00070
00071
00072
00073 enum Style {
00074 plain,
00075 bold,
00076 italic,
00077 boldItalic,
00078 italicBold = boldItalic
00079 };
00080
00081
00082
00083 XYText (
00084 const char* text,
00085
00086 XYCoordinate x,
00087 XYCoordinate y,
00088 long color,
00089 Typeface font,
00090 Style style,
00091 Alignment alignment,
00092 Orientation orientation,
00093 xybool underline = xyfalse,
00094 xybool visible = xytrue);
00095
00096
00097 XYText (
00098 const char* text,
00099
00100 XYCoordinate x,
00101 XYCoordinate y,
00102 xybool visible = xytrue);
00103
00104
00105 XYText (
00106 const char* text,
00107 long color,
00108 Typeface font,
00109 Style style,
00110 Alignment alignment,
00111 Orientation orientation,
00112 xybool underline = xyfalse,
00113 xybool visible = xytrue);
00114
00115
00116 XYText (
00117 long color,
00118 Typeface font,
00119 Style style,
00120 Alignment alignment,
00121 Orientation orientation,
00122 xybool underline = xyfalse,
00123 xybool visible = xytrue);
00124
00125
00126 virtual ~XYText (void);
00127
00128
00129
00130 virtual void color (long c);
00131
00132 virtual long color (void) const;
00133
00134
00135 virtual void font (Typeface f);
00136
00137 virtual int font (void) const;
00138
00139
00140 virtual void style (Style sl);
00141
00142 virtual int style (void) const;
00143
00144
00145 virtual void align (Alignment a);
00146
00147 virtual int align (void) const;
00148
00149
00150 virtual void orientation (Orientation o);
00151
00152 virtual int orientation (void) const;
00153
00154
00155 virtual void text (const char* s);
00156
00157 virtual char* text (void) const;
00158
00159
00160 virtual void underline (xybool u);
00161
00162 virtual xybool underline (void) const;
00163
00164
00165
00166 virtual void operator= (const XYText &t);
00167
00168
00169 virtual void insertAction (XYGraph *g);
00170
00171
00172 virtual void removeAction (XYGraph *g);
00173
00174
00175
00176 virtual xybool pick (int px, int py);
00177
00178
00179 virtual xybool fence (int x0, int y0, int x1, int y1);
00180
00181
00182
00183 virtual void draw (void) = 0;
00184
00185 virtual void draw (int xmin, int ymin, int xmax, int ymax) const = 0;
00186
00187
00188
00189 virtual void boundingBox (int& bxmin, int& bymin, int& bxmax, int& bymax) const = 0;
00190
00191 protected:
00192
00193 static const int _underline_gap;
00194 char* _text;
00195 long _color;
00196 Typeface _font;
00197 Style _style;
00198 Alignment _alignment;
00199 Orientation _orientation;
00200
00201 xybool _underline;
00202 };
00203
00204 #endif
00205