Panda3D
 All Classes Functions Variables Enumerations
gtkStatsStripChart.h
1 // Filename: gtkStatsStripChart.h
2 // Created by: drose (16Jan06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef GTKSTATSSTRIPCHART_H
16 #define GTKSTATSSTRIPCHART_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "gtkStatsGraph.h"
21 #include "pStatStripChart.h"
22 #include "pointerTo.h"
23 
24 #include <gtk/gtk.h>
25 
26 class GtkStatsMonitor;
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : GtkStatsStripChart
30 // Description : A window that draws a strip chart, given a view.
31 ////////////////////////////////////////////////////////////////////
33 public:
35  int thread_index, int collector_index, bool show_level);
36  virtual ~GtkStatsStripChart();
37 
38  virtual void new_collector(int collector_index);
39  virtual void new_data(int thread_index, int frame_number);
40  virtual void force_redraw();
41  virtual void changed_graph_size(int graph_xsize, int graph_ysize);
42 
43  virtual void set_time_units(int unit_mask);
44  virtual void set_scroll_speed(double scroll_speed);
45  virtual void clicked_label(int collector_index);
46  void set_vertical_scale(double value_height);
47 
48 protected:
49  virtual void update_labels();
50 
51  virtual void clear_region();
52  virtual void copy_region(int start_x, int end_x, int dest_x);
53  virtual void draw_slice(int x, int w,
54  const PStatStripChart::FrameData &fdata);
55  virtual void draw_empty(int x, int w);
56  virtual void draw_cursor(int x);
57  virtual void end_draw(int from_x, int to_x);
58 
59  virtual void additional_graph_window_paint();
60  virtual DragMode consider_drag_start(int graph_x, int graph_y);
61  virtual void set_drag_mode(DragMode drag_mode);
62 
63  virtual gboolean handle_button_press(GtkWidget *widget, int graph_x, int graph_y,
64  bool double_click);
65  virtual gboolean handle_button_release(GtkWidget *widget, int graph_x, int graph_y);
66  virtual gboolean handle_motion(GtkWidget *widget, int graph_x, int graph_y);
67 
68 private:
69  void draw_guide_bar(GdkDrawable *surface, int from_x, int to_x,
70  const PStatGraph::GuideBar &bar);
71  void draw_guide_labels();
72  int draw_guide_label(const PStatGraph::GuideBar &bar, int last_y);
73 
74  static void toggled_callback(GtkToggleButton *button, gpointer data);
75  static gboolean expose_event_callback(GtkWidget *widget,
76  GdkEventExpose *event, gpointer data);
77 
78 private:
79  int _brush_origin;
80  string _net_value_text;
81 
82  GtkWidget *_top_hbox;
83  GtkWidget *_smooth_check_box;
84  GtkWidget *_total_label;
85 };
86 
87 #endif
88 
A window that draws a strip chart, given a view.
This is an abstract class that presents the interface for drawing a basic strip-chart, showing the relative value over an interval of time for several different collectors, differentiated by bands of color.
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:39
virtual void new_collector(int collector_index)
Called whenever a new Collector definition is received from the client.
virtual void set_time_units(int unit_mask)
Called when the user selects a new time units from the monitor pulldown menu, this should adjust the ...
virtual void new_data(int thread_index, int frame_number)
Called as each frame&#39;s data is made available.
This is just an abstract base class to provide a common pointer type for the various kinds of graphs ...
Definition: gtkStatsGraph.h:32
virtual void clicked_label(int collector_index)
Called when the user single-clicks on a label.
This class represents a connection to a PStatsClient and manages the data exchange with the client...
virtual void force_redraw()
Called when it is necessary to redraw the entire graph.
virtual void set_scroll_speed(double scroll_speed)
Called when the user selects a new scroll speed from the monitor pulldown menu, this should adjust th...
virtual void changed_graph_size(int graph_xsize, int graph_ysize)
Called when the user has resized the window, forcing a resize of the graph.
void set_vertical_scale(double value_height)
Changes the value the height of the vertical axis represents.