00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef GTKWINDOW_HPP
00044 #define GTKWINDOW_HPP 1
00045
00046
00047 #include <cairo.h>
00048 #include <gtk/gtk.h>
00049
00050 #include "gtkplotter.hpp"
00051 #include "frame.hpp"
00052 #include "graph3d.hpp"
00053
00054
00055
00061 class GTKWindow {
00062
00063 size_t _width;
00064 size_t _height;
00065
00066 GtkWidget *_trackwindow;
00067 GtkWidget *_tracklabel;
00068
00069 cairo_t *_cairo;
00070 cairo_surface_t *_surface;
00071
00072 int _start[2];
00073 int _end[2];
00074 int _tool;
00075
00076 void hardcopy( void );
00077 void move( int action, double x, double y );
00078 void track( int action, double x, double y );
00079 void zoom_out( double x, double y );
00080 void zoom_in( double x, double y );
00081 void zoom_window( int action, double x, double y );
00082
00083 void darea_motion( GdkEventMotion *event );
00084 void darea_enter( GdkEventCrossing *event );
00085 void darea_leave( GdkEventCrossing *event );
00086 void darea_button( GdkEventButton *event );
00087 void configure( void );
00088 void derea_button( GdkEventButton *event );
00089 void delete_window( void );
00090 void menuitem_tool_change( GtkToolButton *button );
00091 void menuitem_preferences( GtkMenuItem *menuitem );
00092
00093 static gboolean window_delete_signal( GtkWidget *widget,
00094 GdkEventExpose *event,
00095 gpointer object );
00096
00097 static void menuitem_quit_signal( GtkMenuItem *menuitem,
00098 gpointer object );
00099 static void menuitem_tool_change_signal( GtkToolButton *button,
00100 gpointer object );
00101 static void menuitem_hardcopy_signal( GtkToolButton *button,
00102 gpointer object );
00103 static void menuitem_zoom_fit_signal( GtkToolButton *button,
00104 gpointer object );
00105 static void menuitem_preferences_signal( GtkMenuItem *menuitem,
00106 gpointer object );
00107
00108 static gboolean darea_configure_signal( GtkWidget *widget,
00109 GdkEventConfigure *event,
00110 gpointer object );
00111 static gboolean darea_expose_signal( GtkWidget *widget,
00112 GdkEventExpose *event,
00113 gpointer object );
00114 static gboolean darea_button_signal( GtkWidget *widget,
00115 GdkEventButton *event,
00116 gpointer object );
00117 static gboolean darea_motion_signal( GtkWidget *widget,
00118 GdkEventMotion *event,
00119 gpointer object );
00120 static gboolean darea_enter_signal( GtkWidget *widget,
00121 GdkEventCrossing *event,
00122 gpointer object );
00123 static gboolean darea_leave_signal( GtkWidget *widget,
00124 GdkEventCrossing *event,
00125 gpointer object );
00126
00127 protected:
00128
00129 GTKPlotter *_plotter;
00130
00131 Frame _frame;
00132 GtkWidget *_window;
00133 GtkWidget *_darea;
00134 GtkWidget *_menubar;
00135 GtkWidget *_menu_file;
00136 GtkWidget *_toolbar;
00137 GtkWidget *_statusbar;
00138
00139 GtkToolItem *_radioitem;
00140
00141 double _track_px;
00142 double _track_py;
00143
00144
00145 GTKWindow( GTKPlotter *plotter );
00146
00147 virtual void zoom_fit( void );
00148
00154 virtual std::string track_text( double x, double y );
00155
00156 void expose( int x, int y, int width, int height );
00157
00158 public:
00159
00160 virtual ~GTKWindow();
00161
00162 virtual void *build_preferences( GtkWidget *notebook );
00163 virtual void read_preferences( GtkWidget *notebook, void *pdata );
00164
00165 void draw_and_expose( void );
00166 void show( void );
00167 };
00168
00169
00170
00171
00172
00173 #endif
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191