00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __FXPlotBase_H
00024 #define __FXPlotBase_H
00025
00026 #include <fx.h>
00027 #include <FXPNGImage.h>
00028 #include <FXJPGImage.h>
00029 #include <FXTIFImage.h>
00030 #include <FXICOImage.h>
00031 #include <FXTGAImage.h>
00032 #include <FXRGBImage.h>
00033
00118 struct FXPlotPen
00119 {
00121 enum Style {
00122 Solid = LINE_SOLID,
00123 Dash = LINE_ONOFF_DASH,
00124 DoubleDash = LINE_DOUBLE_DASH,
00125 };
00127 enum CapStyle {
00128 Flat = CAP_NOT_LAST,
00129 SquareCap = CAP_PROJECTING,
00130 RoundCap = CAP_ROUND,
00131 };
00132
00134 enum JoinStyle {
00135 MiterJoin = JOIN_MITER,
00136 BevelJoin = JOIN_BEVEL,
00137 RoundJoin = JOIN_ROUND,
00138 };
00139
00141 FXPlotPen(FXColor color = FXRGB(0,0,0), FXint width = 0, Style style = Solid,
00142 CapStyle cap = Flat, JoinStyle join = MiterJoin){
00143 this->color = color;
00144 this->width = FXMAX(0,width);
00145 this->style = style;
00146 this->cap = cap;
00147 this->join = join;
00148 }
00149
00151 FXbool operator==(const FXPlotPen &p) const {
00152 return color == p.color &&
00153 width == p.width &&
00154 style == p.style &&
00155 cap == p.cap &&
00156 join == p.join;
00157 };
00158
00160 FXColor color;
00162 FXint style;
00164 CapStyle cap;
00166 JoinStyle join;
00168 FXuint width;
00169 };
00170
00172 FXDC* operator << (FXDC *dc, const FXPlotPen &p);
00173
00174
00188 class FXPlotBase : public FXFrame
00189 {
00190 FXDECLARE(FXPlotBase)
00191 protected:
00192
00193 FXPlotBase(){}
00194
00196 FXImage *img;
00197
00199 FXString name;
00200
00202 FXPlotPen grid;
00204 FXPlotPen comm;
00205
00207 FXColor bg;
00208 public:
00210 FXPlotBase(FXComposite *parent, FXString Name);
00211
00213 virtual ~FXPlotBase();
00214
00216 void setGridPen(const FXPlotPen &pen);
00218 void setCommonPen(const FXPlotPen &pen);
00220 FXbool saveImage(const FXString& file);
00221
00227 virtual void drawSelf(FXDC *p, FXint rootx=0, FXint rooty=0){};
00228
00229
00230 void create(void);
00231
00232
00233 long onPaint(FXObject*,FXSelector,void* ptr);
00234 long onSave(FXObject*,FXSelector,void* ptr);
00235 };
00236
00237
00238 #endif // __FXPlotBase_H