Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

FXPlotBase.h

00001 /*******************************************************************************
00002 * Copyright (C) 2003-2005 by Rafael de Pelegrini Soares.   All Rights Reserved.
00003 ********************************************************************************
00004 * This library is free software; you can redistribute it and/or
00005 * modify it under the terms of the GNU Lesser General Public
00006 * License as published by the Free Software Foundation; either
00007 * version 2.1 of the License, or (at your option) any later version.
00008 *
00009 * This library is distributed in the hope that it will be useful,
00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00012 * Lesser General Public License for more details.
00013 *
00014 * You should have received a copy of the GNU Lesser General Public
00015 * License along with this library; if not, write to the Free Software
00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
00017 ********************************************************************************
00018 * $Id: FXPlotBase.h,v 1.3 2006/01/31 12:51:14 rpseng Exp $
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         // FOX protected constructor.
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         // fox create
00230         void create(void);
00231         
00232         // fox callback messages
00233         long onPaint(FXObject*,FXSelector,void* ptr);
00234         long onSave(FXObject*,FXSelector,void* ptr);
00235 };
00236 
00237 
00238 #endif // __FXPlotBase_H

Generated on Tue Jan 31 10:55:30 2006 for FXPlot by  doxygen 1.4.4