00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef GTKSTATSSTRIPCHART_H
00016 #define GTKSTATSSTRIPCHART_H
00017
00018 #include "pandatoolbase.h"
00019
00020 #include "gtkStatsGraph.h"
00021 #include "pStatStripChart.h"
00022 #include "pointerTo.h"
00023
00024 #include <gtk/gtk.h>
00025
00026 class GtkStatsMonitor;
00027
00028
00029
00030
00031
00032 class GtkStatsStripChart : public PStatStripChart, public GtkStatsGraph {
00033 public:
00034 GtkStatsStripChart(GtkStatsMonitor *monitor,
00035 int thread_index, int collector_index, bool show_level);
00036 virtual ~GtkStatsStripChart();
00037
00038 virtual void new_collector(int collector_index);
00039 virtual void new_data(int thread_index, int frame_number);
00040 virtual void force_redraw();
00041 virtual void changed_graph_size(int graph_xsize, int graph_ysize);
00042
00043 virtual void set_time_units(int unit_mask);
00044 virtual void set_scroll_speed(double scroll_speed);
00045 virtual void clicked_label(int collector_index);
00046 void set_vertical_scale(double value_height);
00047
00048 protected:
00049 virtual void update_labels();
00050
00051 virtual void clear_region();
00052 virtual void copy_region(int start_x, int end_x, int dest_x);
00053 virtual void draw_slice(int x, int w,
00054 const PStatStripChart::FrameData &fdata);
00055 virtual void draw_empty(int x, int w);
00056 virtual void draw_cursor(int x);
00057 virtual void end_draw(int from_x, int to_x);
00058
00059 virtual void additional_graph_window_paint();
00060 virtual DragMode consider_drag_start(int graph_x, int graph_y);
00061 virtual void set_drag_mode(DragMode drag_mode);
00062
00063 virtual gboolean handle_button_press(GtkWidget *widget, int graph_x, int graph_y,
00064 bool double_click);
00065 virtual gboolean handle_button_release(GtkWidget *widget, int graph_x, int graph_y);
00066 virtual gboolean handle_motion(GtkWidget *widget, int graph_x, int graph_y);
00067
00068 private:
00069 void draw_guide_bar(GdkDrawable *surface, int from_x, int to_x,
00070 const PStatGraph::GuideBar &bar);
00071 void draw_guide_labels();
00072 int draw_guide_label(const PStatGraph::GuideBar &bar, int last_y);
00073
00074 static void toggled_callback(GtkToggleButton *button, gpointer data);
00075 static gboolean expose_event_callback(GtkWidget *widget,
00076 GdkEventExpose *event, gpointer data);
00077
00078 private:
00079 int _brush_origin;
00080 string _net_value_text;
00081
00082 GtkWidget *_top_hbox;
00083 GtkWidget *_smooth_check_box;
00084 GtkWidget *_total_label;
00085 };
00086
00087 #endif
00088