Panda3D
gtkStatsStripChart.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file gtkStatsStripChart.h
10  * @author drose
11  * @date 2006-01-16
12  */
13 
14 #ifndef GTKSTATSSTRIPCHART_H
15 #define GTKSTATSSTRIPCHART_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "gtkStatsGraph.h"
20 #include "pStatStripChart.h"
21 #include "pointerTo.h"
22 
23 #include <gtk/gtk.h>
24 
25 class GtkStatsMonitor;
26 
27 /**
28  * A window that draws a strip chart, given a view.
29  */
31 public:
33  int thread_index, int collector_index, bool show_level);
34  virtual ~GtkStatsStripChart();
35 
36  virtual void new_collector(int collector_index);
37  virtual void new_data(int thread_index, int frame_number);
38  virtual void force_redraw();
39  virtual void changed_graph_size(int graph_xsize, int graph_ysize);
40 
41  virtual void set_time_units(int unit_mask);
42  virtual void set_scroll_speed(double scroll_speed);
43  virtual void clicked_label(int collector_index);
44  void set_vertical_scale(double value_height);
45 
46 protected:
47  virtual void update_labels();
48 
49  virtual void clear_region();
50  virtual void copy_region(int start_x, int end_x, int dest_x);
51  virtual void draw_slice(int x, int w,
52  const PStatStripChart::FrameData &fdata);
53  virtual void draw_empty(int x, int w);
54  virtual void draw_cursor(int x);
55  virtual void end_draw(int from_x, int to_x);
56 
57  virtual void additional_graph_window_paint();
58  virtual DragMode consider_drag_start(int graph_x, int graph_y);
59  virtual void set_drag_mode(DragMode drag_mode);
60 
61  virtual gboolean handle_button_press(GtkWidget *widget, int graph_x, int graph_y,
62  bool double_click);
63  virtual gboolean handle_button_release(GtkWidget *widget, int graph_x, int graph_y);
64  virtual gboolean handle_motion(GtkWidget *widget, int graph_x, int graph_y);
65 
66 private:
67  void draw_guide_bar(GdkDrawable *surface, int from_x, int to_x,
68  const PStatGraph::GuideBar &bar);
69  void draw_guide_labels();
70  int draw_guide_label(const PStatGraph::GuideBar &bar, int last_y);
71 
72  static void toggled_callback(GtkToggleButton *button, gpointer data);
73  static gboolean expose_event_callback(GtkWidget *widget,
74  GdkEventExpose *event, gpointer data);
75 
76 private:
77  int _brush_origin;
78  std::string _net_value_text;
79 
80  GtkWidget *_top_hbox;
81  GtkWidget *_smooth_check_box;
82  GtkWidget *_total_label;
83 };
84 
85 #endif
A window that draws a strip chart, given a view.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
virtual void new_collector(int collector_index)
Called whenever a new Collector definition is received from the client.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:29
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.