00001 /* 00002 00003 Widget for drawing graphs in realtime 00004 Copyright (C) 2003 Jussi Laako 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 */ 00021 00022 00023 #include <gdk/gdk.h> 00024 #include <gtk/gtk.h> 00025 00026 #include "Exception.hh" 00027 00028 00029 #ifndef GRAPHWIDGET_HH 00030 #define GRAPHWIDGET_HH 00031 00032 #define GRAPHWIDGET_MARGIN_TOP 10 00033 #define GRAPHWIDGET_MARGIN_LEFT 50 00034 #define GRAPHWIDGET_MARGIN_BOTTOM 25 00035 #define GRAPHWIDGET_MARGIN_RIGHT 10 00036 00037 00038 class clGraphWidget 00039 { 00040 class clXGraphWidget : public clException 00041 { 00042 public: 00043 clXGraphWidget (const char *cpErrorMsg, 00044 int iErrorCode = 0) throw() : 00045 clException(cpErrorMsg, iErrorCode) 00046 { } 00047 }; 00048 00049 long lWidth; 00050 long lHeight; 00051 long lMarginTop; 00052 long lMarginLeft; 00053 long lMarginBottom; 00054 long lMarginRight; 00055 long lGraphWidth; 00056 long lGraphHeight; 00057 double dXLeft; 00058 double dXRight; 00059 double dYBottom; 00060 double dYTop; 00061 double dXRange; 00062 double dYRange; 00063 00064 GtkWidget *gwParent; 00065 GtkWidget *gwDrawingArea; 00066 00067 void MapToDisplay (int *, int *, double, double); 00068 public: 00069 clGraphWidget (); 00070 ~clGraphWidget (); 00071 GtkWidget * Create (GtkWidget *); 00072 GtkWidget * GetPtr () 00073 { return gwDrawingArea; } 00074 void SetSize (int, int); 00075 }; 00076 00077 #endif
1.3.3